Ejemplo n.º 1
0
        /// <summary>
        /// Public Constructor for WindowsServiceInstaller.
        /// - Put all of your Initialization code here.
        /// </summary>
        public WindowsServiceInstaller()
        {
            ServiceProcessInstaller serviceProcessInstaller =
                               new ServiceProcessInstaller();
            ServiceInstaller serviceInstaller = new ServiceInstaller();

            //# Service Account Information

            serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
            serviceProcessInstaller.Username = null;
            serviceProcessInstaller.Password = null;

            //# Service Information

            serviceInstaller.DisplayName = "RunUO Service";
            serviceInstaller.StartType = ServiceStartMode.Automatic;

            //# This must be identical to the WindowsService.ServiceBase name

            //# set in the constructor of WindowsService.cs

            serviceInstaller.ServiceName = "RunUO Service";

            this.Installers.Add(serviceProcessInstaller);
            this.Installers.Add(serviceInstaller);
        }
Ejemplo n.º 2
0
 public MyInstaller(){
     this.s = new ServiceInstaller();    
     this.s.ServiceName = "IT CORE Scale Monitor";
     this.Installers.AddRange(new Installer[] {
         this.s
     });
 }    
Ejemplo n.º 3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string svcPath = Path.Combine(Environment.CurrentDirectory, "DS4ToolService.exe");

            ServiceController sc = new ServiceController(Constants.SERVICE_NAME, Environment.MachineName);
            ServiceControllerPermission scp = new ServiceControllerPermission(ServiceControllerPermissionAccess.Control, Environment.MachineName, Constants.SERVICE_NAME);
            scp.Assert();
            sc.Refresh();
            ServiceInstaller si = new ServiceInstaller();

            if (si.DoesServiceExist(Constants.SERVICE_NAME))
            {
                if (sc.Status == ServiceControllerStatus.Running)
                    sc.Stop();

                sc.WaitForStatus(ServiceControllerStatus.Stopped);
                si.UnInstallService(Constants.SERVICE_NAME);
                MessageBox.Show("Service removed");
            }

            EventLog eventLog = new EventLog();
            eventLog.Source = Constants.SERVICE_NAME;
            eventLog.Log = "Application";
            if (!EventLog.SourceExists(eventLog.Source))
            {
                EventLog.DeleteEventSource(eventLog.Source, Environment.MachineName);
                MessageBox.Show("EventLog removed");
            }
        }
Ejemplo n.º 4
0
        public void Should_Emit_FullSetOfMembers()
        {
            var service = new ServiceInstaller
            {
                Name = "WixSharp.TestSvc",
                DisplayName = "WixSharp TestSvc",
                Description = "ServiceDescription",
                DependsOn = "Dnscache;Dhcp",
                Account = "NT AUTHORITY\\LocalService",
                Arguments = "a b c",
                Password = "******",
                LoadOrderGroup = "LoadOrderGroup",
                Vital = true,
                StartOn = SvcEvent.Install,
                StopOn = SvcEvent.InstallUninstall_Wait,
                RemoveOn = SvcEvent.Uninstall_Wait
            };

            var all = service.ToXml(projectMock).Cast<XElement>().ToArray();

            var install = all[0];
            Assert.Equal("ServiceInstall", install.Name.LocalName);
            Assert.Equal("WixSharp.TestSvc", install.Attribute("Name").Value);
            Assert.Equal("WixSharp TestSvc", install.Attribute("DisplayName").Value);
            Assert.Equal("ServiceDescription", install.Attribute("Description").Value);
            Assert.Equal("NT AUTHORITY\\LocalService", install.Attribute("Account").Value);
            Assert.Equal("a b c", install.Attribute("Arguments").Value);
            Assert.Equal("Password", install.Attribute("Password").Value);
            Assert.Equal("LoadOrderGroup", install.Attribute("LoadOrderGroup").Value);
            Assert.Equal("yes", install.Attribute("Vital").Value);
            Assert.Equal("ownProcess", install.Attribute("Type").Value);
            Assert.Equal("auto", install.Attribute("Start").Value);
            Assert.Equal("normal", install.Attribute("ErrorControl").Value);

            var dependencies = install.Elements("ServiceDependency").ToArray();
            Assert.Equal("Dnscache", dependencies[0].Attribute("Id").Value);
            Assert.Equal("Dhcp", dependencies[1].Attribute("Id").Value);

            var controll1 = all[1];
            Assert.Equal("ServiceControl", controll1.Name.LocalName);
            Assert.StartsWith("StopWixSharp.TestSvc", controll1.Attribute("Id").Value); //possible concurrency issues so handle "StopWixSharp.TestSvc.2" as well
            Assert.Equal("WixSharp.TestSvc", controll1.Attribute("Name").Value);
            Assert.Equal("both", controll1.Attribute("Stop").Value);
            Assert.Equal("yes", controll1.Attribute("Wait").Value);

            var controll2 = all[2];
            Assert.Equal("ServiceControl", controll2.Name.LocalName);
            Assert.StartsWith("StartWixSharp.TestSvc", controll2.Attribute("Id").Value);
            Assert.Equal("WixSharp.TestSvc", controll2.Attribute("Name").Value);
            Assert.Equal("install", controll2.Attribute("Start").Value);
            Assert.Equal("no", controll2.Attribute("Wait").Value);

            var controll3 = all[3];
            Assert.Equal("ServiceControl", controll3.Name.LocalName);
            Assert.StartsWith("RemoveWixSharp.TestSvc", controll3.Attribute("Id").Value);
            Assert.Equal("WixSharp.TestSvc", controll3.Attribute("Name").Value);
            Assert.Equal("uninstall", controll3.Attribute("Remove").Value);
            Assert.Equal("yes", controll3.Attribute("Wait").Value);
        }
 public ProjectInstaller()
 {
     process = new ServiceProcessInstaller();
     process.Account = ServiceAccount.LocalSystem;
     service = new ServiceInstaller();
     service.ServiceName = "WCFWindowsServiceSample";
     Installers.Add(process);
     Installers.Add(service);
 }
