示例#1
0
		public void InstallService(string serviceFileName, string serviceName, string displayName, BuiltInAccount builtInAccount, string description, bool autoStart, string[] dependencies)
		{
			switch (builtInAccount)
			{
				case BuiltInAccount.LocalSystem:
					WindowsImports.InstallService(theScHandle, serviceFileName, serviceName, displayName, null, null, autoStart, dependencies);
					break;
				case BuiltInAccount.LocalService:
				case BuiltInAccount.NetworkService:
					WindowsImports.InstallService(theScHandle, serviceFileName, serviceName, displayName, GetBuiltInAccountName(builtInAccount), null, autoStart, dependencies);
					break;
			}

			if (!String.IsNullOrEmpty(description))
			{
				WindowsImports.SetServiceDescription(theScHandle, serviceName, description);
			}
		}
示例#2
0
		public void InstallService(BuiltInAccount account, bool isAutoStart, string[] dependances)
		{
			theServiceController.InstallService(AssemblyFileName, ServiceName, ServiceName, account, Description, isAutoStart, dependances);
		}
示例#3
0
		private string GetBuiltInAccountName(BuiltInAccount account)
		{
			switch (account)
			{
				case BuiltInAccount.LocalService:
					return @"NT AUTHORITY\LocalService";
				case BuiltInAccount.NetworkService:
					return @"NT AUTHORITY\NetworkService";
			}
			return null;
		}