示例#1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static int Main(string[] args)
        {
            NetUtils.ApplyProxy();

            // Automatically show help for missing args
            if (args == null)
            {
                args = new string[0];
            }
            if (args.Length == 0)
            {
                args = new[] { "--help" }
            }
            ;

            try
            {
                using (var run = new PublishRun(args))
                    return((int)run.Execute());
            }
            #region Error hanlding
            catch (OperationCanceledException)
            {
                return((int)ExitCode.UserCanceled);
            }
            catch (ArgumentException ex)
            {
                Log.Error(ex);
                return((int)ExitCode.InvalidArguments);
            }
            catch (OptionException ex)
            {
                Log.Error(ex);
                return((int)ExitCode.InvalidArguments);
            }
            catch (WebException ex)
            {
                Log.Error(ex);
                return((int)ExitCode.WebError);
            }
            catch (InvalidDataException ex)
            {
                Log.Error(ex);
                return((int)ExitCode.InvalidData);
            }
            catch (IOException ex)
            {
                Log.Error(ex);
                return((int)ExitCode.IOError);
            }
            catch (UnauthorizedAccessException ex)
            {
                Log.Error(ex);
                return((int)ExitCode.AccessDenied);
            }
            catch (DigestMismatchException ex)
            {
                Log.Error(ex);
                return((int)ExitCode.DigestMismatch);
            }
            catch (KeyNotFoundException ex)
            {
                Log.Error(ex);
                return((int)ExitCode.InvalidArguments);
            }
            catch (WrongPassphraseException ex)
            {
                Log.Error(ex);
                return((int)ExitCode.InvalidArguments);
            }
            catch (NotSupportedException ex)
            {
                Log.Error(ex);
                return((int)ExitCode.NotSupported);
            }
            #endregion
        }
    }
示例#2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static int Main(string[] args)
        {
            NetUtils.ApplyProxy();

            // Automatically show help for missing args
            if (args == null) args = new string[0];
            if (args.Length == 0) args = new[] {"--help"};

            try
            {
                using (var run = new PublishRun(args))
                    return (int)run.Execute();
            }
                #region Error hanlding
            catch (OperationCanceledException)
            {
                return (int)ExitCode.UserCanceled;
            }
            catch (ArgumentException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.InvalidArguments;
            }
            catch (OptionException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.InvalidArguments;
            }
            catch (WebException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.WebError;
            }
            catch (InvalidDataException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.InvalidData;
            }
            catch (IOException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.IOError;
            }
            catch (UnauthorizedAccessException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.AccessDenied;
            }
            catch (DigestMismatchException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.DigestMismatch;
            }
            catch (KeyNotFoundException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.InvalidArguments;
            }
            catch (WrongPassphraseException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.InvalidArguments;
            }
            catch (NotSupportedException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.NotSupported;
            }
            #endregion
        }