Ejemplo n.º 6
0
      public void StartForeground(string[] args)
      {
         if (args.Length > 0)
         {
            switch (args[0])
            {
               case "/install":
               case "-install":
               case "--install":
                  {
                     var directory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Barcodes");
                     if (args.Length > 1)
                     {
                        directory = Path.GetFullPath(args[1]);
                     }
                     if (!Directory.Exists(directory))
                        throw new ArgumentException(String.Format("The barcode directory {0} doesn't exists.", directory));
                     
                     var transactedInstaller = new TransactedInstaller();
                     var serviceInstaller = new ServiceInstaller();
                     transactedInstaller.Installers.Add(serviceInstaller);
                     var ctx = new InstallContext();
                     ctx.Parameters["assemblypath"] = String.Format("{0} \"{1}\"", Assembly.GetExecutingAssembly().Location, directory);
                     transactedInstaller.Context = ctx;
                     transactedInstaller.Install(new Hashtable());

                     Console.WriteLine("The service is installed. Barcode images have to be placed into the directory {0}.", directory);
                  }
                  return;
               case "/uninstall":
               case "-uninstall":
               case "--uninstall":
                  {
                     var transactedInstaller = new TransactedInstaller();
                     var serviceInstaller = new ServiceInstaller();
                     transactedInstaller.Installers.Add(serviceInstaller);
                     var ctx = new InstallContext();
                     ctx.Parameters["assemblypath"] = String.Format("{0}", Assembly.GetExecutingAssembly().Location);
                     transactedInstaller.Context = ctx;
                     transactedInstaller.Uninstall(null);

                     Console.WriteLine("The service is uninstalled.");
                  }
                  return;
               default:
                  if (args[0][0] != '/' &&
                      args[0][0] != '-')
                     throw new ArgumentException(String.Format("The argument {0} isn't supported.", args[0]));
                  break;
            }
         }

         OnStart(args);

         Console.ReadLine();
      }
    public Route53DDNSServiceInstaller()
    {
        processInstaller = new ServiceProcessInstaller();
        serviceInstaller = new ServiceInstaller();

        processInstaller.Account = ServiceAccount.LocalSystem;
        serviceInstaller.StartType = ServiceStartMode.Automatic;
        serviceInstaller.ServiceName = "Route53DDNSService";

        Installers.Add(serviceInstaller);
        Installers.Add(processInstaller);
    }
    public CronInstaller()
    {
        processInstaller = new ServiceProcessInstaller();
        serviceInstaller = new ServiceInstaller();

        processInstaller.Account = ServiceAccount.LocalSystem;
        serviceInstaller.StartType = ServiceStartMode.Automatic;
        serviceInstaller.ServiceName = "WIFI_DOOR_LOCK";

        Installers.Add(serviceInstaller);
        Installers.Add(processInstaller);
    }
Ejemplo n.º 9
0
    public TreeBeardInstaller()
    {
        processInstaller = new ServiceProcessInstaller();
        serviceInstaller = new ServiceInstaller();

        processInstaller.Account = ServiceAccount.LocalSystem;
        serviceInstaller.StartType = ServiceStartMode.Manual;
        serviceInstaller.ServiceName = "TreeBeard"; //must match TreeBeardService.ServiceName

        Installers.Add(serviceInstaller);
        Installers.Add(processInstaller);
    }
Ejemplo n.º 10
0
    public CronInstaller()
    {
        processInstaller = new ServiceProcessInstaller();
        serviceInstaller = new ServiceInstaller();

        processInstaller.Account = ServiceAccount.LocalSystem;
        serviceInstaller.StartType = ServiceStartMode.Manual;
        serviceInstaller.ServiceName = "Cron";

        Installers.Add(serviceInstaller);
        Installers.Add(processInstaller);
    }
Ejemplo n.º 11
0
        public void ShouldNot_Emit_AbsentOptionalAttributes()
        {
            var service = new ServiceInstaller
            {
                Name = "WixSharp.TestSvc"
            };

            var root = service.ToXml(projectMock).Cast<XElement>().First();

            Assert.False(root.HasAttribute("Account"));
            Assert.False(root.HasAttribute("Arguments"));
            Assert.False(root.HasAttribute("Password"));
            Assert.False(root.HasAttribute("LoadOrderGroup"));
            Assert.False(root.HasAttribute("Vital"));
        }
