Esempio n. 1
0
        static int Main(string[] args)
        {
            _log = LogManager.GetLogger(typeof(Program));
            XmlConfigurator.Configure();

            try
            {
                #region Command line parsing
                Options           options = new Options();
                CommandLineParser parser  = new CommandLineParser(options);
                parser.Parse();

                Console.WriteLine(parser.UsageInfo.GetHeaderAsString(LINE_WIDTH));
                if (options.Help)
                {
                    _log.Info(parser.UsageInfo.GetOptionsAsString(LINE_WIDTH));
                    return(0);
                }
                else if (parser.HasErrors)
                {
                    _log.Error(parser.UsageInfo.GetErrorsAsString(LINE_WIDTH));
                    return(-1);
                }
                #endregion

                #region Running File processor
                XmlFileLoader fileLoader = new XmlFileLoader(options.i);
                fileLoader.Process();
                #endregion
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
                return(-1);
            }
            return(0);
        }
Esempio n. 2
0
        static int Main(string[] args)
        {
            _log = LogManager.GetLogger(typeof(Program));
            XmlConfigurator.Configure();

            try
            {
                #region Command line parsing
                Options options = new Options();
                CommandLineParser parser = new CommandLineParser(options);
                parser.Parse();

                Console.WriteLine(parser.UsageInfo.GetHeaderAsString(LINE_WIDTH));
                if (options.Help)
                {
                    _log.Info(parser.UsageInfo.GetOptionsAsString(LINE_WIDTH));
                    return 0;
                }
                else if (parser.HasErrors)
                {
                    _log.Error(parser.UsageInfo.GetErrorsAsString(LINE_WIDTH));
                    return -1;
                }
                #endregion

                #region Running File processor
                XmlFileLoader fileLoader = new XmlFileLoader(options.i);
                fileLoader.Process();
                #endregion
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
                return -1;
            }
            return 0;
        }