private string GetStringFromPoint(SPointCI point) { return(point.Datetime.ToString() + "|" + point.Temperature.ToString(" +000.0; -000.0; 0.0") + " |" + point.I4.ToString(" +0000.0000; -0000.0000; 0.0") + " |" + point.I20.ToString(" +0000.0000; -0000.0000; 0.0") + " |"); }
public void AddPoint(int ch, double Temp, double I1, double I2) { SPointCI point = new SPointCI(); point.Datetime = DateTime.Now; point.Temperature = Temp; point.I4 = I1; point.I20 = I2; Channal[ch].Points.Add(point); FileStream[ch].WriteLine(GetStringFromPoint(point)); FileStream[ch].Flush(); WriteToArhiv(Channal[ch], point); }
//Добавление записи текущего измрения в архив для датчика в канале ch public void WriteToArhiv(SChanalCI ch, SPointCI point) { StreamWriter writer = null; if (!File.Exists(ch.FileNameArchiv)) { writer = CreateFileArhiv(ch); } else { writer = new StreamWriter(ch.FileNameArchiv, true);//открываем файл БД } if (writer != null) { writer.WriteLine(GetStringFromPoint(point)); writer.Close(); writer = null; } else { Program.txtlog.WriteLineLog("CH:Ошибка записи в архив ЦАП: " + ch.FileNameArchiv, 1); } }