public const string SCENARIO_FILE = "~/App_Data/{0}.txt"; // The Path of the Secnario public void WriteData(PointEntry point, string file) { string path = HttpContext.Current.Server.MapPath(String.Format(SCENARIO_FILE, file)); if (!File.Exists(path)) { using (StreamWriter newFile = File.CreateText(path)) { newFile.WriteLine(point.lat); newFile.WriteLine(point.lon); newFile.WriteLine(point.rudder); newFile.WriteLine(point.throttle); } } else { using (StreamWriter oldFile = File.AppendText(path)) { oldFile.WriteLine(point.lat); oldFile.WriteLine(point.lon); oldFile.WriteLine(point.rudder); oldFile.WriteLine(point.throttle); } } }
public PointEntry ReadData() { PointEntry result = null; if (pointEntries.Any()) { result = pointEntries[0]; pointEntries.RemoveAt(0); } return(result); }