Exemplo n.º 1
0
    public static ScreenThing Parse(IMyGridTerminalSystem gts, String input)
    {
        ScreenThing res = new ScreenThing(gts);

        try {
            int  last = 0;
            bool b    = false;
            int  i    = 0;
            while (i < input.Length)
            {
                char ch = input[i];
                if (!b)
                {
                    if (ch == '<')
                    {
                        b = true;
                        if (i > 0)
                        {
                            res.Add(input.Substring(last, i - last), true);
                        }
                        last = i + 1;
                    }
                }
                else
                {
                    if (ch == '>')
                    {
                        res.Add(input.Substring(last, i - last), false);
                        last = i + 1;
                        b    = false;
                    }
                }
                ++i;
            }
            if (b)
            {
                throw new InvalidOperationException("Unterminated instruction");
            }
            if (last != input.Length)
            {
                res.Add(input.Substring(last), true);
            }
        } catch (Exception ex) {
            res.error = ex.ToString();
        }
        return(res);
    }
Exemplo n.º 2
0
 public ScreenElementGas(ScreenThing owner) : base(owner)
 {
 }
Exemplo n.º 3
0
 public ScreenElementItemCount(ScreenThing owner) : base(owner)
 {
 }
Exemplo n.º 4
0
 public ScreenElementLiteral(ScreenThing owner, string val) : base(owner)
 {
     this.val = val;
 }
Exemplo n.º 5
0
 public ScreenElement(ScreenThing owner)
 {
     this.owner = owner;
 }