Esempio n. 1
0
        /// <summary>
        /// Entrypoint method
        /// </summary>
        /// <param name="args">command line arguments</param>
        internal static void Main(string[] args)
        {
            Environment.ExitCode = ExitCode.NothingSucceeded.AsInt();

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler
                ((sender, o) =>
                    {
                        LogWriter.WriteError("Unhandled exception occured");
                        LogWriter.WriteError(o.ExceptionObject as Exception);
                    }
                );

            try
            {
                var parsedArgs = new AppArgs();
                if (Parser.ParseArguments(args, parsedArgs))
                {
                    if (parsedArgs.VersionInfo || parsedArgs.Help)
                    {
                        if (parsedArgs.VersionInfo)
                            Helpers.DisplayVersionInfo();

                        if (parsedArgs.Help)
                            Console.Write(Parser.ArgumentsUsage(typeof(AppArgs)));

                        return;
                    }

                    var app = new DacChkSum(parsedArgs);
                    app.Run();

                    Environment.ExitCode = ExitCode.Success.AsInt();
                }
                else
                {
                    Console.Write(Parser.ArgumentsUsage(typeof(AppArgs)));
                    Environment.ExitCode = ExitCode.UnrecognizedCommand.AsInt();
                }
            }
            catch (System.ArgumentException ex)
            {
                Console.WriteLine(DacChkSumResource.ErrorInvalidParameter, ex.Message);
                Environment.ExitCode = ExitCode.PartialSuccess.AsInt();
            }
            catch (System.IO.FileNotFoundException ex)
            {
                Console.WriteLine(DacChkSumResource.ErrorFileNotFound, ex.FileName);
                Environment.ExitCode = ExitCode.PartialSuccess.AsInt();
            }
            catch (System.Exception ex)
            {
                LogWriter.WriteError(ex);
                Environment.ExitCode = ExitCode.NothingSucceeded.AsInt();
            }

            return;
        }
Esempio n. 2
0
 public DacChkSum(AppArgs args)
 {
     this._args = args;
 }
Esempio n. 3
0
        /// <summary>
        /// Entrypoint method
        /// </summary>
        /// <param name="args">command line arguments</param>
        internal static void Main(string[] args)
        {
            Environment.ExitCode = ExitCode.NothingSucceeded.AsInt();

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler
                                                              ((sender, o) =>
            {
                LogWriter.WriteError("Unhandled exception occured");
                LogWriter.WriteError(o.ExceptionObject as Exception);
            }
                                                              );

            try
            {
                var parsedArgs = new AppArgs();
                if (Parser.ParseArguments(args, parsedArgs))
                {
                    if (parsedArgs.VersionInfo || parsedArgs.Help)
                    {
                        if (parsedArgs.VersionInfo)
                        {
                            Helpers.DisplayVersionInfo();
                        }

                        if (parsedArgs.Help)
                        {
                            Console.Write(Parser.ArgumentsUsage(typeof(AppArgs)));
                        }

                        return;
                    }

                    var app = new DacChkSum(parsedArgs);
                    app.Run();

                    Environment.ExitCode = ExitCode.Success.AsInt();
                }
                else
                {
                    Console.Write(Parser.ArgumentsUsage(typeof(AppArgs)));
                    Environment.ExitCode = ExitCode.UnrecognizedCommand.AsInt();
                }
            }
            catch (System.ArgumentException ex)
            {
                Console.WriteLine(DacChkSumResource.ErrorInvalidParameter, ex.Message);
                Environment.ExitCode = ExitCode.PartialSuccess.AsInt();
            }
            catch (System.IO.FileNotFoundException ex)
            {
                Console.WriteLine(DacChkSumResource.ErrorFileNotFound, ex.FileName);
                Environment.ExitCode = ExitCode.PartialSuccess.AsInt();
            }
            catch (System.Exception ex)
            {
                LogWriter.WriteError(ex);
                Environment.ExitCode = ExitCode.NothingSucceeded.AsInt();
            }

            return;
        }
Esempio n. 4
0
 public DacChkSum(AppArgs args)
 {
     this._args = args;
 }