示例#1
0
        public override bool ReadINIText( SplitCommaText SplitText )
        {
            if( !base.ReadINIText( SplitText ) )
            {
                return false;
            }

            if( SplitText.PartCount < 4 )
            {
                return false;
            }

            if( !IOUtil.InvariantParse( SplitText.Parts[3], ref Alpha ) )
            {
                Alpha = 1.0F;
            }

            return true;
        }
示例#2
0
        public bool Translate(string Text)
        {
            int A = 0;
            SplitCommaText Positions = new SplitCommaText(Text);

            if ( Positions.PartCount < 2 )
            {
                return false;
            }
            if ( IOUtil.InvariantParse(Positions.Parts[0], ref A) )
            {
                Pos.X = A;
            }
            else
            {
                return false;
            }
            if ( IOUtil.InvariantParse(Positions.Parts[1], ref A) )
            {
                Pos.Y = A;
            }
            else
            {
                return false;
            }
            return true;
        }
示例#3
0
        public static bool WZAngleFromINIText(string Text, ref App.sWZAngle Result)
        {
            SplitCommaText VectorText = new SplitCommaText(Text);
            App.sWZAngle WZAngle = new App.sWZAngle();

            if ( VectorText.PartCount != 3 )
            {
                return false;
            }

            if ( !InvariantParse(VectorText.Parts[0], WZAngle.Direction) )
            {
                int ErrorValue = 0;
                if ( !InvariantParse(VectorText.Parts[0], ref ErrorValue) )
                {
                    return false;
                }
                int Remainder = 0;
                int Multiplier = Math.DivRem(ErrorValue, App.INIRotationMax, out Remainder);
                try
                {
                    if ( Remainder < 0 )
                    {
                        WZAngle.Direction = (ushort)(Remainder + App.INIRotationMax);
                    }
                    else
                    {
                        WZAngle.Direction = (ushort)Remainder;
                    }
                }
                catch ( Exception )
                {
                    return false;
                }
                return true;
            }
            if ( !InvariantParse(VectorText.Parts[1], WZAngle.Pitch) )
            {
                return false;
            }
            if ( !InvariantParse(VectorText.Parts[2], WZAngle.Roll) )
            {
                return false;
            }
            Result = WZAngle;
            return true;
        }
示例#4
0
        public static bool WorldPosFromINIText(string Text, ref App.clsWorldPos Result)
        {
            SplitCommaText VectorText = new SplitCommaText(Text);
            int A = 0;
            int B = 0;

            if ( VectorText.PartCount != 3 )
            {
                return false;
            }
            int[] Positions = new int[3];
            for ( A = 0; A <= 2; A++ )
            {
                if ( InvariantParse(VectorText.Parts[A], ref B) )
                {
                    Positions[A] = B;
                }
                else
                {
                    return false;
                }
            }
            Result = new App.clsWorldPos(new App.sWorldPos(new sXY_int(Positions[0], Positions[1]), Positions[2]));
            return true;
        }
示例#5
0
        public virtual bool ReadINIText( SplitCommaText SplitText )
        {
            if( SplitText.PartCount < 3 )
            {
                return false;
            }

            sRGB_sng Colour = new sRGB_sng();

            if( !IOUtil.InvariantParse( SplitText.Parts[0], ref Colour.Red ) )
            {
                return false;
            }
            if( !IOUtil.InvariantParse( SplitText.Parts[1], ref Colour.Green ) )
            {
                return false;
            }
            if( !IOUtil.InvariantParse( SplitText.Parts[2], ref Colour.Blue ) )
            {
                return false;
            }

            Red = Colour.Red;
            Green = Colour.Green;
            Blue = Colour.Blue;

            return true;
        }