Exemplo n.º 1
0
 public override void Interpret(ShellControl !shellControl, Interpretation !interp)
 {
     if (condition.BoolValue(interp))
     {
         block.Interpret(shellControl, interp);
     }
 }
Exemplo n.º 2
0
        public static int Run(String script, ShellControl !shellControl,
                              CommandLineRunner runner, String[] arguments)
        {
            ScriptEngine engine = new ScriptEngine(script, runner);

            try {
                engine.Parse();
            }
            catch (Parser.ParseException e) {
                Console.WriteLine(e.Message);
                return(-1);
            }
            catch (Exception e) {
                Console.WriteLine(e.Message);
                return(-1);
            }

            try {
                return(engine.Run(shellControl, arguments));
            }
            catch (Interpretation.InterpretationException e) {
                Console.WriteLine(e.Message);
            }
            catch (ScriptException e) {
                Console.WriteLine(e.Message);
            }
            catch (Exception e) {
                Console.WriteLine(e.Message);
            }
            return(-1);
        }
Exemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();

            // Load everything
            LoadSerial();
            LoadSymbols();
            LoadVS();

            // Load virtual machine
            VirtualMachine          = new QemuVirtualMachine(Path.Combine(Bootstrap.Root, @"VMware\Disk.vmdk"));
            VirtualMachine.Started += VirtualMachine_Started;
            VirtualMachine.Stopped += VirtualMachine_Stopped;
            freshStart              = !VirtualMachine.Running;

            // Add debugger console
            DebuggerConsole console = new DebuggerConsole();

            ShellControl shellControl = new ShellControl(console);

            shellControl.Dock    = DockStyle.Fill;
            shellControl.Padding = new Padding(2);

            ConsolePanel.Controls.Add(shellControl);
        }
Exemplo n.º 4
0
            public override void Interpret(ShellControl !shellControl, Interpretation !interp)
            {
                String[] arguments = new String[commandLine.Count];
                int      i         = 0;

                //Console.WriteLine("Interpret Command");
                foreach (Expression !e in commandLine)
                {
                    string arg = e.StringValue(interp);
                    //Console.WriteLine("  CMD[{0}]: {1}", i, arg);
                    arguments[i++] = arg;
                }
                if (i != 0 && ((!)arguments[0]).Trim() == "exit")
                {
                    if (arguments.Length >= 2)
                    {
                        try {
                            int exitCode = Int32.Parse(arguments[1]);
                            interp.ExitCode = exitCode;
                        }
                        catch (FormatException) {
                            throw new Interpretation.TypeConversionException((String)arguments[1], "integer");
                        }
                    }
                    interp.Exit = true;
                }
Exemplo n.º 5
0
        private int Run(ShellControl !shellControl, String[] arguments)
        {
            Interpretation interp = new Interpretation(runner, arguments);

            parsedScript.Interpret(shellControl, interp);
            return(interp.ExitCode);
        }
Exemplo n.º 6
0
 public MainPage()
 {
     this.InitializeComponent();
     this.TopContentTemplate = this.Resources["WideTopTemplate"] as DataTemplate;
     this.DataContext        = this;
     SizeChanged            += OnSizeChanged;
     ShellControl.ClearCommandBar();
 }
Exemplo n.º 7
0
            public override void Interpret(ShellControl !shellControl, Interpretation !interp)
            {
                Object value = expression.GetValue(interp);

                if (interp != null)
                {
                    interp.SetSymbol(variable, value);
                }
            }
Exemplo n.º 8
0
 Shell(string shellId, MdiChild shellWindow)
 {
     IsClosing       = false;
     ShellId         = shellId;
     ShellWindow     = shellWindow;
     OpenWindowState = WindowState.Normal;
     MainControl     = null;
     Interrupter     = new InterruptSource();
 }
Exemplo n.º 9
0
        public ShellScene()
        {
            shell = new ShellControl();
            shell.Prompt = ">>>";
            shell.ShellTextBackColor = System.Drawing.Color.Black;
            shell.ShellTextFont = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            shell.ShellTextForeColor = System.Drawing.Color.LimeGreen;

            shell.CommandEntered += new EventCommandEntered(shellControl_CommandEntered);
        }
Exemplo n.º 10
0
 public override void Interpret(ShellControl !shellControl, Interpretation !interp)
 {
     while (condition.BoolValue(interp))
     {
         block.Interpret(shellControl, interp);
         if (interp.Exit)
         {
             break;
         }
     }
 }
Exemplo n.º 11
0
 public bool SetControl(ShellControl c)
 {
     if (c == null)
     {
         Close();
         return(false);
     }
     MainControl         = c;
     ShellWindow.Content = c;
     c.Init();
     return(true);
 }
Exemplo n.º 12
0
 public override void Interpret(ShellControl !shellControl, Interpretation !interp)
 {
     foreach (Statement statement in statements)
     {
         if (statement != null)
         {
             statement.Interpret(shellControl, interp);
         }
         if (interp.Exit)
         {
             break;
         }
     }
 }
Exemplo n.º 13
0
 public void Close()
 {
     if (IsClosing)
     {
         return;
     }
     IsClosing = true;
     Interrupter.GenerateInterrupt();
     Modules.CloseShell(ShellId);
     if (MainControl != null)
     {
         MainControl.Close();
         MainControl = null;
     }
     RemoveShell(this);
     MainWindow.CloseChild(ShellWindow);
     MainWindow.UpdateStatus("Shell#" + ShellId, null);
 }
Exemplo n.º 14
0
 private async void OnKeyUp(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key == Windows.System.VirtualKey.F11)
     {
         if (SupportFullScreen)
         {
             await ShellControl.TryEnterFullScreenAsync();
         }
     }
     else if (e.Key == Windows.System.VirtualKey.Escape)
     {
         if (SupportFullScreen && ShellControl.IsFullScreen)
         {
             ShellControl.ExitFullScreen();
         }
         else
         {
             NavigationService.GoBack();
         }
     }
 }
