Exemple #1
0
        static Constants()
        {
            int          A, R, G, B;
            double       X, Y, Z;
            StreamReader sr = new StreamReader("../../params.txt");

            A = Int32.Parse(sr.ReadLine());
            R = Int32.Parse(sr.ReadLine());
            G = Int32.Parse(sr.ReadLine());
            B = Int32.Parse(sr.ReadLine());
            BackGroundColor = Color.FromArgb(A, R, G, B);

            A           = Int32.Parse(sr.ReadLine());
            R           = Int32.Parse(sr.ReadLine());
            G           = Int32.Parse(sr.ReadLine());
            B           = Int32.Parse(sr.ReadLine());
            SphereColor = Color.FromArgb(A, R, G, B);

            A             = Int32.Parse(sr.ReadLine());
            R             = Int32.Parse(sr.ReadLine());
            G             = Int32.Parse(sr.ReadLine());
            B             = Int32.Parse(sr.ReadLine());
            CylinderColor = Color.FromArgb(A, R, G, B);

            SphereRadius   = float.Parse(sr.ReadLine());
            CylinderRadius = float.Parse(sr.ReadLine());

            A = Int32.Parse(sr.ReadLine());
            R = Int32.Parse(sr.ReadLine());
            G = Int32.Parse(sr.ReadLine());
            B = Int32.Parse(sr.ReadLine());
            CubantSphereColor = Color.FromArgb(A, R, G, B);

            A = Int32.Parse(sr.ReadLine());
            R = Int32.Parse(sr.ReadLine());
            G = Int32.Parse(sr.ReadLine());
            B = Int32.Parse(sr.ReadLine());
            CubantCylinderColor = Color.FromArgb(A, R, G, B);

            A            = Int32.Parse(sr.ReadLine());
            R            = Int32.Parse(sr.ReadLine());
            G            = Int32.Parse(sr.ReadLine());
            B            = Int32.Parse(sr.ReadLine());
            BordersColor = Color.FromArgb(A, R, G, B);

            SphereSlices   = Int32.Parse(sr.ReadLine());
            SphereStacks   = Int32.Parse(sr.ReadLine());
            CylinderSlices = Int32.Parse(sr.ReadLine());
            CylinderStacks = Int32.Parse(sr.ReadLine());

            CameraTranslateSpeed = float.Parse(sr.ReadLine());
            CameraRotateSpeed    = float.Parse(sr.ReadLine());

            A         = Int32.Parse(sr.ReadLine());
            R         = Int32.Parse(sr.ReadLine());
            G         = Int32.Parse(sr.ReadLine());
            B         = Int32.Parse(sr.ReadLine());
            AxisColor = Color.FromArgb(A, R, G, B);

            DrawAxis   = bool.Parse(sr.ReadLine());
            AxisLength = float.Parse(sr.ReadLine());
            AxisRadius = float.Parse(sr.ReadLine());

            UseSameColorForSphereAndCylinderCubant = bool.Parse(sr.ReadLine());

            int bo = Int32.Parse(sr.ReadLine());

            if (bo == 1)
            {
                UseBordersOption = BordersOption.NoBorders;
            }
            else
            if (bo == 2)
            {
                UseBordersOption = BordersOption.OnlyDoors;
            }
            else
            if (bo == 3)
            {
                UseBordersOption = BordersOption.All;
            }
            else
            {
                throw new Exception("Не заданы опции отображения границы");
            }
            try
            {
                X            = double.Parse(sr.ReadLine());
                Y            = double.Parse(sr.ReadLine());
                Z            = double.Parse(sr.ReadLine());
                axisPosition = new Vector3((float)X, (float)Y, (float)Z);
            }
            catch (Exception exc)
            {
                System.Windows.Forms.MessageBox.Show(exc.Message);
            }

            sr.Close();
        }
        static Constants()
        {
            int A, R, G, B;
            double X, Y, Z;
            StreamReader sr = new StreamReader("../../params.txt");

            A = Int32.Parse(sr.ReadLine());
            R = Int32.Parse(sr.ReadLine());
            G = Int32.Parse(sr.ReadLine());
            B = Int32.Parse(sr.ReadLine());
            BackGroundColor = Color.FromArgb(A, R, G, B);

            A = Int32.Parse(sr.ReadLine());
            R = Int32.Parse(sr.ReadLine());
            G = Int32.Parse(sr.ReadLine());
            B = Int32.Parse(sr.ReadLine());
            SphereColor = Color.FromArgb(A, R, G, B);

            A = Int32.Parse(sr.ReadLine());
            R = Int32.Parse(sr.ReadLine());
            G = Int32.Parse(sr.ReadLine());
            B = Int32.Parse(sr.ReadLine());
            CylinderColor = Color.FromArgb(A, R, G, B);

            SphereRadius = float.Parse(sr.ReadLine());
            CylinderRadius = float.Parse(sr.ReadLine());

            A = Int32.Parse(sr.ReadLine());
            R = Int32.Parse(sr.ReadLine());
            G = Int32.Parse(sr.ReadLine());
            B = Int32.Parse(sr.ReadLine());
            CubantSphereColor = Color.FromArgb(A, R, G, B);

            A = Int32.Parse(sr.ReadLine());
            R = Int32.Parse(sr.ReadLine());
            G = Int32.Parse(sr.ReadLine());
            B = Int32.Parse(sr.ReadLine());
            CubantCylinderColor = Color.FromArgb(A, R, G, B);

            A = Int32.Parse(sr.ReadLine());
            R = Int32.Parse(sr.ReadLine());
            G = Int32.Parse(sr.ReadLine());
            B = Int32.Parse(sr.ReadLine());
            BordersColor = Color.FromArgb(A, R, G, B);

            SphereSlices = Int32.Parse(sr.ReadLine());
            SphereStacks = Int32.Parse(sr.ReadLine());
            CylinderSlices = Int32.Parse(sr.ReadLine());
            CylinderStacks = Int32.Parse(sr.ReadLine());

            CameraTranslateSpeed = float.Parse(sr.ReadLine());
            CameraRotateSpeed = float.Parse(sr.ReadLine());

            A = Int32.Parse(sr.ReadLine());
            R = Int32.Parse(sr.ReadLine());
            G = Int32.Parse(sr.ReadLine());
            B = Int32.Parse(sr.ReadLine());
            AxisColor = Color.FromArgb(A, R, G, B);

            DrawAxis = bool.Parse(sr.ReadLine());
            AxisLength = float.Parse(sr.ReadLine());
            AxisRadius = float.Parse(sr.ReadLine());

            UseSameColorForSphereAndCylinderCubant = bool.Parse(sr.ReadLine());

            int bo = Int32.Parse(sr.ReadLine());
            if (bo == 1)
                UseBordersOption = BordersOption.NoBorders;
            else
                if (bo == 2)
                    UseBordersOption = BordersOption.OnlyDoors;
                else
                    if (bo == 3)
                        UseBordersOption = BordersOption.All;
                    else
                        throw new Exception("Не заданы опции отображения границы");
            try
            {
                X = double.Parse(sr.ReadLine());
                Y = double.Parse(sr.ReadLine());
                Z = double.Parse(sr.ReadLine());
                axisPosition = new Vector3((float)X, (float)Y, (float)Z);
            }
            catch (Exception exc)
            {
                System.Windows.Forms.MessageBox.Show(exc.Message);
            }

            sr.Close();
        }