1 Star 0 Fork 35

12345fish / WEBQQ 4 CSharp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
FokiteCoreInstaller.cs 2.35 KB
一键复制 编辑 原始数据 按行查看 历史
夏悸 提交于 2015-06-08 12:57 . init
using System;
namespace FokiteQQcore_http://fokite.com/
{
/// <summary>
/// 用于安装的类
/// </summary>
[RunInstaller(true)]
public class FokiteCoreInstaller : Installer
{
private ServiceInstaller serviceInstaller;
private ServiceProcessInstaller processInstaller;
/// <summary>
/// 用于安装的类
/// </summary>
public FokiteCoreInstaller()
{
AssemblyDescriptionAttribute description = (AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),typeof(AssemblyDescriptionAttribute));
AssemblyTitleAttribute title = (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),typeof(AssemblyTitleAttribute));
AssemblyProductAttribute displayname = (AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyProductAttribute));
using (processInstaller = new ServiceProcessInstaller())
{
serviceInstaller = new ServiceInstaller();
processInstaller.Account = ServiceAccount.LocalSystem;
serviceInstaller.StartType = ServiceStartMode.Automatic;
serviceInstaller.ServiceName = title.Title;
serviceInstaller.DisplayName = displayname.Product;
serviceInstaller.Description = description.Description;
Installers.Add(serviceInstaller);
Installers.Add(processInstaller);
}
}
/// <summary>
/// 安装自身
/// </summary>
public static void InStallSelf()
{
System.Collections.Hashtable installcode = new System.Collections.Hashtable();
using (TransactedInstaller ti = new TransactedInstaller())
{
try
{
AssemblyInstaller ass = new AssemblyInstaller(Assembly.GetExecutingAssembly().Location, new String[0]);
ti.Installers.Add(ass);
ti.Install(installcode);
}
catch
{
ti.Rollback(installcode);
}
}
}
}
}
1
https://gitee.com/ucmmcu/WEBQQ-4-CSharp.git
git@gitee.com:ucmmcu/WEBQQ-4-CSharp.git
ucmmcu
WEBQQ-4-CSharp
WEBQQ 4 CSharp
master

搜索帮助