string month = DateTime.Today.Month.ToString();
if (DateTime.Today.Month < 10)
{
month = "0" + month;
}
string day = DateTime.Today.Day.ToString();
if (DateTime.Today.Day < 10)
{
day = "0" + day;
}
string dateCorrect = String.Format("{0}.{1}.{2}", DateTime.Today.Year, month, day);
string dateDue = "";
if (transferFields.DueDate.SelectedDate.HasValue)
{
var dateDuearr = transferFields.DueDate.Value.Split(' ')[0].Split('.');
dateDue = dateDuearr[2] + '.' + dateDuearr[1] + '.' + dateDuearr[0];
}
else {
dateDue = dateCorrect;
}
Real developers don't use built in parsing and formatting methods.
bool b = connection.isConnected() == true ? true : false;
My first internship presented me with this.
if (!String.IsNullOrEmpty(Client.CLADDR1))
{
if (Client.CLADDR1 == "NULL")
{
//this is a commit!!
trans.Commit();
It doesn't look like it was there because of some changes - someone simply wanted to be double sure he will see the commit there, I guess..
private void reset_kolejnosc()
{
this.kolejnosc_s[0] = 1;
this.kolejnosc_s[1] = 2;
this.kolejnosc_s[2] = 3;
this.kolejnosc_s[3] = 4;
this.kolejnosc_s[4] = 5;
this.kolejnosc_s[5] = 6;
this.kolejnosc_s[6] = 7;
this.kolejnosc_s[7] = 8;
this.kolejnosc_s[8] = 9;
this.kolejnosc_s[9] = 10;
}
protected Int32 Sum(int one, int two)
{
int result;
int tmp;
tmp = one + two;
result = tmp;
return result;
}
Jesus.
foreach (Byte bajt in data ) {
BufferIndex = i++;
if (!char.IsControl((char)bajt))
MyCharacter = Convert.ToChar(bajt).ToString();//Encoding.ASCII.GetString(new[]{bajt});
else
MyCharacter = " ";
if (BufferIndex == 200)
{
int a = BufferIndex;
}
if (BufferIndex < 200)
{
sw.WriteLine("PrintBuffer1[" + BufferIndex + "] :=\t" + bajt + "\t; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + "\t" + MyCharacter );
}
if (BufferIndex >= 200 && BufferIndex < 400)
{
BufferIndex = BufferIndex - 200;
sw.WriteLine("PrintBuffer2[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 400 && BufferIndex < 600)
{
BufferIndex = BufferIndex - 400;
sw.WriteLine("PrintBuffer3[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 600 && BufferIndex < 800)
{
BufferIndex = BufferIndex - 600;
sw.WriteLine("PrintBuffer4[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 800 && BufferIndex < 1000)
{
BufferIndex = BufferIndex - 800;
sw.WriteLine("PrintBuffer5[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 1000 && BufferIndex < 1200)
{
BufferIndex = BufferIndex - 1000;
sw.WriteLine("PrintBuffer6[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 1200 && BufferIndex < 1400)
{
BufferIndex = BufferIndex - 1200;
sw.WriteLine("PrintBuffer7[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 1400 && BufferIndex < 1600)
{
BufferIndex = BufferIndex - 1400;
sw.WriteLine("PrintBuffer8[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 1600 && BufferIndex < 1800)
{
BufferIndex = BufferIndex - 1600;
sw.WriteLine("PrintBuffer9[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 1800 && BufferIndex < 2000)
{
BufferIndex = BufferIndex - 1800;
sw.WriteLine("PrintBuffer10[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 2000 && BufferIndex < 2200)
{
BufferIndex = BufferIndex - 2000;
sw.WriteLine("PrintBuffer11[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 2200 && BufferIndex < 2400)
{
BufferIndex = BufferIndex - 2200;
sw.WriteLine("PrintBuffer12[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
}
don't repeat yourself.. whyy we don't have PrintBufeer[i] ?
public event EventHandler<Cles_graph_doivent_etre_redessines> les_graph_doivent_etre_redessines;
public void remove_event()
{
if (this.les_graph_doivent_etre_redessines != null)
{
foreach (EventHandler<Cles_graph_doivent_etre_redessines> F_les_graph_doivent_etre_redessines in this.les_graph_doivent_etre_redessines.GetInvocationList())
{
this.les_graph_doivent_etre_redessines -= F_les_graph_doivent_etre_redessines;
}
}
}