1 Star 0 Fork 35

自然麻雀/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);
}
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/SesameTech/WEBQQ-4-CSharp.git
git@gitee.com:SesameTech/WEBQQ-4-CSharp.git
SesameTech
WEBQQ-4-CSharp
WEBQQ 4 CSharp
master

搜索帮助