Ejemplo n.º 12
0
        public InstallerService()
        {
            ServiceProcessInstaller ServiceInstaller = new ServiceProcessInstaller();
            ServiceInstaller.Account = ServiceAccount.LocalSystem;
            ServiceInstaller.Username = null;
            ServiceInstaller.Password = null;

            this.Installers.Add(ServiceInstaller);

            serviceInstaller = new ServiceInstaller();
            serviceInstaller.DisplayName = "Advanced FTP Server";
            serviceInstaller.StartType = ServiceStartMode.Automatic;
            serviceInstaller.Description = "Enables access to files and folders over network with user specific credentials. If this service is disabled, any services explicitly depend on it will fail to start.";
            serviceInstaller.ServiceName = "AdvFTPSvr";
            this.Installers.Add(serviceInstaller);
        }
Ejemplo n.º 13
0
    public WindowsServiceInstaller()
    {
      ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();
      ServiceInstaller serviceInstaller = new ServiceInstaller();

      serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
      serviceProcessInstaller.Username = null;
      serviceProcessInstaller.Password = null;

      serviceInstaller.DisplayName = "SocialVPN";
      serviceInstaller.StartType = ServiceStartMode.Automatic;

      serviceInstaller.ServiceName = "SocialVPN";

      this.Installers.Add(serviceProcessInstaller);
      this.Installers.Add(serviceInstaller);
    }
        private void InstallingService()
        {
            var process = new ServiceProcessInstaller {Account = ServiceAccount.LocalSystem};

            var sServiceName = Path.GetFileNameWithoutExtension(AppDomain.CurrentDomain.FriendlyName);

            var serviceAdmin = new ServiceInstaller
                {
                    StartType = ServiceStartMode.Automatic,
                    ServiceName = sServiceName,
                    DisplayName = sServiceName,
                    Description = sServiceName
                };

            Installers.Add(process);
            Installers.Add(serviceAdmin);
        }
Ejemplo n.º 15
0
        public ServicesInstaller()
        {
            try
            {
                process         = new ServiceProcessInstaller();
                process.Account = ServiceAccount.LocalSystem;
                var installer = new ServiceInstaller();
                installer.ServiceName = "Smart CRM - API Lead Submission Processor";
                installer.Description = "Process API Submission Leads";
                installer.StartType   = ServiceStartMode.Automatic;

                Installers.Add(process);
                Installers.Add(installer);
            }
            catch
            {
            }
        }
        public WindowsServiceInstaller()
        {
            var serviceProcessInstaller = new ServiceProcessInstaller();
            var serviceInstaller        = new ServiceInstaller();

            //# Service Account Information
            serviceProcessInstaller.Account = ServiceAccount.LocalService;

            //# Service Information
            serviceInstaller.DisplayName = "Cryptopia.SpriteBuilder";
            serviceInstaller.StartType   = ServiceStartMode.Manual;
            serviceInstaller.Description = "Service for building sprite sheets";
            //# This must be identical to the WindowsService.ServiceBase name
            //# set in the constructor of WindowsService.cs
            serviceInstaller.ServiceName = "Cryptopia.SpriteBuilderService";
            this.Installers.Add(serviceProcessInstaller);
            this.Installers.Add(serviceInstaller);
        }
