Exemple #1
0
        /// <summary>
        /// This routine should be called automatically by the MSI during Remove Programs, but it can also be called using:
        ///     "installutil.exe /u Archiver.dll"
        /// </summary>
        /// <param name="savedState">State dictionary passed in by the installer code</param>
        public override void Uninstall(IDictionary savedState)
        {
            #region Check to make sure we're in an Administrator role
            WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());
            if (wp.IsInRole(WindowsBuiltInRole.Administrator) == false)
            {
                MessageBox.Show("You must be an Administrator to install Rtp or run it for the first time.", "Administrator Privileges Required", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Application.Exit();
            }
            #endregion

            #region Whack the Event Logs
            ArchiveServiceEventLog.Uninstall();
            #endregion

            #region Whack PerfCounters
            PCInstaller.Uninstall();
            #endregion

            #region Whack registry entry saying we're installed
            Installed = false;
            #endregion

            #region Call base.Uninstall
            if (savedState.Count != 0)
            {
                base.Uninstall(savedState);
            }
            #endregion
        }
        /// <summary>
        /// This routine should be called automatically by the MSI during Remove Programs, but it can also be called using:
        ///     "installutil.exe /u Archiver.dll"
        /// </summary>
        /// <param name="savedState">State dictionary passed in by the installer code</param>
        public override void Uninstall(IDictionary savedState)
        {
            #region Check to make sure we're in an Administrator role
            WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());
            if (wp.IsInRole(WindowsBuiltInRole.Administrator) == false)
            {
                RtlAwareMessageBox.Show(null, Strings.AdministratorPrivilegesText, Strings.AdministratorPrivilegesTitle,
                                        MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
                Application.Exit();
            }
            #endregion

            #region Whack the Event Logs
            ArchiveServiceEventLog.Uninstall();
            #endregion

            #region Whack PerfCounters
            PCInstaller.Uninstall();
            #endregion

            #region Whack registry entry saying we're installed
            Installed = false;
            #endregion

            #region Call base.Uninstall
            if (savedState.Count != 0)
            {
                base.Uninstall(savedState);
            }
            #endregion
        }
        /// <summary>
        /// This routine should be called automatically by the MSI during setup, but it can also be called using:
        ///     "installutil.exe Archiver.dll"
        /// </summary>
        /// <param name="savedState">State dictionary passed in by the installer code</param>
        public override void Install(IDictionary savedState)
        {
            #region Check to make sure we're in an Administrator role
            WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());
            if (wp.IsInRole(WindowsBuiltInRole.Administrator) == false)
            {
                RtlAwareMessageBox.Show(null, Strings.AdministratorPrivilegesText, Strings.AdministratorPrivilegesTitle,
                                        MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
                Application.Exit();
            }
            #endregion

            #region Uninstall in case we weren't uninstalled cleanly before
            IDictionary state = new Hashtable();
            Uninstall(state);
            if (state.Count != 0)
            {
                Commit(state);
            }
            state = null;
            #endregion

            #region Call base.Install
            base.Install(savedState);
            #endregion

            #region Install the Event Logs
            ArchiveServiceEventLog.Install();
            #endregion

            #region Create PerfCounters
            PCInstaller.Install();
            #endregion

            #region Save the fact that we're installed to the registry
            Installed = true;
            #endregion
        }
Exemple #4
0
        /// <summary>
        /// This routine should be called automatically by the MSI during setup, but it can also be called using:
        ///     "installutil.exe Archiver.dll"
        /// </summary>
        /// <param name="savedState">State dictionary passed in by the installer code</param>
        public override void Install(IDictionary savedState)
        {
            #region Check to make sure we're in an Administrator role
            WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());
            if (wp.IsInRole(WindowsBuiltInRole.Administrator) == false)
            {
                MessageBox.Show("You must be an Administrator to install Rtp or run it for the first time.", "Administrator Privileges Required", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Application.Exit();
            }
            #endregion

            #region Uninstall in case we weren't uninstalled cleanly before
            IDictionary state = new Hashtable();
            Uninstall(state);
            if (state.Count != 0)
            {
                Commit(state);
            }
            state = null;
            #endregion

            #region Call base.Install
            base.Install(savedState);
            #endregion

            #region Install the Event Logs
            ArchiveServiceEventLog.Install();
            #endregion

            #region Create PerfCounters
            PCInstaller.Install();
            #endregion

            #region Save the fact that we're installed to the registry
            Installed = true;
            #endregion
        }