static void Main(string[] args) { Console.WriteLine(Point3D.StartingPoint.ToString()); Point3D rectA = new Point3D("A", 1.2, 3, 5.6); Point3D rectB = new Point3D("B", -1.2, 3, 5.6); Point3D rectC = new Point3D("C", 1.2, -3, 5.6); Point3D rectD = new Point3D("D", 1.2, 3, -5.6); Path3D path = new Path3D(rectA, rectB, rectC, rectD); Console.WriteLine(path.ToString()); //for (int i = 0; i < path.Count; i++) //{ // Console.WriteLine(path[i]); //} Console.WriteLine(DistanceCalculator.CalculateDistance3D(rectA, rectD)); //Storage tests Storage.SavePath(@"../../user_files/SavedPaths.txt",false, path); Storage.SavePath(@"../../user_files/SavedPaths.txt", true, path); var loadedList= Storage.LoadPaths(@"../../user_files/SavedPaths.txt"); loadedList.ForEach(p=>Console.WriteLine(p.ToString())); }
static void Main(string[] args) { Console.WriteLine(Point3D.StartingPoint.ToString()); Point3D rectA = new Point3D("A", 1.2, 3, 5.6); Point3D rectB = new Point3D("B", -1.2, 3, 5.6); Point3D rectC = new Point3D("C", 1.2, -3, 5.6); Point3D rectD = new Point3D("D", 1.2, 3, -5.6); Path3D path = new Path3D(rectA, rectB, rectC, rectD); Console.WriteLine(path.ToString()); //for (int i = 0; i < path.Count; i++) //{ // Console.WriteLine(path[i]); //} Console.WriteLine(DistanceCalculator.CalculateDistance3D(rectA, rectD)); //Storage tests Storage.SavePath(@"../../user_files/SavedPaths.txt", false, path); Storage.SavePath(@"../../user_files/SavedPaths.txt", true, path); var loadedList = Storage.LoadPaths(@"../../user_files/SavedPaths.txt"); loadedList.ForEach(p => Console.WriteLine(p.ToString())); }
public static void SavePath(string fullFilename, bool append, Path3D path) { try { using (StreamWriter sw = new StreamWriter(fullFilename, append, Encoding.GetEncoding("UTF-8"))) { sw.WriteLine(path.ToString()); } } catch (Exception ex) { Console.WriteLine(ex.Message); throw ex.InnerException; } }