Exemple #1
0
        static void Main(string[] args)
        {
            Point3D myPoint = new Point3D(1, 2, 3);

            Path.AddPoint(myPoint);
            Path.AddPoint(new Point3D(2, 3, 7));
            Path.AddPoint(new Point3D(9, 2, 2));
            Path.AddPoint(new Point3D(2, 7, 1));

            PathStorage.SavePaths("../../text.txt");
            Console.WriteLine(PathStorage.LoadPaths("../../text.txt"));

            GenericList <int> array = new GenericList <int>(10);

            array.Add(4);
            array.Add(6);
            array.Add(8);
            array.Add(3);
            array.Add(7);
            array.Add(1);

            for (int i = 0; i < array.Length; i++)
            {
                Console.WriteLine(array[i]);
            }

            Console.WriteLine();
            array.Remove(2);

            for (int i = 0; i < array.Length; i++)
            {
                Console.WriteLine(array[i]);
            }

            Console.WriteLine(new string('-', 20));

            Console.WriteLine("Max element is: " + array.Max());
            Console.WriteLine(new string('-', 20));

            Type type = typeof(Program);

            object[] allAttibutes = type.GetCustomAttributes(false);
            foreach (VersionAttribute attribute in allAttibutes)
            {
                Console.WriteLine("Version is: " + attribute.Value);
            }
        }
Exemple #2
0
        public static void Main()
        {
            Point3D p1   = new Point3D(1.1, 2.2, 3.3);
            Point3D p2   = new Point3D(2, 3, 5.5);
            Point3D p3   = new Point3D(2, 6, 4.6);
            Path    path = new Path();

            path.addPoint(p1);
            path.addPoint(p2);
            path.addPoint(p3);
            Console.WriteLine(String.Join(Environment.NewLine, path.Points));
            PathStorage.save("..\\..\\test.txt", path);
            Console.WriteLine();
            Path path2 = PathStorage.load("..\\..\\test.txt");

            Console.WriteLine(path2.ToString());
        }
Exemple #3
0
        static void Main()
        {
            Path pointsPath = new Path();

            pointsPath.AddPoint(new Point3D(10, 10, 10));
            pointsPath.AddPoint(new Point3D(0.5, 0.3, 0.4));
            pointsPath.AddPoint(new Point3D(0.7, 0.24, 5.73));

            Console.WriteLine("Current points: ");
            Console.WriteLine(pointsPath.ToString());

            // Save the points to the file
            PathStorage.Save(pointsPath, "Test.txt");

            // Read the new points
            Path newPointsPath = PathStorage.Load("Test.txt");

            Console.WriteLine("Points read from the file: ");
            Console.WriteLine(newPointsPath.ToString());
        }
        public static void CreatePoint()
        {
            Console.WriteLine("Examplary points");
            Point3D pointInput1 = new Point3D(-7, -4, 3);
            Point3D pointInput2 = new Point3D(17, 6, 2.5);

            Console.WriteLine("Point A:");
            Console.WriteLine(pointInput1);
            Console.WriteLine("Point B:");
            Console.WriteLine(pointInput2);
            double distance = DistanceCalculation.Distance(pointInput1, pointInput2);

            Console.WriteLine("The distance between point A and point B is:");
            Console.WriteLine(distance);
            string filePath = "../../Paths.txt";

            List <Path> listOfPaths = new List <Path>();

            while (true)
            {
                Console.WriteLine("Do you want to create a new path:");
                string input = Console.ReadLine();
                if (input == "Yes")
                {
                    Path newPath = new Path();
                    newPath.PointsCollection = newPath.AddPath();
                    listOfPaths.Add(newPath);

                    PathStorage.SavePath(filePath, listOfPaths);
                }
                else
                {
                    break;
                }
            }

            Console.WriteLine("The text files paths.txt is in the folder called \"Structure\".");

            // The paths from the text file are here:
            List <Path> listOfRecordedPaths = PathStorage.LoadPath(filePath);
        }