tijian_jichuang/Code/SOH.FenZhen.Server/Program.cs

63 lines
1.9 KiB
C#
Raw Permalink Normal View History

2025-02-20 11:54:48 +08:00
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.ServiceProcess;
using System.Text;
namespace SOH.FenZhen.Server
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
static void Main(string[] args)
{
if (args.Length > 0)
{
if (args.Contains("-r"))
{
FenZhenService fzs = new FenZhenService();
fzs.start();
//var a= AppDomain.CurrentDomain.BaseDirectory;
}
else if (args.Contains("-i"))
{
string path = Environment.SystemDirectory.Substring(0,3)+ "Windows\\Microsoft.NET\\Framework\\v4.0.30319\\InstallUtil.exe";
if (!File.Exists(path))
{
Console.WriteLine(path+"不存在!");
Console.ReadLine();
}
else
{
path += " " + AppDomain.CurrentDomain.BaseDirectory+"SOH.FenZhen.Server.exe";
Process.Start(path);
}
return;
}
else
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new FenZhenService()
};
ServiceBase.Run(ServicesToRun);
}
}
else
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new FenZhenService()
};
ServiceBase.Run(ServicesToRun);
}
}
}
}