private void ServerLogic() { IsRunning = true; while (IsRunning) { ServerTick(); ProcessCommands(); string broadCastData = new ServerStateResponse() { GameObjects = GameObjects.Values, RemovedObjects = CurrentTickRemovedObjects } .ToJson(); Host.Sessions.Broadcast(broadCastData); if (CurrentTickRemovedObjects.Any()) { CurrentTickRemovedObjects.Clear(); } TicksCount++; Console.Title = $"Objects {GameObjects.Count} Ticks:{TicksCount}"; } }
public static ReportResponse Ok(ServerStateResponse serverState) { return(new ReportResponse() { StateCode = 200, ReasonPhrase = "Ok", Description = "成功", ServerState = serverState }); }
public void GetJsonFileVersionAsync(string key, Action <ServerStateResponse> callback) { AppSettingRequest request = new AppSettingRequest { Key = key }; JsonRpcRoot.PostAsync(RpcRoot.OfficialServerHost, RpcRoot.OfficialServerPort, _controllerName, nameof(IAppSettingController.GetJsonFileVersion), request, (string line, Exception e) => { callback?.Invoke(ServerStateResponse.FromLine(line)); }, timeountMilliseconds: 10 * 1000); }
public ICrewChiefResponse HandleRequest(ICrewChiefRequest request) { ICrewChiefServerStateResponse response = new ServerStateResponse(); try { response.ServerState = "true";// iRacingSDKConnection.IsConnected; } catch (Exception ex) { response.IsSuccess = false; response.ErrorMessage = ex.Message; response.ResponseData = ex.ToString(); } return(response); }
public ServerStateResponse GetServerState([FromBody] JsonFileVersionRequest request) { ServerStateResponse serverState = ServerStateResponse.Empty; if (request != null) { serverState = AppRoot.GetServerStateResponse(request.Key); if (request.ClientId != Guid.Empty) { var clientData = AppRoot.ClientDataSet.GetByClientId(request.ClientId); if (clientData != null && !string.IsNullOrEmpty(clientData.MACAddress)) { serverState.NeedReClientId = request.MACAddress.All(a => !clientData.MACAddress.Contains(a)); //NTMinerConsole.UserWarn($"重复的网卡地址:{string.Join(",", request.MACAddress)}"); } } } return(serverState); }
public string GetJsonFileVersion([FromBody] AppSettingRequest request) { ServerStateResponse serverState = WebApiRoot.GetServerStateResponse(request.Key); return(serverState.ToLine()); }