Ejemplo n.º 1
0
        public void debug(List <string> inp, Variables vars, SubClass main)
        {
            switch (inp[0].ToLower())
            {
            case "and":
                bool p3 = main.ANDcompare(main.GetBool(inp[1]), main.GetBool(inp[2]));
                if (p3)
                {
                    Console.WriteLine("true");
                }
                else
                {
                    Console.WriteLine("false");
                }
                break;

            case "b":
                vars.bools.Add(inp[1], inp[2]);
                break;

            case "i":
                try
                {
                    vars.ints.Add(inp[1], inp[2]);
                }
                catch (ArgumentOutOfRangeException e)
                {
                    Console.WriteLine("ArgumentOutOfRangeException: {0}", e);
                }
                break;

            case "s":
                vars.strings.Add(inp[1], inp[2]);
                break;

            case "pbools":
                main.PrintBools(vars);
                break;

            case "pints":
                main.PrintInts(vars);
                break;

            case "pstrings":
                main.PrintStrings(vars);
                break;

            case "get":
                Console.WriteLine(main.GetData(inp[1], vars));
                break;

            case "end":
                //comLoop = false;
                break;

            default:
                Console.WriteLine("Error: Unknown Command: Input String Index[0]");
                break;
            }
        }
Ejemplo n.º 2
0
        public void debug(List <string> inp, Variables vars, SubClass main, Command script, CommandCollection collect)
        {
            int indexer = 0;

            switch (inp[0].ToLower())
            {
            case "and":
                bool p3 = main.ANDcompare(main.GetBool(inp[1]), main.GetBool(inp[2]));
                if (p3)
                {
                    Console.WriteLine("true");
                }
                else
                {
                    Console.WriteLine("false");
                }
                break;

            case "b":
                vars.bools.Add(inp[1], inp[2]);
                break;

            case "i":
                if (inp[2].ToString() == "r")
                {
                    int rint = main.GenerateRandomInt(Convert.ToInt32(inp[3]), Convert.ToInt32(inp[4]));
                    try
                    {
                        vars.ints.Add(inp[1], rint.ToString());
                    }
                    catch (ArgumentException)
                    {
                        //Console.WriteLine("Whoops! {0} already exists!",inp[1]);
                        vars.ints.Remove(inp[1]);
                        vars.ints.Add(inp[1], rint.ToString());
                        indexSet.indexer++;
                    }
                }
                else
                {
                    try
                    {
                        vars.ints.Add(inp[2], inp[3]);
                    }
                    catch (ArgumentException)
                    {
                        Console.WriteLine("Whoops! {0} already exists!", inp[1]);
                    }
                }
                break;

            case "s":
                vars.strings.Add(inp[1], inp[2]);
                break;

            case "pbools":
                main.PrintBools(vars);
                break;

            case "pints":
                main.PrintInts(vars);
                break;

            case "pstrings":
                main.PrintStrings(vars);
                break;

            case "get":
                Console.WriteLine(main.GetData(inp[1], vars));
                break;

            case "end":
                //comLoop = false;
                break;

            case "if":

                break;

            case "create":
                script = main.CreateCommandScript();
                collect.CommandCollections.Add(inp[1].ToString(), script);
                //script = main.CreateCommandScript();
                Console.WriteLine("Created CommandScript instance");
                break;

            case "add":
                //List<string> NewSpliced = main.GetSplicedInput();
                inp.Remove("add");
                main.AddLineToCommandScript(indexer, inp, script);
                indexer++;
                break;

            case "ps":
                if (collect.CommandCollections.TryGetValue(inp[1], out Command value))
                {
                    main.PrintCommandScript(value);
                }
                break;

            case "runo":
                Command sc = EditTryGet(collect, inp[1]);
                main.RunOnce(script, vars, main, sc, collect);
                break;

            case "runr":
                int repeat = Convert.ToInt32(inp[1]);
                main.RunRepeat(script, vars, main, repeat, script, collect);
                break;

            case "edit":
                script = main.EditTryGet(collect, inp[1]);
                Console.WriteLine("Now editing: {0}", inp[1].ToString());
                break;

            case "ifi":
                bool ifCheck = main.CompareInts(inp[1], inp[2], inp[3], vars);
                if (ifCheck)
                {
                    Console.WriteLine("Output: True");
                }
                else
                {
                    Console.WriteLine("Output: False");
                }
                break;

            default:
                Console.WriteLine("Error: Unknown Command: Input String Index[0]");
                break;
            }
        }