Ejemplo n.º 1
0
        private static int Main(string[] args)
        {
            // ReSharper disable AssignNullToNotNullAttribute
            string log4NetFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                              "loggingSettings.xml");

            // ReSharper restore AssignNullToNotNullAttribute
            XmlConfigurator.Configure(new FileInfo(log4NetFile));
            var programParams = new ProgramParams();
            var parser        = new CommandLineParser(programParams);

            parser.Parse();

            if (programParams.Help)
            {
                System.Console.WriteLine(parser.UsageInfo.ToString(78, false));
            }
            else if (parser.HasErrors)
            {
                System.Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return(-1);
            }

            try
            {
                new Program(programParams);
            }
            catch (Exception e)
            {
                Log.Error(e.Message, e);
                System.Console.Out.WriteLine("ERROR: " + e.Message);
                return(-1);
            }
            return(0);
        }
Ejemplo n.º 2
0
 private Program(ProgramParams appParams)
 {
     AppParam = appParams;
     RunCommands();
 }