Esempio n. 1
0
 public void AddFile(String filename)
 {
     if (CommandAccessors == null)
     {
         CommandAccessors = new CommandAccessorStack();
     }
     CommandAccessors.Add(new CommandFileAccessor(filename));
 }
Esempio n. 2
0
        public void AddCommandList(String CommandListName, String[] ListOfCommands)
        {
            CommandList CL = new CommandList(ListOfCommands);

            if (CommandAccessors == null)
            {
                CommandAccessors = new CommandAccessorStack();
            }

            CommandAccessors.Add(new CommandBlockAccessor(CommandListName, CL));
        }
Esempio n. 3
0
        public void AddCommandBlock(String CommandBlockName, String CommandBlock)
        {
            if (!String.IsNullOrWhiteSpace(CommandBlock))
            {
                if (CommandAccessors == null)
                {
                    CommandAccessors = new CommandAccessorStack();
                }

                CommandList CL = new CommandList(CommandBlock);

                CommandAccessors.Add(new CommandBlockAccessor(CommandBlockName, CL));
            }
        }
Esempio n. 4
0
        public virtual String ReadCommand(ref String ResultLine)
        {
            String commandLine = null;

            if (CommandAccessors != null)
            {
                commandLine = CommandAccessors.GetCommandLine(ref ResultLine);
                if (CommandAccessors.Count <= 0)
                {
                    CommandAccessors = null;
                }

                if (WriteCommandToResultWriter && !String.IsNullOrWhiteSpace(commandLine))
                {   // Echo Command to output
                    if (!String.IsNullOrWhiteSpace(ResultLine))
                    {
                        WriteLine(ResultLine);
                        ResultLine = "";
                    }
                    Write("| ");
                    WriteLine(commandLine);
                }
            }
            else if (ReadFromConsoleWhenEmpty)
            {
                // Show that we are ready to next Command from user
                Write("|>");

                commandLine = Console.ReadLine();
                CommandHistory.Add(commandLine);
            }
            else
            {
                commandLine = null;
            }

            return(commandLine);
        }