mirror of
https://github.com/snltty/linker.git
synced 2025-10-24 01:23:17 +08:00
修复虚拟网卡添加路由错误,和增加自动更新
This commit is contained in:
@@ -18,6 +18,7 @@ namespace linker.service
|
|||||||
protected override void OnStart(string[] _args)
|
protected override void OnStart(string[] _args)
|
||||||
{
|
{
|
||||||
CheckMainProcess();
|
CheckMainProcess();
|
||||||
|
|
||||||
}
|
}
|
||||||
protected override void OnStop()
|
protected override void OnStop()
|
||||||
{
|
{
|
||||||
|
@@ -272,24 +272,24 @@ namespace linker.plugins.updater
|
|||||||
|
|
||||||
private void StartClearTempFile()
|
private void StartClearTempFile()
|
||||||
{
|
{
|
||||||
bool restart = false;
|
|
||||||
if (OperatingSystem.IsWindows())
|
if (OperatingSystem.IsWindows())
|
||||||
{
|
{
|
||||||
Process[] trays = Process.GetProcessesByName("linker.tray.win");
|
Process[] trays = Process.GetProcessesByName("linker.tray.win");
|
||||||
restart = trays.Length > 0;
|
if (trays.Length > 0)
|
||||||
foreach (var tray in trays)
|
|
||||||
{
|
{
|
||||||
tray.Kill();
|
foreach (var tray in trays)
|
||||||
|
{
|
||||||
|
tray.Kill();
|
||||||
|
}
|
||||||
|
CommandHelper.Windows(string.Empty, new string[] { "start linker.tray.win.exe --task=1" });
|
||||||
}
|
}
|
||||||
CommandHelper.Windows(string.Empty, new string[] { "sc stop linker.service" });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearTempFile();
|
ClearTempFile();
|
||||||
|
|
||||||
if (restart && OperatingSystem.IsWindows())
|
if (File.Exists("linker.service.exe.temp"))
|
||||||
{
|
{
|
||||||
CommandHelper.Execute("linker.tray.win.exe", "--task=1");
|
CommandHelper.Windows(string.Empty, new string[] { "sc stop linker.service & sc start linker.service" });
|
||||||
CommandHelper.Windows(string.Empty, new string[] { "sc start linker.service" });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ClearTempFile(string path = "./")
|
private void ClearTempFile(string path = "./")
|
||||||
|
Reference in New Issue
Block a user