Example #1
0
 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");
 }
Example #2
0
 private static void ProcessSettings(ConvertProcessor processor)
 {
     processor.LoadSettings();
     processor.ProcessorSettings.Settings.ResourcesPath = ConvertProcessor.GetResourcesPath();
 }