private void backgroundWorkerProcess_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { object[] parameters = (object[])e.Argument; ConvertProcessor processor = (ConvertProcessor)parameters[0]; processor.PerformConvertOperation((List <string>)parameters[1], null); }
static void Main(string[] args) { SetupLogAndData(); if (args.Length > 0) { List <string> options = new List <string>(); List <string> fileParams = new List <string>(); foreach (var param in args) { if (IsOptionParameter(param)) { options.Add(param); } else { fileParams.Add(param); } } if (fileParams.Count == 0) { if (options.Count == 1) { // Process single option command (registration etc.) , exit if it's a valid command if (ProcessSingleOptionCommand(options[0])) { return; } } Console.WriteLine(@"Input file name missing. Exiting."); _log.Error("Input file name missing."); if (_log.IsInfoEnabled) { _log.Info("Application [FB2EPUB] End"); } return; } var processor = new ConvertProcessor(); PreProcessParameters(options, processor.ProcessorSettings); ProcessSettings(processor); ProcessParameters(options, processor.ProcessorSettings); Console.WriteLine(@"Loading {0}...", fileParams[0]); var filesInMask = new List <string>(); processor.DetectFilesToProcess(fileParams, ref filesInMask); string outputFileName = (fileParams.Count > 1)?fileParams[1]:null; processor.PerformConvertOperation(filesInMask, outputFileName); Console.WriteLine(@"Done."); } else { ShowHelp(); } _log.Debug("Application [FB2EPUB] End"); }