Exemplo n.º 1
0
        public Vector3D ReadVector(String item, bool flagMessage)
        {
            double x = 0.0D;
            double y = 0.0D;
            double z = 0.0D;

            String temp = DispFormat.Replace(ReadToKugiri("="), 32, "");

            if (!temp.Equals(DispFormat.Replace(item, 32, "")))
            {
                System.Console.Out.WriteLine("*** Error in readVector() item=(" + item + "!=" + temp + ")");
                return(null);
            }
            if (!Pass("("))
            {
                System.Console.Out.WriteLine("*** Error in readVector() item=(" + item + ") no '('");
                return(null);
            }
            x = ReadDouble();
            if (!Pass(","))
            {
                System.Console.Out.WriteLine("*** Error in readVector() item=(" + item + ") no first','");
                return(null);
            }
            y = ReadDouble();
            if (!Pass(","))
            {
                System.Console.Out.WriteLine("*** Error in readVector() item=(" + item + ") no second','");
                return(null);
            }
            z = ReadDouble();
            if (!Pass(")"))
            {
                System.Console.Out.WriteLine("*** Error in readVector() item=(" + item + ") no ')'");
                return(null);
            }
            Vector3D ret = new Vector3D(x, y, z);

            if (flagMessage)
            {
                System.Console.Out.Write(item + "=");
                ret.PrintPos();
                System.Console.Out.WriteLine("");
            }
            ReadLine();
            return(ret);
        }
Exemplo n.º 2
0
        public String ReadString(String item, bool flagMessage)
        {
            String temp = DispFormat.Replace(ReadToKugiri("/"), 32, "");

            if (!temp.Equals(DispFormat.Replace(item, 32, "")))
            {
                System.Console.Out.WriteLine("*** Error in readString() item=(" + item + "!=" + temp + ")");
                return("");
            }
            temp = ReadToKugiri("/");
            ReadLine();
            if (flagMessage)
            {
                System.Console.Out.WriteLine(item + "=" + temp);
            }
            return(temp);
        }
Exemplo n.º 3
0
        public Color ReadColor(String item, bool flagMessage)
        {
            int r = 0;
            int g = 0;
            int b = 0;

            String temp = DispFormat.Replace(ReadToKugiri("="), 32, "");

            if (!temp.Equals(DispFormat.Replace(item, 32, "")))
            {
                System.Console.Out.WriteLine("*** Error in readColor() item=(" + item + "!=" + temp + ")");
                return(Color.White);
            }
            if (!Pass("["))
            {
                System.Console.Out.WriteLine("*** Error in readColor() item=(" + item + ") no '['");
                return(Color.White);
            }
            r = ReadInteger();
            if (!Pass(","))
            {
                System.Console.Out.WriteLine("*** Error in readColor() item=(" + item + ") no first','");
                return(Color.White);
            }
            g = ReadInteger();
            if (!Pass(","))
            {
                System.Console.Out.WriteLine("*** Error in readColor() item=(" + item + ") no second','");
                return(Color.White);
            }
            b = ReadInteger();
            if (!Pass("]"))
            {
                System.Console.Out.WriteLine("*** Error in readColor() item=(" + item + ") no ']'");
                return(Color.White);
            }
            Color ret = Color.FromArgb(r, g, b);

            if (flagMessage)
            {
                System.Console.Out.WriteLine(item + "=" + ret);
            }
            ReadLine();
            return(ret);
        }
Exemplo n.º 4
0
        public int ReadIntValue(String item, bool flagMessage)
        {
            String temp = DispFormat.Replace(ReadToKugiri("="), 32, "");

            if (!temp.Equals(DispFormat.Replace(item, 32, "")))
            {
                System.Console.Out.WriteLine("*** Error in readIntValue() item=(" + item + "!=" + temp + ")");
                return(0);
            }
            int ret = ReadInteger();

            ReadLine();
            if (flagMessage)
            {
                System.Console.Out.WriteLine(item + "=" + ret);
            }
            return(ret);
        }
Exemplo n.º 5
0
        public double ReadDblValue(String item, bool flagMessage)
        {
            String temp = DispFormat.Replace(ReadToKugiri("="), 32, "");

            if (!temp.Equals(DispFormat.Replace(item, 32, "")))
            {
                System.Console.Out.WriteLine("*** Error in readDblValue() item=(" + item + "!=" + temp + ")");
                return(0.0D);
            }
            double ret = ReadDouble();

            ReadLine();
            if (flagMessage)
            {
                System.Console.Out.WriteLine(item + "=" + DispFormat.DoubleFormat(ret, 3));
            }
            return(ret);
        }
Exemplo n.º 6
0
        public bool Pass(String str)
        {
            bool ret = true;

            int i = 0;

            String str2 = DispFormat.Replace(str, 32, "");

            for (i = 0; i < str2.Length;)
            {
                char c = (char)Peek();


                if (c == -1)
                {
                    ret = false;
                    break;
                }

                if ((char)c == ' ' || (char)c == '\t')
                {
                    Read();
                    continue;
                }

                if ((char)c != str2[i])
                {
                    ret = true;
                    break;
                }

                Read();
                i++;
            }

            return(ret);
        }