// function to save both graphs' data public void SaveBothListsToFile(string FileLocation, PointPairList listA, PointPairList listB) { MetaData(1)[4] = this.filedescription.Text; string LHSfile = FileLocation + "Pane1.txt"; string RHSfile = FileLocation + "Pane2.txt"; File.AppendAllText(LHSfile, "Data from Pane1 Graph" + "\r\n"); File.AppendAllText(LHSfile, MetaData(1)[0] + "\r\n"); File.AppendAllText(LHSfile, MetaData(1)[1] + "\r\n"); File.AppendAllText(LHSfile, MetaData(1)[2] + "\r\n"); File.AppendAllText(LHSfile, MetaData(1)[3] + "\r\n"); File.AppendAllText(LHSfile, MetaData(1)[4] + "\r\n"); // Array of values to be saved (LHS Graph) double[][] SaveArray1 = new double[Convert.ToInt32(listA.LongCount())][]; SaveArray1[0] = listA.Select(P => P.X).ToArray(); SaveArray1[1] = listA.Select(P => P.Y).ToArray(); for (int j = 0; j < SaveArray1.Length; j++) { string Reading = SaveArray1[0][j].ToString() + "\t" + SaveArray1[1][j] + "\r\n"; File.AppendAllText(LHSfile, Reading); } File.AppendAllText(RHSfile, "Data from Pane2 Graph" + "\r\n"); File.AppendAllText(RHSfile, MetaData(2)[0] + "\r\n"); File.AppendAllText(RHSfile, MetaData(2)[1] + "\r\n"); File.AppendAllText(RHSfile, MetaData(2)[2] + "\r\n"); File.AppendAllText(RHSfile, MetaData(2)[3] + "Environment time = " + Convert.ToString(Environment.TickCount - tickStart) + "\r\n"); File.AppendAllText(RHSfile, MetaData(2)[4] + "\r\n"); double[][] SaveArray2 = new double[Convert.ToInt32(listB.LongCount())][]; SaveArray2[0] = listB.Select(P => P.X).ToArray(); SaveArray2[1] = listB.Select(P => P.Y).ToArray(); for (int j = 0; j < SaveArray2.Length; j++) { string Reading = SaveArray2[0][j].ToString() + "\t" + SaveArray2[1][j].ToString() + "\r\n"; File.AppendAllText(RHSfile, Reading); } Reset(zgc); Reset(Window2.zgc2); }
// function to save a given list's values to file public void SaveListToFile(string FileLocation, PointPairList list, int Pane) { MetaData(1)[4] = this.filedescription.Text; //Add some MetaData at beginning of file File.AppendAllText(FileLocation, MetaData(Pane)[0] + "\r\n"); File.AppendAllText(FileLocation, MetaData(Pane)[1] + "\r\n"); File.AppendAllText(FileLocation, MetaData(Pane)[2] + "\r\n"); File.AppendAllText(FileLocation, MetaData(Pane)[3] + "\r\n"); File.AppendAllText(FileLocation, MetaData(Pane)[4] + "\r\n"); //List converted to array for saving double[][] SaveArray = new double[Convert.ToInt32(list.LongCount())][]; SaveArray[0] = list.Select(P => P.X).ToArray(); SaveArray[1] = list.Select(P => P.Y).ToArray(); for (int j = 0; j < SaveArray.Length; j++) { string Reading = SaveArray[0][j].ToString() + "\t" + SaveArray[1][j] + "\r\n"; File.AppendAllText(FileLocation, Reading); } }
// function to save a given list's values to file public void SaveListToFile(string FileLocation, PointPairList list, int Pane) { File.AppendAllText(FileLocation, MetaData(Pane)[0] + "\r\n"); File.AppendAllText(FileLocation, MetaData(Pane)[1] + "\r\n"); File.AppendAllText(FileLocation, MetaData(Pane)[2] + "\r\n"); File.AppendAllText(FileLocation, MetaData(Pane)[3] + "\r\n"); File.AppendAllText(FileLocation, MetaData(Pane)[4] + "\r\n"); double[][] SaveArray = new double[Convert.ToInt32(list.LongCount())][]; SaveArray[0] = list.Select(P => P.X).ToArray(); SaveArray[1] = list.Select(P => P.Y).ToArray(); for (int j = 0; j < SaveArray.Length; j++) { string Reading = SaveArray[0][j].ToString() + "\t" + SaveArray[1][j] + "\r\n"; File.AppendAllText(FileLocation, Reading); } }