コード例 #1
0
ファイル: Program.cs プロジェクト: evicertia/Katana
        private static int Main(string[] args)
        {
            if (args.Length != 3)
            {
                PrintUsage();
                return(1);
            }

            try
            {
                InstallerCommand command      = GetCommand(args[0]);
                string           certName     = args[1];
                string           certPassword = args[2];

                var installer = new CertificateInstaller(certName, certPassword);

                switch (command)
                {
                case InstallerCommand.Install:
                    installer.InstallCertificate();
                    break;

                case InstallerCommand.Uninstall:
                    installer.UninstallCertificate();
                    break;

                default:
                    Debug.Assert(false, String.Format("Unknown InstallerCommand value '{0}'", command));
                    break;
                }

                return(0);
            }
            catch (Exception e)
            {
                PrintUsage();

                Exception current = e;
                while (current != null)
                {
                    Console.WriteLine("{0}: {1}", current.GetType(), e.Message);
                    Console.WriteLine(e.StackTrace);
                    Console.WriteLine("------------------------------------------------------------------");
                    current = current.InnerException;
                }
                return(2);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Kstal/Microsoft.Owin
        private static int Main(string[] args)
        {
            if (args.Length != 3)
            {
                PrintUsage();
                return 1;
            }

            try
            {
                InstallerCommand command = GetCommand(args[0]);
                string certName = args[1];
                string certPassword = args[2];

                var installer = new CertificateInstaller(certName, certPassword);

                switch (command)
                {
                    case InstallerCommand.Install:
                        installer.InstallCertificate();
                        break;
                    case InstallerCommand.Uninstall:
                        installer.UninstallCertificate();
                        break;
                    default:
                        Debug.Assert(false, String.Format("Unknown InstallerCommand value '{0}'", command));
                        break;
                }

                return 0;
            }
            catch (Exception e)
            {
                PrintUsage();

                Exception current = e;
                while (current != null)
                {
                    Console.WriteLine("{0}: {1}", current.GetType(), e.Message);
                    Console.WriteLine(e.StackTrace);
                    Console.WriteLine("------------------------------------------------------------------");
                    current = current.InnerException;
                }
                return 2;
            }
        }