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); } }
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; } }