Hello this method is generating a .csv file but with blank lines after the sequence, what i need to do is to delete these blank
Below is the code.
Thanks in advance
static void GenerateCsv(DataTable dt, string device, string Menutree, string EndNote, double Länge, double Breite, string PicturePath)
{
string ProgramPfad = (@"C:\Robotron\MobileRobotDaten\" + device + "_" + Menutree + "_" + EndNote + ".csv");
using (System.IO.StreamWriter file = new System.IO.StreamWriter(ProgramPfad))
{
file.WriteLine("PROJECT;SEQUENCE;STEP;XPOS;YPOS;ZPOS;WRIST;WRISTROT;SPEED;PAUSE");
int a = 1;
int b = 1;
string[] buffer = new string[dt.Rows.Count];
for (int i = 0; i < (3 * dt.Rows.Count); i++)
{
string end = dt.Rows[i].ItemArray[0].ToString();
string Prozent = dt.Rows[i].ItemArray[1].ToString();
if (!end.Contains("End"))
{
Prozent = Calculate(Prozent, Länge, Breite);
}
if (end.Contains(EndNote))
{
foreach (string strg in buffer)
{
file.WriteLine(strg);
}
/* Picture Path*/
// file.WriteLine(PicturePath);
break;
}
/* Anpassen Z*/
buffer[b - 1] = (device + ";" + a + ";" + 1 + ";" + Prozent + ";" + "3" + ";" + 71 + ";" + -51 + ";" + 40 + ";" + 400);
b++;
/* Anpassen Z*/
buffer[b - 1] = (device + ";" + a + ";" + 2 + ";" + Prozent + ";" + "1,1" + ";" + 71 + ";" + -51 + ";" + 10);
b++;
/* Anpassen Z*/
buffer[b - 1] = (device + ";" + a + ";" + 3 + ";" + Prozent + ";" + "3" + ";" + 71 + ";" + -51 + ";" + 25 + ";" + 100);
a++;
b++;
if (end.Contains("End"))
{
Array.Clear(buffer, 0, buffer.Length);
a = 1;
b = 1;
}
}
}
}