Example #1
0
        /// <summary>
        /// Uninstalls a SharpShell server located at 'path' vis RegAsm.
        /// </summary>
        /// <param name="path">The path to the SharpShell server.</param>
        /// <param name="registrationType">Type of the registration.</param>
        private void UninstallServerViaRegAsm(string path, RegistrationType registrationType)
        {
            //  Validate the path.
            if (string.IsNullOrWhiteSpace(path) || File.Exists(path) == false)
            {
                outputService.WriteError("File '" + path + "' does not exist.", true);
                return;
            }

            var regAsm = new RegAsm();

            var success =
                registrationType == RegistrationType.OS32Bit
                    ? regAsm.Unregister32(path)
                    : regAsm.Unregister64(path);

            if (success)
            {
                outputService.WriteSuccess($"    {path} uninstalled.", true);
                outputService.WriteMessage(regAsm.StandardOutput);
            }
            else
            {
                outputService.WriteError($"    {path} failed to uninstall.", true);
                outputService.WriteError(regAsm.StandardError);
            }
        }
Example #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (RegAsm.registerAssemblies())
            {
                Application.Run(new Inventory());
            }
            else
            {
                return;
            }
        }
Example #3
0
        /// <summary>
        /// Uninstalls a SharpShell server located at 'path'.
        /// </summary>
        /// <param name="path">The path to the SharpShell server.</param>
        /// <param name="registrationType">Type of the registration.</param>
        private void UninstallServer(string path, RegistrationType registrationType)
        {
            var regasm  = new RegAsm();
            var success = registrationType == RegistrationType.OS32Bit ? regasm.Unregister32(path) : regasm.Unregister64(path);

            if (success)
            {
                outputService.WriteSuccess($"    {path} uninstalled.", true);
                outputService.WriteMessage(regasm.StandardOutput);
            }
            else
            {
                outputService.WriteError($"    {path} failed to uninstall.", true);
                outputService.WriteError(regasm.StandardError);
            }
        }
Example #4
0
        /// <summary>
        /// Installs a SharpShell server at the specified path.
        /// </summary>
        /// <param name="path">The path to the SharpShell server.</param>
        /// <param name="registrationType">Type of the registration.</param>
        /// <param name="codeBase">if set to <c>true</c> install from codebase rather than GAC.</param>
        private void InstallServer(string path, RegistrationType registrationType, bool codeBase)
        {
            //  Validate the path.
            if (File.Exists(path) == false)
            {
                outputService.WriteError("File '" + path + "' does not exist.", true);
                return;
            }

            var regasm  = new RegAsm();
            var success = registrationType == RegistrationType.OS32Bit ? regasm.Register32(path, codeBase) : regasm.Register64(path, codeBase);

            if (success)
            {
                outputService.WriteSuccess($"    {path} installed and registered.", true);
                outputService.WriteMessage(regasm.StandardOutput);
            }
            else
            {
                outputService.WriteError($"    {path} failed to register.", true);
                outputService.WriteError(regasm.StandardError);
            }
        }
Example #5
0
        private void uninstallToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //  Bail if we have no server selected.
            if (SelectedServerEntry == null)
            {
                return;
            }

            //  Create a regasm instance and register the server.
            var regasm  = new RegAsm();
            var success = Environment.Is64BitOperatingSystem ? regasm.Unregister64(SelectedServerEntry.ServerPath) : regasm.Unregister32(SelectedServerEntry.ServerPath);

            //  Inform the user of the result.
            if (success)
            {
                MessageBox.Show(@"Uninstalled server successfully.", @"Uninstall Server", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(@"Failed to uninstall, check the SharpShell log for details.", @"Uninstall Server", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }