private static InternalPointList GetInternalPoints() // Pętla do wczytywania punktów wewnętrznych { InternalPointList iPointList = new InternalPointList(); Console.WriteLine("Wyznaczyć temperatury w pkt. wew. ? (t / n):"); /*string tn = Console.ReadLine(); * if (tn == "t" || tn == "T") * { Console.WriteLine("Aby zakończyć, zamiast wsp. podaj \"n\":"); } * double x1 = 0.0, x2 = 0.0, temp = 0.0; * while (tn != "n" && tn != "N") * { * Console.WriteLine("x1:"); * tn = Console.ReadLine(); * if (tn != "n" && tn != "N") * { x1 = double.Parse(tn); } * else * { break; } * Console.WriteLine("x2:"); * tn = Console.ReadLine(); * if (tn != "n" && tn != "N") * { x2 = double.Parse(tn); } * else * { break; } * Console.WriteLine("T:"); * tn = Console.ReadLine(); * if (tn != "n" && tn != "N") * { temp = double.Parse(tn); } * iPointList.Add(new InternalPoint(x1, x2, temp)); * }*/ //iPointList.Add(new InternalPoint(1, 1, 150)); //iPointList.Add(new InternalPoint(2, 1, 100)); //iPointList.Add(new InternalPoint(3, 1, 50)); //iPointList.Add(new InternalPoint(1, 3, 150)); //iPointList.Add(new InternalPoint(2, 3, 100)); //iPointList.Add(new InternalPoint(3, 3, 50)); //iPointList.Add(new InternalPoint(1, 2, 150)); //iPointList.Add(new InternalPoint(3, 2, 50)); //iPointList.Add(new InternalPoint(2, 2, 100)); iPointList.Add(new InternalPoint(1, 1, 68.138944464657598)); iPointList.Add(new InternalPoint(1, 2, 62.636409610026632)); iPointList.Add(new InternalPoint(1, 3, 67.126922825109702)); return(iPointList); }
public static void GetInternalTemperaturesMME(string path, InternalPointList iPointList) // Wczytuje temperatury z sensorów { FileInfo thesourceFile = new FileInfo(@path); StreamReader reader = thesourceFile.OpenText(); string text = reader.ReadToEnd(); reader.Close(); string[] s = { "\r\n" }; string[] Lines = text.Split(s, StringSplitOptions.None); for (int i = 0; i < Lines.Length; i++) { if (Lines[i].IndexOf("# startInternalTemperatures") >= 0) { i++; while (Lines[i].IndexOf("# endInternalTemperatures") < 0) { if (Lines[i].IndexOf("//") == -1) { Regex theReg = new Regex(@"\S+"); MatchCollection theMatches = theReg.Matches(Lines[i]); if (theMatches.Count == 3) { double x1, x2, T; x1 = double.Parse(theMatches[0].ToString()); x2 = double.Parse(theMatches[1].ToString()); T = double.Parse(theMatches[2].ToString()); iPointList.Add(new InternalPoint(x1, x2, T)); } } if (++i >= Lines.Length) { break; } } } } }