Esempio n. 1
0
        private ConsoleConverter CreateConverter()
        {
            Debug.Assert(_commandLines != null);
            if (_commandLines == null)
            {
                return null;
            }

            string outputDir  = _commandLines.OutputDir;

            string sourceFile = _commandLines.SourceFile;
            if (!String.IsNullOrEmpty(sourceFile) && File.Exists(sourceFile))
            {
                ConsoleFileConverter fileConverter =
                    new ConsoleFileConverter(sourceFile);

                fileConverter.Options   = _options;
                fileConverter.OutputDir = outputDir;

                fileConverter.Subscribe(this);

                return fileConverter;
            }

            string sourceDir = _commandLines.SourceDir;
            if (!String.IsNullOrEmpty(sourceDir) && Directory.Exists(sourceDir))
            {
                ConsoleDirectoryConverter dirConverter =
                    new ConsoleDirectoryConverter(sourceDir);

                dirConverter.Options   = _options;
                dirConverter.OutputDir = outputDir;

                dirConverter.Recursive       = _commandLines.Recursive;
                dirConverter.ContinueOnError = _commandLines.ContinueOnError;

                dirConverter.Subscribe(this);

                return dirConverter;
            }

            IList<string> sourceFiles = _commandLines.SourceFiles;
            if (sourceFiles != null && sourceFiles.Count != 0)
            {
                ConsoleFilesConverter filesConverter =
                    new ConsoleFilesConverter(sourceFiles);

                filesConverter.Options = _options;
                filesConverter.OutputDir = outputDir;

                filesConverter.ContinueOnError = _commandLines.ContinueOnError;

                filesConverter.Subscribe(this);

                return filesConverter;
            }

            return null;
        }
        private ConsoleConverter CreateConverter()
        {
            Debug.Assert(_commandLines != null);
            if (_commandLines == null)
            {
                return(null);
            }

            string outputDir = _commandLines.OutputDir;

            string sourceFile = _commandLines.SourceFile;

            if (!String.IsNullOrEmpty(sourceFile) && File.Exists(sourceFile))
            {
                ConsoleFileConverter fileConverter =
                    new ConsoleFileConverter(sourceFile);

                fileConverter.Options   = _options;
                fileConverter.OutputDir = outputDir;

                fileConverter.Subscribe(this);

                return(fileConverter);
            }

            string sourceDir = _commandLines.SourceDir;

            if (!String.IsNullOrEmpty(sourceDir) && Directory.Exists(sourceDir))
            {
                ConsoleDirectoryConverter dirConverter =
                    new ConsoleDirectoryConverter(sourceDir);

                dirConverter.Options   = _options;
                dirConverter.OutputDir = outputDir;

                dirConverter.Recursive       = _commandLines.Recursive;
                dirConverter.ContinueOnError = _commandLines.ContinueOnError;

                dirConverter.Subscribe(this);

                return(dirConverter);
            }

            IList <string> sourceFiles = _commandLines.SourceFiles;

            if (sourceFiles != null && sourceFiles.Count != 0)
            {
                ConsoleFilesConverter filesConverter =
                    new ConsoleFilesConverter(sourceFiles);

                filesConverter.Options   = _options;
                filesConverter.OutputDir = outputDir;

                filesConverter.ContinueOnError = _commandLines.ContinueOnError;

                filesConverter.Subscribe(this);

                return(filesConverter);
            }

            return(null);
        }