Beispiel #1
0
        private static void LaunchCli()
        {
            var currentLine = string.Empty;
            var lines       = new List <string>();

            while (currentLine != _quit)
            {
                try
                {
                    Console.Write(": ");
                    currentLine = Console.ReadLine() ?? "";
                    if (currentLine == _quit)
                    {
                        break;
                    }
                    if ((multiLine && currentLine != _run) || !multiLine)
                    {
                        lines.Add(currentLine);
                    }

                    if ((!multiLine || currentLine != _run) && multiLine)
                    {
                        continue;
                    }
                    InterpreterBehaviour.ExecuteLines(lines);

                    lines.Clear();
                }
                catch (TargetInvocationException e)
                {
                    lines.Clear();
                    if (e.InnerException != null)
                    {
                        Console.WriteLine($"{e.InnerException.Message}");
                    }
                }
                catch (RuntimeException e)
                {
                    lines.Clear();
                    Console.WriteLine($"{e.Message}");
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// The main entry point of the application
 /// </summary>
 /// <param name="args">The parameters provided by the user</param>
 private static void Main(string[] args)
 {
     InterpreterBehaviour.Initialize();
     LaunchCli();
 }