diff --git a/linker.service/LinkerService.cs b/linker.service/LinkerService.cs index bb55a6d8..748aef17 100644 --- a/linker.service/LinkerService.cs +++ b/linker.service/LinkerService.cs @@ -18,6 +18,7 @@ namespace linker.service protected override void OnStart(string[] _args) { CheckMainProcess(); + } protected override void OnStop() { diff --git a/linker/plugins/updater/UpdaterTransfer.cs b/linker/plugins/updater/UpdaterTransfer.cs index 95dbb8bb..b2fb6ebb 100644 --- a/linker/plugins/updater/UpdaterTransfer.cs +++ b/linker/plugins/updater/UpdaterTransfer.cs @@ -272,24 +272,24 @@ namespace linker.plugins.updater private void StartClearTempFile() { - bool restart = false; if (OperatingSystem.IsWindows()) { Process[] trays = Process.GetProcessesByName("linker.tray.win"); - restart = trays.Length > 0; - foreach (var tray in trays) + if (trays.Length > 0) { - 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(); - 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 start linker.service" }); + CommandHelper.Windows(string.Empty, new string[] { "sc stop linker.service & sc start linker.service" }); } } private void ClearTempFile(string path = "./")