Ejemplo n.º 17
0
        public IntelStatusSenderInstaller()
        {
            var serviceProcessInstaller = new ServiceProcessInstaller();
            var serviceInstaller        = new ServiceInstaller();

            serviceProcessInstaller.Account  = ServiceAccount.LocalSystem;
            serviceProcessInstaller.Username = null;
            serviceProcessInstaller.Password = null;

            serviceInstaller.DisplayName = "Интеграция - Отправитель статусов";
            serviceInstaller.StartType   = ServiceStartMode.Automatic;
            serviceInstaller.ServiceName = IntelStatusSenderService.Name;
            serviceInstaller.Description = "Передача статусов от НИИС";

            Installers.Add(serviceProcessInstaller);
            Installers.Add(serviceInstaller);
            InitializeComponent();
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Public Constructor for WindowsServiceInstaller.
        /// - Put all of your Initialization code here.
        /// </summary>
        public WindowsServiceInstaller()
        {
            var serviceProcessInstaller = new ServiceProcessInstaller();
            var serviceInstaller        = new ServiceInstaller();

            //# Service Account Information
            serviceProcessInstaller.Account = ServiceAccount.LocalService;

            //# Service Information
            serviceInstaller.DisplayName = "HiveFive Email Service";
            serviceInstaller.StartType   = ServiceStartMode.Manual;
            serviceInstaller.Description = "Service for sending emails";
            //# This must be identical to the WindowsService.ServiceBase name
            //# set in the constructor of WindowsService.cs
            serviceInstaller.ServiceName = "HiveFive.EmailService";
            Installers.Add(serviceProcessInstaller);
            Installers.Add(serviceInstaller);
        }
Ejemplo n.º 19
0
        static void _InstallService(string name)
        {
            var createdNew = true;

            using (var mutex = new Mutex(true, name, out createdNew))
            {
                if (createdNew)
                {
                    mutex.WaitOne();
                    ServiceInstaller.Install(name, name, _FilePath);
                    Console.Error.WriteLine("Service " + name + " installed");
                }
                else
                {
                    throw new ApplicationException("Service " + name + " is currently running.");
                }
            }
        }
Ejemplo n.º 20
0
        public ProjectInstaller()
        {
            ServiceProcessInstaller serviceProcessInstaller =
                new ServiceProcessInstaller();
            ServiceInstaller serviceInstaller = new ServiceInstaller();

            //serviceProcessInstaller.Account = ServiceAccount.LocalService;
            //serviceProcessInstaller.Account = ServiceAccount.User;
            serviceProcessInstaller.Account = ServiceAccount.LocalSystem;

            serviceInstaller.ServiceName = MojaUsluga.NazwaUslugi;
            serviceInstaller.StartType   = ServiceStartMode.Manual;
            serviceInstaller.DisplayName = "Mój Chat";
            serviceInstaller.Description = "Chat - usługa - stworzona \"od zera\"";

            this.Installers.Add(serviceProcessInstaller);
            this.Installers.Add(serviceInstaller);
        }
Ejemplo n.º 21
0
        public ServicesInstaller()
        {
            try
            {
                process         = new ServiceProcessInstaller();
                process.Account = ServiceAccount.LocalSystem;
                var installer = new ServiceInstaller();
                installer.ServiceName = "Smart CRM - Litmus Test Processor";
                installer.Description = "Process litmus test requests";
                installer.StartType   = ServiceStartMode.Automatic;

                Installers.Add(process);
                Installers.Add(installer);
            }
            catch (Exception ex)
            {
            }
        }
        protected AdvancedServiceBase(string serviceName)
        {
            // Instantiate installer for process and service.
            ServiceProcessInstaller processInstaller = new ServiceProcessInstaller();

            ServiceInstaller serviceInstaller = new ServiceInstaller();

            processInstaller.Account     = Account;
            serviceInstaller.StartType   = StartType;
            serviceInstaller.ServiceName = serviceName;

            // Set the dependencies.
            serviceInstaller.ServicesDependedOn = EnumerateDependencies().ToArray();

            // Add installer to collection. Order is not important if more than one service.
            Installers.Add(serviceInstaller);
            Installers.Add(processInstaller);
        }
        internal RbrServiceInstaller(string[] pDependedOn, string pVersion)
        {
            var _spi = new ServiceProcessInstaller();

            _spi.Account  = ServiceAccount.LocalSystem;
            _spi.Password = null;
            _spi.Username = null;

            var _si = new ServiceInstaller();

            _si.ServiceName        = "Timok.Rbr.WebAPI." + pVersion;
            _si.DisplayName        = "Timok.Rbr.WebAPI." + pVersion;
            _si.StartType          = ServiceStartMode.Automatic;
            _si.ServicesDependedOn = pDependedOn;

            Installers.Add(_spi);
            Installers.Add(_si);
        }
Ejemplo n.º 24
0
        public HostServiceInstaller()
        {
            TryGetServiceName();

            ServiceProcessInstaller processInstaller = new ServiceProcessInstaller {
                Account = ServiceAccount.LocalSystem
            };

            ServiceInstaller hostServiceInstaller = new ServiceInstaller
            {
                StartType   = ServiceStartMode.Manual,
                ServiceName = ServiceName,
                Description = ServiceName,
            };

            Installers.Add(hostServiceInstaller);
            Installers.Add(processInstaller);
        }
Ejemplo n.º 25
0
        void ProjectInstaller_BeforeInstall(object sender, System.Configuration.Install.InstallEventArgs e)
        {
            List <ServiceController> services = new List <ServiceController>(ServiceController.GetServices());

            foreach (ServiceController s in services)
            {
                if (s.ServiceName == this.serviceInstaller1.ServiceName)
                {
                    ServiceInstaller ServiceInstallerObj = new ServiceInstaller();
                    ServiceInstallerObj.Context     = new System.Configuration.Install.InstallContext();
                    ServiceInstallerObj.Context     = Context;
                    ServiceInstallerObj.ServiceName = "ServiceTPVATG";
                    ServiceInstallerObj.Uninstall(null);

                    break;
                }
            }
        }
Ejemplo n.º 26
0
        public Installer()
        {
            ServiceInstaller serviceInstaller = new ServiceInstaller()
            {
                Description = "定时处理服务",
                DisplayName = "AppTimerServer",
                ServiceName = "AppTimerServer",
                StartType   = ServiceStartMode.Automatic
            };
            ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller()
            {
                Account = ServiceAccount.LocalSystem
            };

            base.Installers.Add(serviceInstaller);
            base.Installers.Add(serviceProcessInstaller);
            InitializeComponent();
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Public Constructor for WindowsServiceInstaller.
        /// - Put all of your Initialization code here.
        /// </summary>
        public WindowsServiceInstaller()
        {
            var serviceProcessInstaller = new ServiceProcessInstaller();
            var serviceInstaller        = new ServiceInstaller();

            //# Service Account Information
            serviceProcessInstaller.Account = ServiceAccount.LocalService;

            //# Service Information
            serviceInstaller.DisplayName = "BitPixel.ImageService";
            serviceInstaller.StartType   = ServiceStartMode.Manual;
            serviceInstaller.Description = "BitPixel.ImageService";
            //# This must be identical to the WindowsService.ServiceBase name
            //# set in the constructor of WindowsService.cs
            serviceInstaller.ServiceName = "BitPixel.ImageService";
            this.Installers.Add(serviceProcessInstaller);
            this.Installers.Add(serviceInstaller);
        }
Ejemplo n.º 28
0
 public WCFServiceInstaller()
 {
     InitializeComponent();
     _serviceProcessInstaller          = new ServiceProcessInstaller();
     _serviceInstaller                 = new ServiceInstaller();
     _serviceProcessInstaller.Account  = ServiceAccount.LocalSystem;
     _serviceProcessInstaller.Password = null;
     _serviceProcessInstaller.Username = null;
     _serviceInstaller.ServiceName     = NotesWCFService.CurrentServiceName;
     _serviceInstaller.DisplayName     = NotesWCFService.CurrentServiceDisplayName;
     _serviceInstaller.Description     = NotesWCFService.CurrentServiceDescription;
     _serviceInstaller.StartType       = ServiceStartMode.Automatic;
     Installers.AddRange(new Installer[]
     {
         _serviceProcessInstaller,
         _serviceInstaller
     });
 }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.serviceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
     this.serviceInstaller        = new System.ServiceProcess.ServiceInstaller();
     //
     // serviceProcessInstaller
     //
     this.serviceProcessInstaller.Password = null;
     this.serviceProcessInstaller.Username = null;
     //
     // ProjectInstaller
     //
     this.Installers.AddRange(new System.Configuration.Install.Installer[]
     {
         this.serviceProcessInstaller,
         this.serviceInstaller
     });
 }
Ejemplo n.º 30
0
        public ServicesInstaller()
        {
            try
            {
                process         = new ServiceProcessInstaller();
                process.Account = ServiceAccount.LocalSystem;
                var installer = new ServiceInstaller();
                installer.ServiceName = "Smart CRM - Smart Search Processor";
                installer.Description = "Process Smart Search Contacts Processor";
                installer.StartType   = ServiceStartMode.Automatic;

                Installers.Add(process);
                Installers.Add(installer);
            }
            catch (Exception ex)
            {
            }
        }
        void Init()
        {
            var processInstaller = new ServiceProcessInstaller
            {
                Account = ServiceAccount.NetworkService
            };

            var serviceInstaller = new ServiceInstaller
            {
                StartType        = ServiceStartMode.Automatic,
                DelayedAutoStart = true,
                ServiceName      = RelayBridgeServiceInstaller.ServiceName,
                DisplayName      = RelayBridgeServiceInstaller.ServiceName,
            };

            Installers.Add(serviceInstaller);
            Installers.Add(processInstaller);
        }
Ejemplo n.º 32
0
        private void Initialize()
        {
            var process = new ServiceProcessInstaller {
                Account = ServiceAccount.LocalSystem
            };

            var service = new ServiceInstaller
            {
                ServiceName = ServiceConfig.ServiceName,
                DisplayName = ServiceConfig.DisplayName,
                Description = ServiceConfig.Description,
                StartType   = ServiceStartMode.Automatic
            };

            Installers.Add(process);
            Installers.Add(service);
            Committed += ReportServiceInstaller_Committed;
        }
Ejemplo n.º 33
0
        public MessageResult TryStart()
        {
            var serviceName  = ServiceInfo.ServiceName;
            var serviceState = GetServiceState(serviceName);

            if (serviceState == ServiceState.NotFound)
            {
                return(AppendLogsAndResult(false, string.Format("{0} not installed!", serviceName)));
            }

            if (serviceState == ServiceState.Running || serviceState == ServiceState.StartPending)
            {
                return(AppendLogsAndResult(true, string.Format("{0} is already running!", serviceName)));
            }

            ServiceInstaller.StartService(serviceName);
            return(AppendLogsAndResult(true, string.Format("{0} start completed!", serviceName)));
        }
Ejemplo n.º 34
0
        public Installer()
        {
            InitializeComponent();

            var processInstaller = new ServiceProcessInstaller()
            {
                Account = ServiceAccount.LocalSystem
            };
            var serviceInstaller = new ServiceInstaller()
            {
                ServiceName = ConfigurationManager.AppSettings["ServiceName"],
                Description = "Provides convertion rates for currencies",
                StartType   = ServiceStartMode.Automatic
            };

            this.Installers.Add(serviceInstaller);
            this.Installers.Add(processInstaller);
        }
Ejemplo n.º 35
0
        public PFWServiceInstaller()
        {
            // This call is required by the Designer.
            InitializeComponent();

            ServiceProcessInstaller process = new ServiceProcessInstaller();

            process.Account = ServiceAccount.LocalSystem;

            ServiceInstaller serviceAdmin = new ServiceInstaller();

            serviceAdmin.StartType          = ServiceStartMode.Automatic;
            serviceAdmin.ServiceName        = Utils.SERVICE_NAME;
            serviceAdmin.ServicesDependedOn = new string[] { "Print Spooler" };

            Installers.Add(process);
            Installers.Add(serviceAdmin);
        }
Ejemplo n.º 36
0
        public ArchiServiceInstaller()
        {
            ServiceInstaller        serviceInstaller        = new ServiceInstaller();
            ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();

            serviceInstaller.ServiceName = SharedInfo.ServiceName;
            serviceInstaller.DisplayName = SharedInfo.ServiceName;
            serviceInstaller.Description = SharedInfo.ServiceDescription;

            // Defaulting to only starting when a user starts it, can be easily changed after install
            serviceInstaller.StartType = ServiceStartMode.Manual;

            // System account, requires admin privilege to install
            serviceProcessInstaller.Account = ServiceAccount.LocalSystem;

            Installers.Add(serviceInstaller);
            Installers.Add(serviceProcessInstaller);
        }
Ejemplo n.º 37
0
        public ProjectInstaller()
        {
            InitializeComponent();
            ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();
            ServiceInstaller        serviceInstaller        = new ServiceInstaller();

            serviceProcessInstaller.Account  = ServiceAccount.LocalSystem;
            serviceProcessInstaller.Username = null;
            serviceProcessInstaller.Password = null;

            serviceInstaller.DisplayName = "BiblosDS_StampaConformeServiceConverter_" + Properties.Settings.Default.ServiceName;
            serviceInstaller.StartType   = ServiceStartMode.Automatic;
            serviceInstaller.ServiceName = "BiblosDS_StampaConformeServiceConverter_" + Properties.Settings.Default.ServiceName;
            serviceInstaller.Description = "BiblosDS Server di conversione di stampa conforme (VecompSoftware)";

            this.Installers.Add(serviceProcessInstaller);
            this.Installers.Add(serviceInstaller);
        }
Ejemplo n.º 38
0
        public ProjectInstaller()
        {
            InitializeComponent();
            ServiceProcessInstaller spi = new ServiceProcessInstaller();

            spi.Account = ServiceAccount.LocalSystem;//设置服务要运行在什么类型的账号
            //这里可以创建多个ServiceInstaller实例
            ServiceInstaller si = new ServiceInstaller();

            si.ServiceName = "WMSDocumentSynchronizationService"; //系统操作服务的标识,要和ServiceBase中设置的ServiceName属性值相同
            si.DisplayName = "WMSDocumentSynchronizationService"; //展示给用户的服务名,即在控制面板中看到的服务名
            si.Description = "从ERP同步单据至WMS服务";
            si.StartType   = ServiceStartMode.Automatic;          //服务的启动方式,这里设置为自动

            //最后记得把创建的实例添加到安装列表中
            this.Installers.Add(si);
            this.Installers.Add(spi);
        }
Ejemplo n.º 39
0
        public MyWinServiceInstaller()
        {
            ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();
            ServiceInstaller        serviceInstaller        = new ServiceInstaller();

            //# Service Account Information

            serviceProcessInstaller.Account  = ServiceAccount.LocalSystem;
            serviceProcessInstaller.Username = null;
            serviceProcessInstaller.Password = null;

            serviceInstaller.DisplayName = "VNM_ViSport_Charging_SpamSms";
            serviceInstaller.StartType   = ServiceStartMode.Manual;
            serviceInstaller.ServiceName = "VNM_ViSport_Charging_SpamSms";

            this.Installers.Add(serviceProcessInstaller);
            this.Installers.Add(serviceInstaller);
        }
Ejemplo n.º 40
0
        public ProjectInstaller()
        {
            InitializeComponent();

            this.serviceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
            this.serviceInstaller        = new System.ServiceProcess.ServiceInstaller();

            this.serviceProcessInstaller.Password = null;
            this.serviceProcessInstaller.Username = null;
            this.serviceProcessInstaller.Account  = ServiceAccount.LocalSystem;

            this.serviceInstaller.ServiceName = "Wingnut Service";

            this.Installers.AddRange(new System.Configuration.Install.Installer[] {
                this.serviceProcessInstaller,
                this.serviceInstaller
            });
        }
Ejemplo n.º 41
0
        public WindowsServiceInstaller()
        {
            Lithnet.MetadirectoryServices.Resolver.MmsAssemblyResolver.RegisterResolver();

            InitializeComponent();

            ServiceProcessInstaller process = new ServiceProcessInstaller();

            process.Account = ServiceAccount.User;
            ServiceInstaller service = new ServiceInstaller();

            service.ServiceName = "acma";
            service.DisplayName = "ACMA Service";
            service.StartType   = ServiceStartMode.Automatic;

            Installers.Add(process);
            Installers.Add(service);
        }
        public FileProcessorServiceInstaller()
        {
            var serviceInstaller = new ServiceInstaller();

            serviceInstaller.StartType   = ServiceStartMode.Manual;
            serviceInstaller.ServiceName = FileProcessor.SericeName;
            serviceInstaller.DisplayName = FileProcessor.SericeName;

            Installers.Add(serviceInstaller);

            var processInstaller = new ServiceProcessInstaller();

            processInstaller.Account  = ServiceAccount.User;
            processInstaller.Username = @".\Дмитрий";
            processInstaller.Password = "******";

            Installers.Add(processInstaller);
        }
Ejemplo n.º 43
0
        public ReportGeneratorServiceInstaller()
        {
            InitializeComponent();
            var serviceInstaller = new ServiceInstaller();

            serviceInstaller.ServiceName      = " ReportGeneratorService";
            serviceInstaller.DisplayName      = " Report Generator Service";
            serviceInstaller.DelayedAutoStart = true;
            serviceInstaller.StartType        = ServiceStartMode.Manual;

            this.Installers.Add(serviceInstaller);

            var serviceProcessInstaller = new ServiceProcessInstaller();

            serviceProcessInstaller.Account = ServiceAccount.LocalService;

            this.Installers.Add(serviceProcessInstaller);
        }
Ejemplo n.º 44
0
        private void InstallingService()
        {
            ServiceProcessInstaller process = new ServiceProcessInstaller();

            process.Account = ServiceAccount.LocalSystem;

            ServiceInstaller serviceAdmin = new ServiceInstaller();

            serviceAdmin.StartType = ServiceStartMode.Automatic;
            string sServiceName = Path.GetFileNameWithoutExtension(AppDomain.CurrentDomain.FriendlyName);

            serviceAdmin.ServiceName = sServiceName;
            serviceAdmin.DisplayName = sServiceName;
            serviceAdmin.Description = sServiceName;

            Installers.Add(process);
            Installers.Add(serviceAdmin);
        }
Ejemplo n.º 45
0
    public PlasmaServersInstaller()
    {
        // Instantiate installers for process and services.
        processInstaller = new ServiceProcessInstaller();
        serviceInstaller1 = new ServiceInstaller();

        // The services run under the system account.
        processInstaller.Account = ServiceAccount.LocalSystem;

        // The services are started manually.
        serviceInstaller1.StartType = ServiceStartMode.Manual;

        // ServiceName must equal those on ServiceBase derived classes.
        serviceInstaller1.ServiceName = "PlasmaServers";

        // Add installers to collection. Order is not important.
        Installers.Add(serviceInstaller1);
        Installers.Add(processInstaller);
    }
Ejemplo n.º 46
0
    public VersaServiceInstaller()
    {
	spi = new ServiceProcessInstaller(); 
	si = new ServiceInstaller(); 

	// if auth, leave these alone and the ServiceInstaller should prompt
	// for authorization.
	if (!auth)
	{
	    spi.Account = ServiceAccount.LocalSystem; 
	    spi.Password = null;
	    spi.Username = null;
	}

	si.ServiceName = servname;
	si.Description = "Provides a secure connection to SQL Server";
	si.StartType = ServiceStartMode.Automatic;
	
	Installers.AddRange(new Installer[] { si, spi });
    }
Ejemplo n.º 47
0
        /// <summary>
        /// Ctor
        /// </summary>
        public MainViewModel()
        {
            svcPath = Path.Combine(Environment.CurrentDirectory, "DS4ToolService.exe");

            el = new EventLog("Application", Environment.MachineName, Constants.SERVICE_NAME);
            el.EntryWritten += new EntryWrittenEventHandler(LogWritten);
            el.EnableRaisingEvents = true;

            si = new ServiceInstaller();
            si.InstallService(svcPath, Constants.SERVICE_NAME);

            DuplexChannelFactory<ISendService> pipeFactory = new DuplexChannelFactory<ISendService>(new PushService(),
                new NetNamedPipeBinding(), new EndpointAddress(Constants.PIPE_ADDRESS + "tester"));
            sp = pipeFactory.CreateChannel();

            sc = new ServiceController(Constants.SERVICE_NAME, Environment.MachineName);
            new ServiceControllerPermission(ServiceControllerPermissionAccess.Browse, Environment.MachineName, Constants.SERVICE_NAME).Assert();
            sc.Refresh();
            sc.WaitForStatus(ServiceControllerStatus.Running);
        }
        /// <summary>Public Constructor for WindowsServiceInstaller.</summary>
        public WindowsServiceInstaller()
        {
            ServiceProcessInstaller spInstaller = new ServiceProcessInstaller
                                                      {
                                                          Account = ServiceAccount.LocalSystem,
                                                          Username = null,
                                                          Password = null
                                                      };

            ServiceInstaller sInstaller = new ServiceInstaller
                                              {
                                                  DisplayName = "Test AutoUpdate Service in C#",
                                                  Description = "A simple service that writes to \"C:\\NETWinService.txt\"",
                                                  StartType = ServiceStartMode.Manual,

                                                  // This must be identical to the WindowsService.ServiceBase name
                                                  // set in the constructor of WindowsService.cs
                                                  ServiceName = "Test AutoUpdate Service"
                                              };

            Installers.Add(spInstaller);
            Installers.Add(sInstaller);
        }
Ejemplo n.º 49
0
    public ProjectInstaller()
    {
        ServiceProcessInstaller spi = new ServiceProcessInstaller();
        spi.Account = ServiceAccount.LocalSystem;

        ServiceInstaller si = new ServiceInstaller();
        si.DisplayName = "SharpPrivacy OpenPGP Service";
        si.ServiceName = "SharpPrivacySrv";
        si.StartType = ServiceStartMode.Automatic;

        Installers.AddRange(new Installer[] {spi, si});
    }
Ejemplo n.º 50
0
        public void Should_Emit_OptionalAutoAttributes()
        {
            var service = new ServiceInstaller
            {
                Name = "WixSharp.TestSvc"
            };

            var root = service.ToXml(projectMock).Cast<XElement>().First();

            Assert.Equal("WixSharp.TestSvc", root.Attribute("Name").Value);
            Assert.Equal("WixSharp.TestSvc", root.Attribute("DisplayName").Value);
            Assert.Equal("ownProcess", root.Attribute("Type").Value);
            Assert.Equal("auto", root.Attribute("Start").Value);
            Assert.Equal("normal", root.Attribute("ErrorControl").Value);
        }
Ejemplo n.º 51
0
	public MuninNodeInstaller() : base() {
		ServiceInstaller TSSI = new ServiceInstaller();
		TSSI.ServiceName = "MuninNode";
		TSSI.DisplayName = "MuninNode";
		TSSI.StartType = ServiceStartMode.Automatic;
		this.Installers.Add(TSSI);
		
		ServiceProcessInstaller TSPI = new ServiceProcessInstaller();
		TSPI.Account = ServiceAccount.LocalSystem;
		this.Installers.Add(TSPI);
	}
 public void ConfigureServiceInstaller(ServiceInstaller installer)
 {
     throw new NotImplementedException();
 }
        static void Main(string[] args)
        {
            Arguments = string.Join(" ", args);

            if (args.Length == 1 && IsServiceCommand(args[0]))
            {
                if (Insensitive.Equals(args[0], "-restart"))
                {
                    Service.ServiceControlRestart();
                }
                else if (Insensitive.Equals(args[0], "-stop"))
                {
                    Service.ServiceControlStop();
                }
                else if (Insensitive.Equals(args[0], "-start"))
                {
                    Service.ServiceControlStart();
                }
                else if (Insensitive.Equals(args[0], "-install"))
                {
                    ServiceInstaller si = new ServiceInstaller();
                    if (si.InstallService(Assembly.GetExecutingAssembly().Location + " -service", Service.GlobalServiceName, Service.GlobalServiceName + " Service"))
                        Console.WriteLine("The " + Service.GlobalServiceName + " service has been installed.");
                    else
                        Console.WriteLine("An error occurred during service installation.");
                }
                else if (Insensitive.Equals(args[0], "-uninstall"))
                {
                    ServiceInstaller si = new ServiceInstaller();
                    if (si.UnInstallService(Service.GlobalServiceName))
                        Console.WriteLine("The " + Service.GlobalServiceName + " service has been uninstalled. You may need to reboot to remove it completely.");
                    else
                        Console.WriteLine("An error occurred during service removal.");
                }
                else if (Insensitive.Equals(args[0], "-setauto"))
                {
                    ServiceInstaller si = new ServiceInstaller();
                    if (si.SetAutoAtart(Service.GlobalServiceName))
                        Console.WriteLine("The " + Service.GlobalServiceName + " service has been set to auto-start.");
                    else
                        Console.WriteLine("An error occurred during service modification.");
                }
                return;
            }

            foreach (var arg in args)
            {
                if (Insensitive.Equals(arg, "-debug"))
                    Debug = true;
                else if (Insensitive.Equals(arg, "-test"))
                    TestMode = true;
                else if (Insensitive.Equals(arg, "-service"))
                    IsService = true;
                else if (Insensitive.Equals(arg, "-log"))
                    LoggingRequested = true;
                else if (IsServiceCommand(arg))
                {
                    Console.WriteLine("Service commands may not be used with other arguments");
                    return;
                }
            }

            StartIfNotRunning();
        }
Ejemplo n.º 54
0
Archivo: File.cs Proyecto: Eun/WixSharp
        void AddItems(WixEntity[] items)
        {
            Shortcuts = items.OfType<FileShortcut>().ToArray();
            Associations = items.OfType<FileAssociation>().ToArray();
            IISVirtualDirs = items.OfType<IISVirtualDir>().ToArray();
            ServiceInstaller = items.OfType<ServiceInstaller>().FirstOrDefault();
            DriverInstaller = items.OfType<DriverInstaller>().FirstOrDefault();
            Permissions = items.OfType<FilePermission>().ToArray();

            var firstUnExpectedItem = items.Except(Shortcuts)
                                           .Except(Associations)
                                           .Except(IISVirtualDirs)
                                           .Except(Permissions)
                                           .Where(x => x != ServiceInstaller)
                                           .Where(x => x != DriverInstaller)
                                           .ToArray();

            if (firstUnExpectedItem.Any())
                throw new ApplicationException("{0} is unexpected. Only {1}, {2}, {3}, {4}, and {5} items can be added to {6}".FormatInline(
                                                firstUnExpectedItem.First().GetType(),
                                                typeof(FileShortcut),
                                                typeof(FileAssociation),
                                                typeof(ServiceInstaller),
                                                typeof(FilePermission),
                                                typeof(DriverInstaller),
                                                this.GetType()));
        }