Beispiel #1
0
        private void ExecuteBuiltinCommand(SimpleCommand command)
        {
            BuiltInCommand builtInCommand = this.builtInsMap[command.Command];

            string output = builtInCommand.Execute(command.Arguments);

            this.outWriter.Write(output);
        }
Beispiel #2
0
        private void makeBuiltInCommandEditable()
        {
            //TODO if command not in profile command file
            string biCommandName = lbBuiltInCommands.SelectedItem.ToString();

            //calling for normal edit command operation
            gbBIC.Enabled = true;
            btBuiltInCommandUpdate.Enabled = true;

            tbBICommand.Text = biCommandName;
            var biCommand = cmdMgr.GetBuiltInCommand(biCommandName);

            currentEditingBuiltInCommand     = biCommand;
            currentEditingBuiltInCommandName = biCommandName;
            tbBICParameter.Text = biCommand.Configuration;
        }
Beispiel #3
0
 public int Configure()
 {
     Console.Clear();
     try
     {
         Console.WriteLine("Shell Starting...");
         Env.path = Directory.GetCurrentDirectory();
         Console.WriteLine("Load external commands...");
         var jsonConfigFile = File.ReadAllText(Env.path + "/Configure/commandConfig.json");
         Commands       = JsonConvert.DeserializeObject <List <Command> >(jsonConfigFile);
         welcomeMessage = File.ReadAllLines(Env.path + "/Configure/WelcomeMessage.txt");
         Console.WriteLine("Load Built in commands...");
         basicComannd = new BuiltInCommand(Commands);
         Console.Clear();
         return(0);
     }
     catch (Exception x)
     {
         Console.WriteLine(x.Message);
         Console.WriteLine("Error occured during Configure! Shell Cannot be used!");
         return(1);
     }
 }
Beispiel #4
0
        private void LoadBuiltInCommandList()
        {
            lbBuiltInCommands.Items.Clear();

            foreach (string item in cmdMgr.GetAllBuiltInCommandNames())
            {
                lbBuiltInCommands.Items.Add(item);
            }

            if (lbBuiltInCommands.Items.Count > 0)
            {
                lbBuiltInCommands.SelectedItem = lbBuiltInCommands.Items[0];

                var biCommand = cmdMgr.GetBuiltInCommand(lbBuiltInCommands.SelectedItem.ToString());
                currentEditingBuiltInCommand = biCommand;
                tbBICommand.Text             = biCommand.Name;
                tbBICParameter.Text          = biCommand.Parameter;
                makeBuiltInCommandEditable();
            }
            else
            {
                btProfileDelete.Enabled = false;
            }
        }