public static void RunNTMinerDaemon() { if (VirtualRoot.IsMinerStudio) { return; } string processName = "NTMinerDaemon"; Process[] processes = Process.GetProcessesByName(processName); if (processes.Length != 0) { string thatVersion = NTMinerRegistry.GetDaemonVersion(); try { string thisVersion = ThisNTMinerDaemonFileVersion; if (thatVersion != thisVersion) { Logger.InfoDebugLine($"发现新版Daemon:{thatVersion}->{thisVersion}"); Client.NTMinerDaemonService.CloseDaemon(); System.Threading.Thread.Sleep(1000); Windows.TaskKill.Kill(processName, waitForExit: true); ExtractRunNTMinerDaemonAsync(); } } catch (Exception e) { Logger.ErrorDebugLine(e); } } else { ExtractRunNTMinerDaemonAsync(); } }
public static void RunNTMinerDaemon() { if (ClientAppType.IsMinerStudio) { return; } string processName = Path.GetFileNameWithoutExtension(NTKeyword.NTMinerDaemonFileName); Process[] processes = Process.GetProcessesByName(processName); if (processes.Length != 0) { string thatVersion = NTMinerRegistry.GetDaemonVersion(); try { string thisVersion = ThisNTMinerDaemonFileVersion; if (thatVersion != thisVersion) { Logger.InfoDebugLine($"发现新版Daemon:{thatVersion}->{thisVersion}"); RpcRoot.Client.NTMinerDaemonService.CloseDaemonAsync(() => { System.Threading.Thread.Sleep(1000); Windows.TaskKill.Kill(processName, waitForExit: true); System.Threading.Thread.Sleep(1000); VirtualRoot.Execute(new RefreshWsStateCommand(new WsClientState { Status = WsClientStatus.Closed, Description = "更新守护程序中…", LastTryOn = DateTime.Now, NextTrySecondsDelay = 10 })); ExtractRunNTMinerDaemonAsync(); }); } } catch (Exception e) { Logger.ErrorDebugLine(e); } } else { ExtractRunNTMinerDaemonAsync(); } }