/// <summary> /// Serialize dataLog to previously opened JSON file /// </summary> /// <param name="dataLog">Datalog to be serialized</param> public void SerializeData(DataLog dataLog) { using (FileStream fs = File.Open(fileName, FileMode.Append)) { using (StreamWriter sw = new StreamWriter(fs)) { // add comma if not first file in datalog if (serializedCount > 0) { sw.Write(","); } // // add data delimited with braces sw.Write("{\r\n"); sw.Write(dataLog.ToString()); sw.Write("\r\n}"); } } // increment counter serializedCount++; }
/// <summary> /// Added dataLog queue to be serialized /// </summary> /// <param name="dataLog">Datalog to be serialized</param> public void AddData(DataLog dataLog) { dataQueue.Add(dataLog); }
public DataLog(DataLog log) { TimeStamp = log.TimeStamp; }
/// <summary> /// Serialize dataLog to previously opened JSON file /// </summary> /// <param name="dataLog">Datalog to be serialized</param> public void SerializeData(DataLog dataLog) { using (FileStream fs = File.Open(fileName, FileMode.Append)) { using (StreamWriter sw = new StreamWriter(fs)) { // add comma if not first file in datalog if (serializedCount > 0) sw.Write(","); // // add data delimited with braces sw.Write("{\r\n"); sw.Write(dataLog.ToString()); sw.Write("\r\n}"); } } // increment counter serializedCount++; }