public void GetGpuProfilesJsonAsync(IMinerData client) { RpcRoot.PostAsync <string>(client.GetLocalIp(), NTKeyword.NTMinerDaemonPort, _daemonControllerName, nameof(INTMinerDaemonController.GetGpuProfilesJson), null, (json, e) => { GpuProfilesJsonDb data = VirtualRoot.JsonSerializer.Deserialize <GpuProfilesJsonDb>(json) ?? new GpuProfilesJsonDb(); VirtualRoot.RaiseEvent(new GetGpuProfilesResponsedEvent(client.ClientId, data)); }, timeountMilliseconds: 3000); }
public void QueryClientsAsync( int pageIndex, int pageSize, Guid?groupId, Guid?workId, string minerIp, string minerName, MineStatus mineState, string coin, string pool, string wallet, string version, string kernel, Action <QueryClientsResponse, Exception> callback) { var request = new QueryClientsRequest { PageIndex = pageIndex, PageSize = pageSize, GroupId = groupId, WorkId = workId, MinerIp = minerIp, MinerName = minerName, MineState = mineState, Coin = coin, Pool = pool, Wallet = wallet, Version = version, Kernel = kernel }; RpcRoot.PostAsync(NTMinerRegistry.GetControlCenterHost(), NTKeyword.ControlCenterPort, _controllerName, nameof(IClientController.QueryClients), request, request, callback); }
public void GetGpuProfilesJsonAsync(string clientIp, Action <GpuProfilesJsonDb, Exception> callback) { RpcRoot.PostAsync(clientIp, NTKeyword.NTMinerDaemonPort, _controllerName, nameof(INTMinerDaemonController.GetGpuProfilesJson), null, (string json, Exception e) => { GpuProfilesJsonDb data = VirtualRoot.JsonSerializer.Deserialize <GpuProfilesJsonDb>(json) ?? new GpuProfilesJsonDb(); callback?.Invoke(data, null); }, timeountMilliseconds: 3000); }
/// <summary> /// 本机同步网络调用 /// </summary> public void CloseNTMinerAsync(Action callback) { string location = NTMinerRegistry.GetLocation(NTMinerAppType.MinerClient); if (string.IsNullOrEmpty(location) || !File.Exists(location)) { callback?.Invoke(); return; } string processName = Path.GetFileNameWithoutExtension(location); if (Process.GetProcessesByName(processName).Length == 0) { callback?.Invoke(); return; } RpcRoot.PostAsync(NTKeyword.Localhost, NTKeyword.MinerClientPort, _controllerName, nameof(IMinerClientController.CloseNTMiner), new SignRequest { }, (ResponseBase response, Exception e) => { if (!response.IsSuccess()) { try { Windows.TaskKill.Kill(processName, waitForExit: true); } catch (Exception ex) { Logger.ErrorDebugLine(ex); } } callback?.Invoke(); }, timeountMilliseconds: 2000); }
public void GetPackageUrlAsync(string package, Action <string, Exception> callback) { PackageUrlRequest request = new PackageUrlRequest { Package = package }; RpcRoot.PostAsync(_host, _port, _controllerName, nameof(IFileUrlController.PackageUrl), request, callback); }
// ReSharper disable once InconsistentNaming public void UpgradeNTMinerAsync(IMinerData client, string ntminerFileName) { UpgradeNTMinerRequest request = new UpgradeNTMinerRequest { NTMinerFileName = ntminerFileName }; RpcRoot.PostAsync <ResponseBase>(client.GetLocalIp(), NTKeyword.NTMinerDaemonPort, _daemonControllerName, nameof(INTMinerDaemonController.UpgradeNTMiner), request, null, timeountMilliseconds: 3000); }
// ReSharper disable once InconsistentNaming public void GetNTMinerUrlAsync(string fileName, Action <string, Exception> callback) { NTMinerUrlRequest request = new NTMinerUrlRequest { FileName = fileName }; RpcRoot.PostAsync(_host, _port, _controllerName, nameof(IFileUrlController.NTMinerUrl), request, callback); }
public void RemoveMineWorkAsync(Guid id, Action <ResponseBase, Exception> callback) { DataRequest <Guid> request = new DataRequest <Guid> { Data = id }; RpcRoot.PostAsync(NTMinerRegistry.GetControlCenterHost(), NTKeyword.ControlCenterPort, _controllerName, nameof(IMineWorkController.RemoveMineWork), request, request, callback); }
public void AddOrUpdatePoolAsync(PoolData entity, Action <ResponseBase, Exception> callback) { DataRequest <PoolData> request = new DataRequest <PoolData> { Data = entity }; RpcRoot.PostAsync(NTMinerRegistry.GetControlCenterHost(), NTKeyword.ControlCenterPort, _controllerName, nameof(IPoolController.AddOrUpdatePool), request, request, callback); }
public void GetServerMessagesAsync(DateTime timestamp, Action <DataResponse <List <ServerMessageData> >, Exception> callback) { ServerMessagesRequest request = new ServerMessagesRequest { Timestamp = Timestamp.GetTimestamp(timestamp) }; RpcRoot.PostAsync(RpcRoot.OfficialServerHost, RpcRoot.OfficialServerPort, _controllerName, nameof(IServerMessageController.ServerMessages), request, callback); }
public void AddOrUpdateNTMinerWalletAsync(NTMinerWalletData entity, Action <ResponseBase, Exception> callback) { DataRequest <NTMinerWalletData> request = new DataRequest <NTMinerWalletData>() { Data = entity }; RpcRoot.PostAsync(_host, _port, _controllerName, nameof(INTMinerWalletController.AddOrUpdateNTMinerWallet), request, request, callback); }
public void AddOrUpdateOverClockDataAsync(OverClockData entity, Action <ResponseBase, Exception> callback) { DataRequest <OverClockData> request = new DataRequest <OverClockData>() { Data = entity }; RpcRoot.PostAsync(_host, _port, _controllerName, nameof(IOverClockDataController.AddOrUpdateOverClockData), request, request, callback); }
public void UpdateClientsAsync(string propertyName, Dictionary <string, object> values, Action <ResponseBase, Exception> callback) { UpdateClientsRequest request = new UpdateClientsRequest { PropertyName = propertyName, Values = values }; RpcRoot.PostAsync(NTMinerRegistry.GetControlCenterHost(), NTKeyword.ControlCenterPort, _controllerName, nameof(IClientController.UpdateClients), request, request, callback); }
public void SetAppSettingsAsync(List <AppSettingData> entities, Action <ResponseBase, Exception> callback) { DataRequest <List <AppSettingData> > request = new DataRequest <List <AppSettingData> >() { Data = entities }; RpcRoot.PostAsync(NTMinerRegistry.GetControlCenterHost(), NTKeyword.ControlCenterPort, _controllerName, nameof(IAppSettingController.SetAppSettings), request, request, callback); }
public void RemoveKernelOutputKeyword(Guid id, Action <ResponseBase, Exception> callback) { DataRequest <Guid> request = new DataRequest <Guid>() { Data = id }; RpcRoot.PostAsync(_host, _port, _controllerName, nameof(IKernelOutputKeywordController.RemoveKernelOutputKeyword), request, request, callback); }
public void AddOrUpdateKernelOutputKeywordAsync(KernelOutputKeywordData entity, Action <ResponseBase, Exception> callback) { DataRequest <KernelOutputKeywordData> request = new DataRequest <KernelOutputKeywordData>() { Data = entity }; RpcRoot.PostAsync(_host, _port, _controllerName, nameof(IKernelOutputKeywordController.AddOrUpdateKernelOutputKeyword), request, request, callback); }
public void MarkDeleteServerMessageAsync(Guid id, Action <ResponseBase, Exception> callback) { DataRequest <Guid> request = new DataRequest <Guid>() { Data = id }; RpcRoot.PostAsync(_host, _port, _controllerName, nameof(IServerMessageController.MarkDeleteServerMessage), request, request, callback); }
public void RefreshClientsAsync(List <string> objectIds, Action <DataResponse <List <ClientData> >, Exception> callback) { MinerIdsRequest request = new MinerIdsRequest() { ObjectIds = objectIds }; RpcRoot.PostAsync(NTMinerRegistry.GetControlCenterHost(), NTKeyword.ControlCenterPort, _controllerName, nameof(IClientController.RefreshClients), request, request, callback); }
public void RemoveUserAsync(string loginName, Action <ResponseBase, Exception> callback) { DataRequest <String> request = new DataRequest <String>() { Data = loginName }; RpcRoot.PostAsync(NTMinerRegistry.GetControlCenterHost(), NTKeyword.ControlCenterPort, _controllerName, nameof(IUserController.RemoveUser), request, request, callback); }
public void UpdateUserAsync(UserData userData, Action <ResponseBase, Exception> callback) { DataRequest <UserData> request = new DataRequest <UserData>() { Data = userData }; RpcRoot.PostAsync(NTMinerRegistry.GetControlCenterHost(), NTKeyword.ControlCenterPort, _controllerName, nameof(IUserController.UpdateUser), request, request, callback); }
public void RemoveNTMinerWalletAsync(Guid id, Action <ResponseBase, Exception> callback) { DataRequest <Guid> request = new DataRequest <Guid>() { Data = id }; RpcRoot.PostAsync(_host, _port, _controllerName, nameof(INTMinerWalletController.RemoveNTMinerWallet), request, request, callback); }
public void AddClientsAsync(List <string> clientIps, Action <ResponseBase, Exception> callback) { AddClientRequest request = new AddClientRequest() { ClientIps = clientIps }; RpcRoot.PostAsync(NTMinerRegistry.GetControlCenterHost(), NTKeyword.ControlCenterPort, _controllerName, nameof(IClientController.AddClients), request, request, callback); }
public void AddOrUpdateMinerGroupAsync(MinerGroupData entity, Action <ResponseBase, Exception> callback) { entity.ModifiedOn = DateTime.Now; DataRequest <MinerGroupData> request = new DataRequest <MinerGroupData> { Data = entity }; RpcRoot.PostAsync(NTMinerRegistry.GetControlCenterHost(), NTKeyword.ControlCenterPort, _controllerName, nameof(IMinerGroupController.AddOrUpdateMinerGroup), request, request, callback); }
public void AddOrUpdateServerMessageAsync(ServerMessageData entity, Action <ResponseBase, Exception> callback) { DataRequest <ServerMessageData> request = new DataRequest <ServerMessageData>() { Data = entity }; RpcRoot.PostAsync(_host, _port, _controllerName, nameof(IServerMessageController.AddOrUpdateServerMessage), request, request, callback); }
public void GetNodeAddressAsync(Guid clientId, string outerUserId, Action <DataResponse <string>, Exception> callback) { var data = new GetNodeAddressRequest { ClientId = clientId, UserId = outerUserId }; RpcRoot.PostAsync(RpcRoot.OfficialServerHost, RpcRoot.OfficialServerPort, _controllerName, nameof(IWsServerNodeController.GetNodeAddress), data, callback, timeountMilliseconds: 8000); }
public void LoginAsync(string loginName, string password, Action <ResponseBase, Exception> callback) { VirtualRoot.SetRpcUser(new User.RpcUser(loginName, password)); SignRequest request = new SignRequest() { }; RpcRoot.PostAsync(NTMinerRegistry.GetControlCenterHost(), NTKeyword.ControlCenterPort, _controllerName, nameof(IControlCenterController.LoginControlCenter), request, request, callback); }
public void GetLatestSnapshotsAsync( int limit, Action <GetCoinSnapshotsResponse, Exception> callback) { GetCoinSnapshotsRequest request = new GetCoinSnapshotsRequest { Limit = limit }; RpcRoot.PostAsync(NTMinerRegistry.GetControlCenterHost(), NTKeyword.ControlCenterPort, _controllerName, nameof(IControlCenterController.LatestSnapshots), request, request, callback); }
public void ExportMineWorkAsync(Guid workId, string localJson, string serverJson, Action <ResponseBase, Exception> callback) { ExportMineWorkRequest request = new ExportMineWorkRequest { MineWorkId = workId, LocalJson = localJson, ServerJson = serverJson }; RpcRoot.PostAsync(NTMinerRegistry.GetControlCenterHost(), NTKeyword.ControlCenterPort, _controllerName, nameof(IMineWorkController.ExportMineWork), request, request, callback); }
public void GetJsonFileVersionAsync(string key, Action <ServerStateResponse> callback) { AppSettingRequest request = new AppSettingRequest { Key = key }; RpcRoot.PostAsync(RpcRoot.OfficialServerHost, RpcRoot.OfficialServerPort, _controllerName, nameof(IAppSettingController.GetJsonFileVersion), request, (string line, Exception e) => { callback?.Invoke(ServerStateResponse.FromLine(line)); }, timeountMilliseconds: 10 * 1000); }
// ReSharper disable once InconsistentNaming public void GetNTMinerFilesAsync(NTMinerAppType appType, Action <List <NTMinerFileData>, Exception> callback) { RpcRoot.PostAsync(_host, _port, _controllerName, nameof(IFileUrlController.NTMinerFiles), callback: (List <NTMinerFileData> data, Exception e) => { if (data != null) { data = data.Where(a => a.AppType == appType).ToList(); } callback?.Invoke(data, e); }); }