Beispiel #1
0
        public static void StaticWrite(string deviceName, DataReading obj, string dir = "PhysData")
        {
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            string dat = "";

            bool isFirst = false;

            if (!writers.ContainsKey(deviceName))
            {
                dir    += @"\" + startTime.Value.ToString(dateFormat);
                isFirst = true;
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                string fileName = dir + @"\" + deviceName + ".dat";

                writers.Add(deviceName, new StreamWriter(fileName));

                dat += deviceName + "|" + startTime.Value.ToString(dateFormat) + "\n";
            }

            dat += obj.timestamp + "#" + obj.Serialize();
            writers[deviceName].Write(((isFirst) ? "" : "\n") + dat);
            writers[deviceName].Flush();
        }
Beispiel #2
0
 public override void Write()
 {
     DataReading.StaticWrite("HR", this);
 }