Exemple #1
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);
        }