Exemplo n.º 15
0
        public ShellPage()
        {
            InitializeComponent();

            this.DataContext  = this;
            ShellPage.Current = this;

            this.SizeChanged += OnSizeChanged;
            if (SystemNavigationManager.GetForCurrentView() != null)
            {
                SystemNavigationManager.GetForCurrentView().BackRequested += ((sender, e) =>
                {
                    if (SupportFullScreen && ShellControl.IsFullScreen)
                    {
                        e.Handled = true;
                        ShellControl.ExitFullScreen();
                    }
                    else if (NavigationService.CanGoBack())
                    {
                        NavigationService.GoBack();
                        e.Handled = true;
                    }
                });

                NavigationService.Navigated += ((sender, e) =>
                {
                    if (NavigationService.CanGoBack())
                    {
                        SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                    }
                    else
                    {
                        SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
                    }
                });
            }
        }
Exemplo n.º 16
0
 public ControlWriter(ShellControl textbox)
 {
     this.textbox = textbox;
 }
Exemplo n.º 17
0
 public void HandleConsole(ShellControl shell, Command cmd)
 {
 }
Exemplo n.º 18
0
 public static void Init(ShellControl shell)
 {
     _shell = shell;
 }
Exemplo n.º 19
0
        public void HandleConsole(ShellControl shell, Command cmd)
        {
            switch (cmd.Name)
            {
            case "help":
                Shell.WriteLine("Here are some Commands");
                foreach (var c in ConsolePage.Tools)
                {
                    var spl = c.HelpText.Split('|');
                    foreach (var ht in spl)
                    {
                        Shell.WriteLine(ht);
                    }
                }

                break;

            case "save":
                var sg = ServiceLocator.Get <SavedGame>("SavedGame");
                sg.Save();

                Shell.WriteLine("Successfully saved");

                break;

            case "load":
                var sg2 = ServiceLocator.Add("SavedGame", SavedGame.Load());
                ServiceLocator.CallEvent("Loaded", sg2);

                Shell.WriteLine("Successfully loaded");

                break;

            case "echo":
                Shell.WriteLine(cmd.Args[0]);

                break;

            case "cls":
                Shell.Clear();

                break;

            case "shutdown":
                Application.Exit();

                break;

            case "info":
                Shell.WriteLine(ServiceLocator._("Name:") + " " + ServiceLocator.Get <SavedGame>("SavedGame").Computer.Name);
                Shell.WriteLine(ServiceLocator._("Language:") + " " + ServiceLocator.Get <SavedGame>("SavedGame").Locale);
                break;

            case "settings":
                switch (cmd.Args[0])
                {
                case "language":
                    var sg3 = ServiceLocator.Get <SavedGame>("SavedGame");

                    sg3.Locale = cmd.Args[1];
                    CultureInfo.CurrentUICulture = new CultureInfo(sg3.Locale);

                    ServiceLocator.LoadLocale();


                    break;

                default:
                    break;
                }

                break;
            }
        }
Exemplo n.º 20
0
 public static int Run(String script, ShellControl !shellControl, CommandLineRunner runner)
 {
     return(Run(script, shellControl, runner, null));
 }
Exemplo n.º 21
0
 public abstract void Interpret(ShellControl !shellControl, Interpretation !interp);