/// <summary> /// 加载服务安装信息 /// </summary> /// <param name="assembly"></param> /// <returns></returns> public ServiceInstallInfoListModel LoadInstallInfosFromAssembly(Assembly assembly) { ServiceInstallInfoListModel retVal = new ServiceInstallInfoListModel(); List<Module> moduleList = new List<Module>(assembly.GetModules()); List<ServiceInstaller> serviceInstallerList; List<ServiceProcessInstaller> serviceProcessInstallerList; this.LoadInstallInfosFromModuleList(moduleList, out serviceInstallerList, out serviceProcessInstallerList); List<ServiceInstallInfo> installInfoList = this.GetInstallInfoList(assembly, serviceInstallerList, serviceProcessInstallerList); retVal.ServiceInstallInfos = installInfoList.ToArray(); return retVal; }
/// <summary> /// 加载服务安装信息 /// </summary> /// <param name="assembly"></param> /// <returns></returns> public ServiceInstallInfoListModel LoadInstallInfosFromAssembly(Assembly assembly) { ServiceInstallInfoListModel retVal = new ServiceInstallInfoListModel(); List <Module> moduleList = new List <Module>(assembly.GetModules()); List <ServiceInstaller> serviceInstallerList; List <ServiceProcessInstaller> serviceProcessInstallerList; this.LoadInstallInfosFromModuleList(moduleList, out serviceInstallerList, out serviceProcessInstallerList); List <ServiceInstallInfo> installInfoList = this.GetInstallInfoList(assembly, serviceInstallerList, serviceProcessInstallerList); retVal.ServiceInstallInfos = installInfoList.ToArray(); return(retVal); }
/// <summary> /// 服务卸载 /// </summary> /// <param name="serviceInfos"></param> public void UnInstall(ServiceInstallInfoListModel serviceInfos) { if (serviceInfos == null || serviceInfos.ServiceInstallInfos == null || serviceInfos.ServiceInstallInfos.Length == 0) { throw new ArgumentNullException("serviceInfos" , TextManager.DefaultInstance.GetTextWithTail(Texts.DotNetServiceInstaller_07)); } for (Int32 i = 0; i < serviceInfos.ServiceInstallInfos.Length; i++) { this.UnInstall(serviceInfos.ServiceInstallInfos[i].ServiceName, serviceInfos.ServiceInstallInfos[i].InstallLogFilePath); } }
/// <summary> /// 服务安装 /// </summary> /// <param name="serviceInfo"></param> public void Install(ServiceInstallInfoListModel installInfos) { if (installInfos == null || installInfos.ServiceInstallInfos == null || installInfos.ServiceInstallInfos.Length == 0) { throw new ArgumentNullException("installInfos" , TextManager.DefaultInstance.GetTextWithTail(Texts.DotNetServiceInstaller_05)); } ServiceInstallerHelper installerHelp = new ServiceInstallerHelper(); for (Int32 i = 0; i < installInfos.ServiceInstallInfos.Length; i++) { try { this.Install(installInfos.ServiceInstallInfos[i]); } catch { throw; } } }
/// <summary> /// 服务卸载 /// </summary> /// <param name="serviceInfos"></param> public void UnInstall(ServiceInstallInfoListModel serviceInfos) { if (serviceInfos == null || serviceInfos.ServiceInstallInfos == null || serviceInfos.ServiceInstallInfos.Length == 0) throw new ArgumentNullException("serviceInfos" , TextManager.DefaultInstance.GetTextWithTail(Texts.DotNetServiceInstaller_07)); for (Int32 i = 0; i < serviceInfos.ServiceInstallInfos.Length; i++) this.UnInstall(serviceInfos.ServiceInstallInfos[i].ServiceName, serviceInfos.ServiceInstallInfos[i].InstallLogFilePath); }
/// <summary> /// 服务安装 /// </summary> /// <param name="serviceInfo"></param> public void Install(ServiceInstallInfoListModel installInfos) { if (installInfos == null || installInfos.ServiceInstallInfos == null || installInfos.ServiceInstallInfos.Length == 0) throw new ArgumentNullException("installInfos" , TextManager.DefaultInstance.GetTextWithTail(Texts.DotNetServiceInstaller_05)); ServiceInstallerHelper installerHelp = new ServiceInstallerHelper(); for (Int32 i = 0; i < installInfos.ServiceInstallInfos.Length; i++) { try { this.Install(installInfos.ServiceInstallInfos[i]); } catch { throw; } } }