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

            try
            {
                var command = new CaptureCommand(args, new CliTaskHandler());
                return (int)command.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 (InvalidOperationException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.InvalidArguments;
            }
            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 (NotSupportedException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.NotSupported;
            }
            #endregion
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static int Main(string[] args)
        {
            NetUtils.ApplyProxy();

            try
            {
                var command = new CaptureCommand(args, new CliTaskHandler());
                return((int)command.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 (InvalidOperationException ex)
            {
                Log.Error(ex);
                return((int)ExitCode.InvalidArguments);
            }
            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 (NotSupportedException ex)
            {
                Log.Error(ex);
                return((int)ExitCode.NotSupported);
            }
            #endregion
        }