Beispiel #1
0
        public override void Read(MTextIO io)
        {
            var x = io.GetNumberToken();

            if (float.TryParse(x, out float xVal))
            {
                X = xVal;
            }
            else
            {
                throw new UISyntaxError($"Unexpected token for mVector X. Got {x}.");
            }

            var y = io.GetNumberToken();

            if (float.TryParse(y, out float yVal))
            {
                Y = yVal;
            }
            else
            {
                throw new UISyntaxError($"Unexpected token for mVector Y. Got {x}.");
            }


            string end = io.GetToken();

            if (end != MTextIO.SCOPE_END.ToString())
            {
                throw new UISyntaxError($"Expected mVector scope end ({MTextIO.SCOPE_END}), got {end}");
            }
        }
Beispiel #2
0
        public override void Read(MTextIO io)
        {
            var r = io.GetNumberToken();

            if (byte.TryParse(r, out byte rVal))
            {
                R = rVal;
            }
            else
            {
                throw new UISyntaxError($"Unexpected token for mColor R. Got {r}.");
            }

            var g = io.GetNumberToken();

            if (byte.TryParse(g, out byte gVal))
            {
                G = gVal;
            }
            else
            {
                throw new UISyntaxError($"Unexpected token for mColor G. Got {g}.");
            }

            var b = io.GetNumberToken();

            if (byte.TryParse(b, out byte bVal))
            {
                B = bVal;
            }
            else
            {
                throw new UISyntaxError($"Unexpected token for mColor B. Got {b}.");
            }

            var a = io.GetNumberToken();

            if (byte.TryParse(a, out byte aVal))
            {
                A = aVal;
            }
            else
            {
                throw new UISyntaxError($"Unexpected token for mColor A. Got {a}.");
            }

            string end = io.GetToken();

            if (end != MTextIO.SCOPE_END.ToString())
            {
                throw new UISyntaxError($"Expected mColor scope end ({MTextIO.SCOPE_END}), got {end}");
            }
        }
Beispiel #3
0
        public override void Read(MTextIO io)
        {
            var x1 = io.GetNumberToken();

            if (float.TryParse(x1, out float x1Val))
            {
                X1 = x1Val;
            }
            else
            {
                throw new UISyntaxError($"Unexpected token for mRegion X1. Got {x1}.");
            }

            var y1 = io.GetNumberToken();

            if (float.TryParse(y1, out float y1Val))
            {
                Y1 = y1Val;
            }
            else
            {
                throw new UISyntaxError($"Unexpected token for mRegion Y1. Got {y1}.");
            }

            var x2 = io.GetNumberToken();

            if (float.TryParse(x2, out float x2Val))
            {
                X2 = x2Val;
            }
            else
            {
                throw new UISyntaxError($"Unexpected token for mRegion X2. Got {x2}.");
            }

            var y2 = io.GetNumberToken();

            if (float.TryParse(y2, out float y2Val))
            {
                Y2 = y2Val;
            }
            else
            {
                throw new UISyntaxError($"Unexpected token for mRegion Y2. Got {y2}.");
            }

            string end = io.GetToken();

            if (end != MTextIO.SCOPE_END.ToString())
            {
                throw new UISyntaxError($"Expected mRectangle scope end ({MTextIO.SCOPE_END}), got {end}");
            }
        }
Beispiel #4
0
        public override void Read(MTextIO io)
        {
            var x = io.GetNumberToken();

            if (float.TryParse(x, out float xVal))
            {
                X = xVal;
            }
            else
            {
                throw new UISyntaxError($"Unexpected token for mRectangle X. Got {x}.");
            }

            var y = io.GetNumberToken();

            if (float.TryParse(y, out float yVal))
            {
                Y = yVal;
            }
            else
            {
                throw new UISyntaxError($"Unexpected token for mRectangle Y. Got {x}.");
            }

            var w = io.GetNumberToken();

            if (float.TryParse(w, out float wVal))
            {
                Width = wVal;
            }
            else
            {
                throw new UISyntaxError($"Unexpected token for mRectangle Width. Got {w}.");
            }

            var h = io.GetNumberToken();

            if (float.TryParse(h, out float hVal))
            {
                Height = hVal;
            }
            else
            {
                throw new UISyntaxError($"Unexpected token for mRectangle Height. Got {h}.");
            }

            string end = io.GetToken();

            if (end != MTextIO.SCOPE_END.ToString())
            {
                throw new UISyntaxError($"Expected mRectangle scope end ({MTextIO.SCOPE_END}), got {end}");
            }
        }
Beispiel #5
0
        public override void Read(MTextIO io)
        {
            var numbToken = io.GetNumberToken();

            if (short.TryParse(numbToken, out short val))
            {
                Value = val;
            }
            else
            {
                throw new UISyntaxError($"Unexpected short token for mShort. Got {numbToken}.");
            }

            string end = io.GetToken();

            if (end != MTextIO.SCOPE_END.ToString())
            {
                throw new UISyntaxError($"Expected mShort scope end ({MTextIO.SCOPE_END}), got {end}");
            }
        }
Beispiel #6
0
        public override void Read(MTextIO io)
        {
            var numbToken = io.GetNumberToken();

            if (numbToken == "1")
            {
                Value = true;
            }
            else if (numbToken == "0")
            {
                Value = false;
            }
            else
            {
                throw new UISyntaxError($"Expected bool token (1/0) for mBool. Got {numbToken}.");
            }

            string end = io.GetToken();

            if (end != MTextIO.SCOPE_END.ToString())
            {
                throw new UISyntaxError($"Expected mBool scope end ({MTextIO.SCOPE_END}), got {end}");
            }
        }