Beispiel #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);
            }
        }
Beispiel #2
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);
            }
        }
        /// <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);
            }
        }