コード例 #1
0
        /// <summary>
        ///     Rolls back to the state of the counter, and performs the normal rollback.
        /// </summary>
        /// <param name="savedState">
        ///     The saved state for the installation.
        /// </param>
        public override void Rollback(IDictionary savedState)
        {
            ConsoleHarness.WriteToConsole(ConsoleColor.White, "Rolling back service {0}.", Configuration.Name);

            // load the assembly file name and the config
            ConfigureInstallers();
            base.Rollback(savedState);
        }
コード例 #2
0
        /// <summary>
        ///     Removes the counters, then calls the base uninstall.
        /// </summary>
        /// <param name="savedState">
        ///     The saved state for the installation.
        /// </param>
        public override void Uninstall(IDictionary savedState)
        {
            ConsoleHarness.WriteToConsole(ConsoleColor.White, "Un-Installing service {0}.", Configuration.Name);

            // load the assembly file name and the config
            ConfigureInstallers();
            base.Uninstall(savedState);

            // wire up the event log source, if provided
            if (!string.IsNullOrWhiteSpace(Configuration.EventLogSource))
            {
                // create the source if it doesn't exist
                if (EventLog.SourceExists(Configuration.EventLogSource))
                {
                    EventLog.DeleteEventSource(Configuration.EventLogSource);
                }
            }
        }
コード例 #3
0
        /// <summary>
        ///     Installer class, to use run InstallUtil against this .exe
        /// </summary>
        /// <param name="savedState">
        ///     The saved state for the installation.
        /// </param>
        public override void Install(IDictionary savedState)
        {
            ConsoleHarness.WriteToConsole(ConsoleColor.White, "Installing service {0}.", Configuration.Name);

            // install the service
            ConfigureInstallers();
            base.Install(savedState);

            // wire up the event log source, if provided
            if (!string.IsNullOrWhiteSpace(Configuration.EventLogSource))
            {
                // create the source if it doesn't exist
                if (!EventLog.SourceExists(Configuration.EventLogSource))
                {
                    EventLog.CreateEventSource(Configuration.EventLogSource, "Application");
                }
            }
        }