📄 program.cs
字号:
using System.Collections.Generic;
using System.ServiceProcess;
using System.Reflection;
using System.Text;
using System.Configuration.Install;
namespace LanMsgUpdateService
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
if (args.Length > 0 && (args[0].ToLower() == "-install" || args[0].ToLower() == "-i"))
{
ManagedInstallerClass.InstallHelper(new string[] { "LanMsgUpdateService.exe" });
ServiceController c = new ServiceController("LanMsg UpdateService");
c.Start();
}
else if (args.Length > 0 && (args[0].ToLower() == "-uninstall" || args[0].ToLower() == "-u"))
{
ManagedInstallerClass.InstallHelper(new string[] { "/u", "LanMsgUpdateService.exe" });
}
else
{
System.ServiceProcess.ServiceBase[] servicesToRun = new System.ServiceProcess.ServiceBase[] { new ServiceMain() };
System.ServiceProcess.ServiceBase.Run(servicesToRun);
}
//ServiceBase[] ServicesToRun;
// More than one user Service may run within the same process. To add
// another service to this process, change the following line to
// create a second service object. For example,
//
// ServicesToRun = new ServiceBase[] {new Service1(), new MySecondUserService()};
//
//ServicesToRun = new ServiceBase[] { new ServiceMain() };
//ServiceBase.Run(ServicesToRun);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -