public void AddFile(String filename) { if (CommandAccessors == null) { CommandAccessors = new CommandAccessorStack(); } CommandAccessors.Add(new CommandFileAccessor(filename)); }
public void AddCommandList(String CommandListName, String[] ListOfCommands) { CommandList CL = new CommandList(ListOfCommands); if (CommandAccessors == null) { CommandAccessors = new CommandAccessorStack(); } CommandAccessors.Add(new CommandBlockAccessor(CommandListName, CL)); }
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)); } }
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); }