public bool SaveGpuProfilesJson(string json) { bool isSuccess = false; string description = "超频"; try { SpecialPath.SaveGpuProfilesJsonFile(json); if (IsNTMinerOpened()) { RpcRoot.FirePostAsync(NTKeyword.Localhost, NTKeyword.MinerClientPort, _minerClientControllerName, nameof(IMinerClientController.OverClock), null, null); } else { description = "超频,挖矿端未启动,下次启动时生效"; } isSuccess = true; } catch (Exception e) { Logger.ErrorDebugLine(e); } VirtualRoot.OperationResultSet.Add(new OperationResultData { Timestamp = Timestamp.GetTimestamp(), StateCode = isSuccess ? 200 : 500, ReasonPhrase = isSuccess ? "Ok" : "Fail", Description = description }); return(isSuccess); }
public void SetAutoBootStartAsync(IMinerData client, SetAutoBootStartRequest request) { RpcRoot.FirePostAsync(client.GetLocalIp(), NTKeyword.NTMinerDaemonPort, _daemonControllerName, nameof(INTMinerDaemonController.SetAutoBootStart), new Dictionary <string, string> { { "autoBoot", request.AutoBoot.ToString() }, { "autoStart", request.AutoStart.ToString() } }, null, callback: null, timeountMilliseconds: 3000); }
public void ReportStateAsync(Guid clientId, bool isMining) { ReportState request = new ReportState { ClientId = clientId, IsMining = isMining }; RpcRoot.FirePostAsync(RpcRoot.OfficialServerHost, RpcRoot.OfficialServerPort, _controllerName, nameof(IReportController.ReportState), null, request, null, 5000); }
protected override void UpdateWsStateAsync(string description, bool toOut) { if (VirtualRoot.DaemonOperation.IsNTMinerOpened()) { var state = base.GetState(); if (!string.IsNullOrEmpty(description)) { state.Description = description; } state.ToOut = toOut; RpcRoot.FirePostAsync(NTKeyword.Localhost, NTKeyword.MinerClientPort, RpcRoot.GetControllerName <IMinerClientController>(), nameof(IMinerClientController.ReportWsDaemonState), null, state, timeountMilliseconds: 3000); } }
public ResponseBase EnableRemoteDesktop() { ResponseBase response; try { NTMinerRegistry.SetIsRdpEnabled(true); Firewall.AddRdpRule(); if (IsNTMinerOpened()) { RpcRoot.FirePostAsync(NTKeyword.Localhost, NTKeyword.MinerClientPort, _minerClientControllerName, nameof(IMinerClientController.RefreshIsRemoteDesktopEnabled), null, null, timeountMilliseconds: 3000); } response = ResponseBase.Ok("开启Windows远程桌面"); } catch (Exception e) { Logger.ErrorDebugLine(e); response = ResponseBase.ServerError(e.Message); } VirtualRoot.OperationResultSet.Add(response.ToOperationResult()); return(response); }
public bool SetAutoBootStart(bool autoBoot, bool autoStart) { bool isSuccess = false; try { MinerProfileUtil.SetAutoStart(autoBoot, autoStart); if (IsNTMinerOpened()) { RpcRoot.FirePostAsync(NTKeyword.Localhost, NTKeyword.MinerClientPort, _minerClientControllerName, nameof(IMinerClientController.RefreshAutoBootStart), null, null, timeountMilliseconds: 3000); } isSuccess = true; } catch (Exception e) { Logger.ErrorDebugLine(e); } VirtualRoot.OperationResultSet.Add(new OperationResultData { Timestamp = Timestamp.GetTimestamp(), StateCode = isSuccess ? 200 : 500, ReasonPhrase = isSuccess ? "Ok" : "Fail", Description = "设置" }); return(isSuccess); }
/// <summary> /// 本机网络调用 /// </summary> public void StartOrStopWsAsync(bool isResetFailCount) { RpcRoot.FirePostAsync(NTKeyword.Localhost, NTKeyword.NTMinerDaemonPort, _controllerName, nameof(INTMinerDaemonController.StartOrCloseWs), new Dictionary <string, string> { { "isResetFailCount", isResetFailCount.ToString() } }, null, timeountMilliseconds: 3000); }
/// <summary> /// 本机网络调用 /// </summary> public void CloseDaemonAsync(Action callback) { RpcRoot.FirePostAsync(NTKeyword.Localhost, NTKeyword.NTMinerDaemonPort, _controllerName, nameof(INTMinerDaemonController.CloseDaemon), null, null, callback, timeountMilliseconds: 3000); }
public void SaveGpuProfilesJsonAsync(IMinerData client, string json) { HttpContent content = new StringContent(json); RpcRoot.FirePostAsync(client.GetLocalIp(), NTKeyword.NTMinerDaemonPort, _daemonControllerName, nameof(INTMinerDaemonController.SaveGpuProfilesJson), null, content, null, timeountMilliseconds: 3000); }