Exemplo n.º 1
0
        public override void Uninstall(IDictionary savedState)
        {
            if (Context != null)
            {
                if (Context.Parameters.Count > 0)
                {
                    String systemId = Context.Parameters["systemid"];
                    if ((systemId != null) && (systemId != ""))
                    {
                        this.serviceInstaller.ServiceName = WmsServerServiceProcess.GetServiceName(systemId);
                        this.serviceInstaller.DisplayName = this.serviceInstaller.ServiceName;
                    }
                }
            }

            // call the original Install() method to create root key
            base.Uninstall(savedState);
        }
Exemplo n.º 2
0
        public override void Install(IDictionary savedState)
        {
            String systemId = "";

            if (Context != null)
            {
                if (Context.Parameters.Count > 0)
                {
                    systemId = Context.Parameters["systemid"];

                    if ((systemId != null) && (systemId != ""))
                    {
                        this.serviceInstaller.ServiceName = WmsServerServiceProcess.GetServiceName(systemId);
                        this.serviceInstaller.DisplayName = this.serviceInstaller.ServiceName;
                    }
                }
            }

            // call the original Install() method to create root key
            base.Install(savedState);

            Microsoft.Win32.RegistryKey ServiceDescription = null;
            try
            {
                ServiceDescription =
                    Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\Services\" + serviceInstaller.ServiceName, true);

                ServiceDescription.SetValue("Description", WmsServerServiceProcess.GetServiceDescription(systemId));
                if ((systemId != null) && (systemId != ""))
                {
                    String ip = ServiceDescription.GetValue("ImagePath") as String;
                    ServiceDescription.SetValue("ImagePath", String.Format("{0} {1}", ip, systemId));
                }

                ServiceDescription.Close();
            }
            catch (Exception)
            {
            }
        }