Permalink
Browse files

Fixing a few csv bugs, now more reliable

git-svn-id: http://firstforge.wpi.edu/svn/repos/zomb/trunk@492 0141d0df-edca-4edd-a601-3402401f7f08
  • Loading branch information...
byteit101 committed Jan 17, 2012
1 parent 1ae600e commit 746413f7fb7ae08cad72015b4cc46c8c17809bff
Showing with 10 additions and 5 deletions.
  1. +10 −5 ZomBdll/NetAndDataProcessing/DashboardData/CsvDataMonitor.cs
@@ -161,25 +161,29 @@ private void WriteBuffer()
{
try
{
- foreach (var item in header)
+ outs = new StreamWriter(FilePath, true);
+ for (; qindx < header.Count; qindx++)
{
- outs.Write(item + ",");
+ outs.Write(header[qindx] + ",");
}
- outs.WriteLine();
+ System.Diagnostics.Debug.WriteLine(qindx);
for (int i = 0; i < dataq.Count - 1; i++)
{
+ outs.WriteLine();
foreach (var item in dataq[i])
{
outs.Write((item ?? "") + ",");
}
- outs.WriteLine();
}
//save last for next merge
var last = dataq[dataq.Count - 1];
dataq.Clear();
dataq.Add(last);
savetime = GetTime();
+ outs.Flush();
+ outs.Close();
+ outs = null;
}
catch { }
}
@@ -192,10 +196,10 @@ public void Start()
{
if (!Running)
{
- outs = new StreamWriter(FilePath, true);
saving = true;
starttime = DateTime.Now;
lasttime = savetime = 0;
+ qindx = 0;
}
}
@@ -209,6 +213,7 @@ public void Stop()
saving = false;
WriteBuffer();
WriteOff();
+ qindx = 0;
}
}

0 comments on commit 746413f

Please sign in to comment.