Exemplo n.º 1
0
 private static void DisplayExecutionOptions(Options options)
 {
     _logger.Debug(options.ToString);
     Console.WriteLine("Execution Options:");
     Console.WriteLine(String.Format("Configuration File = {0}", options.ConfigFile));
     // consume Options type properties
     Console.WriteLine(String.Format("Show ShowProgress = {0}", options.ShowProgress));
     Console.WriteLine(String.Format("Show Matches = {0}", options.ShowMatches));
     if (!String.IsNullOrEmpty(options.LinkFile))
     {
         string linkFile = options.LinkFile;
         Console.WriteLine(String.Format("Link File = {0}", linkFile));
     }
     Console.WriteLine(String.Format("IsInteractive = {0}", options.IsInteractive));
     if (!String.IsNullOrEmpty(options.TestFile))
     {
         string statsFile = options.TestFile;
         Console.WriteLine(String.Format("Test File = {0}", statsFile));
     }
     Console.WriteLine(String.Format("Verbose = {0}", options.ShowVerbose));
     Console.WriteLine(String.Format("No Reindex = {0}", options.IsNoReindex));
     Console.WriteLine(String.Format("Batch Size = {0}", options.BatchSize));
 }
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            _logger.Info("* Application Start *");
            var options = new Options();
            var parser = new CommandLineParser();
            if (parser.ParseArguments(args, options))
            {
                // write the application header
                Console.WriteLine(GetApplicationHeader());

                // display all of the options gathered from the commandline args...
                DisplayExecutionOptions(options);

                if (!HasValidConfigFile(options.ConfigFile))
                {
                    string errMessage =
                        String.Format(
                            "The configuration file '{0}' is NOT valid.\r\n Please check the file path.",
                            options.ConfigFile);
                    DisplayErrorMessageAndExit(errMessage, ExitCode.InvalidConfigFile);
                }

                if (!HasValidXml(options.ConfigFile))
                {
                    string errMessage =
                        String.Format(
                            "The XML in the configuration file '{0}' is NOT valid.\r\n Please check the file contents.",
                            options.ConfigFile);
                    DisplayErrorMessageAndExit(errMessage, ExitCode.InvalidConfigFileXml);
                }

                // get the intial options
                int count = 0;

                // load the configuration
                var config = ConfigLoader.Load(options.ConfigFile);
                // spin up the Processor
                var proc = new Processor(config);
                proc.AddMatchListener(new PrintMatchListener(true, true, true, false));

                // deduplicate the items
                proc.Deduplicate();

                // close out the processor
                proc.Close();

            }
            else
            {
                _logger.Debug("Application called without proper arguments.");
                Console.WriteLine(options.GetUsage());
                //Console.WriteLine("Error reading commandline arguments!");
            }

            _logger.Info("Application successfully exited");
            Environment.Exit((int) ExitCode.Success);
        }