Ejemplo n.º 1
0
        public ConsoleApplication(IConsoleApplicationSettings consoleApplicationSettings, IFileSystemTextManipulator manipulator)
        {
            if (manipulator == null) throw new ArgumentNullException("manipulator");

            _fileSystemTextManipulator = manipulator;

            _textReader = consoleApplicationSettings.Reader;
            _textWriter = consoleApplicationSettings.Writer;

            _commands = new Dictionary<string, Action<string>>
                {
                    {"cd", Cd},
                    {"delete", Delete},
                    {"exists", Exists},
                    {"exit", Exit},
                    {"export", Export},
                    {"help", ShowHelp},
                    {"import", Import},
                    {"ls", List},
                    {"mkdir", Mkdir},
                };

            _shouldAbort = () => false;
            _operationCompleted = success => _textWriter.WriteLine("operation completed");
            _totalToProcessChanged = i => _textWriter.WriteLine("total to process: {0}", i);
            _currentlyProcessedChanged = i => _textWriter.WriteLine("total to process: {0}", i);
        }
Ejemplo n.º 2
0
 public ConsoleApplication(IConsoleApplicationSettings consoleApplicationSettings, FileSystemOptions options, IFileSystemTextManipulatorFactory factory)
     : this(consoleApplicationSettings, File.Exists(options.Location) ? factory.Open(options.Location, "console") : factory.Create(options, "console"))
 {
 }