/// <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> /// 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++; }