public static void Main(string[] args) { StringDictionary context = CliParser.parse(args); FileSystemWrapper fsw = new FileSystemWrapper(); IRunnable command = getNewCommand(context, fsw); command.run(); Console.Write("Press any key to continue . . . "); Console.ReadKey(true); }
static IRunnable getNewCommand(StringDictionary context, FileSystemWrapper fsw) { switch (context["command"]) { case "open": return new OpenCommand(context, fsw); case "close": return new CloseCommand(context, fsw); case "help": return new HelpCommand(); default: throw new NotImplementedException(); } }
public CloseCommand(StringDictionary context, FileSystemWrapper fsw) { _context = context; _fsw = fsw; }