Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Path path = new Path();
            path.AddPoint(new Point3D(1, 1, 1));
            path.AddPoint(new Point3D(2, 3, 4));
            path.AddPoint(new Point3D(4, 6, 7));
            path.AddPoint(new Point3D(43 ,325, 23));
            path.AddPoint(new Point3D(4329, 0, 0));

            path.RemoveLastPoint();
            path.RemovePointAt(1);

            PathStorage.SavePath(path, "data.txt");

            Path newPath = PathStorage.LoadPath("data.txt");

            for (int i = 0; i < newPath.Count; ++i)
            {
                Console.WriteLine(newPath[i]);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Path path = new Path();

            path.AddPoint(new Point3D(1, 1, 1));
            path.AddPoint(new Point3D(2, 3, 4));
            path.AddPoint(new Point3D(4, 6, 7));
            path.AddPoint(new Point3D(43, 325, 23));
            path.AddPoint(new Point3D(4329, 0, 0));

            path.RemoveLastPoint();
            path.RemovePointAt(1);

            PathStorage.SavePath(path, "data.txt");

            Path newPath = PathStorage.LoadPath("data.txt");

            for (int i = 0; i < newPath.Count; ++i)
            {
                Console.WriteLine(newPath[i]);
            }
        }
Exemplo n.º 3
0
        public static Path LoadPath(string fileName)
        {
            Path path = new Path();
            try
            {
                using (StreamReader reader = new StreamReader(fileName))
                {
                    string line = "";
                    while ((line = reader.ReadLine()) != null)
                    {
                        string[] splitted = line.Split(' ');
                        path.AddPoint(new Point3D(Convert.ToDouble(splitted[0]), Convert.ToDouble(splitted[1]), Convert.ToDouble(splitted[2])));
                    }
                }
            }
            catch (IOException e)
            {
                Console.WriteLine(e.Message);
            }

            return path;
        }
Exemplo n.º 4
0
        public static Path LoadPath(string fileName)
        {
            Path path = new Path();

            try
            {
                using (StreamReader reader = new StreamReader(fileName))
                {
                    string line = "";
                    while ((line = reader.ReadLine()) != null)
                    {
                        string[] splitted = line.Split(' ');
                        path.AddPoint(new Point3D(Convert.ToDouble(splitted[0]), Convert.ToDouble(splitted[1]), Convert.ToDouble(splitted[2])));
                    }
                }
            }
            catch (IOException e)
            {
                Console.WriteLine(e.Message);
            }

            return(path);
        }