/// <inheritdoc/> public void OnPeerDisconnected(NetPeer peer, DisconnectInfo disconnectInfo) { if (disconnectInfo.AdditionalData.TryGetByte(out byte rejectType)) { RejectType type = (RejectType)rejectType; switch (type) { case RejectType.InvalidToken: Logger.Info($"[Connection rejected] Server sended token which not exists on host! (Contact owner of host)"); break; case RejectType.OutdatedVersion: if (disconnectInfo.AdditionalData.TryGetString(out string newerVersion) && !isDownloading) { Logger.Info($"[Connection rejected] Server uses older version of NetworkedPlugins (Current: {NPVersion.Version.ToString(3)}, Newer: {newerVersion})"); DownloadNewVersion(newerVersion); } break; } } else { Logger.Info($"[Disconnected] Reason \"{disconnectInfo.Reason}\"."); } foreach (var addon in Commands) { UnregisterCommandsFromAddon(addon.Key); } Commands.Clear(); InstalledAddons.Clear(); foreach (var player in Players.Values) { player.NetworkData.IsConnected = false; } Timing.RunCoroutine(Reconnect()); }
private FlowNodeEntity GetNextNodeId(string workId, ApprovalStatus approvalStatus, ref FlowLineEntity flowLineEntity, RejectType rejectType = RejectType.Last) { try { FlowNodeEntity nextNode = new FlowNodeEntity(); using (var db = new RepositoryBase()) { WorkEntity workEntity = db.FindEntity <WorkEntity>(m => m.Id == workId); if (workEntity != null && !string.IsNullOrEmpty(workEntity.Id)) { if (approvalStatus == ApprovalStatus.Pass) { if (string.IsNullOrEmpty(workEntity.CurrentNodeId)) { FlowNodeEntity flowNodeEntity = db.FindEntity <FlowNodeEntity>(m => m.IsStartNode == true && m.FlowVersionId == workEntity.FlowVersionId); if (flowNodeEntity != null && !string.IsNullOrEmpty(flowNodeEntity.Id)) { workEntity.CurrentNodeId = flowNodeEntity.Id; } } nextNode = GetNextNodeIdPass(workId, workEntity.CurrentNodeId, workEntity.FlowVersionId, ref flowLineEntity); } else if (approvalStatus == ApprovalStatus.Fail) { if (!string.IsNullOrEmpty(workEntity.CurrentNodeId)) { FlowNodeEntity flowNodeEntity = db.FindEntity <FlowNodeEntity>(m => m.Id == workEntity.CurrentNodeId); if (flowNodeEntity != null && !string.IsNullOrEmpty(flowNodeEntity.Id)) { switch (flowNodeEntity.RejectType) { case (int)RejectType.Reviewer: FlowNodeEntity startflowNodeEntity = db.FindEntity <FlowNodeEntity>(m => m.IsStartNode == true && m.FlowVersionId == workEntity.FlowVersionId); if (flowNodeEntity != null && !string.IsNullOrEmpty(flowNodeEntity.Id)) { workEntity.CurrentNodeId = flowNodeEntity.Id; } nextNode = GetNextNodeIdPass(workId, workEntity.CurrentNodeId, workEntity.FlowVersionId, ref flowLineEntity); break; case (int)RejectType.Last: nextNode = GetNextNodeIdFail(workId, workEntity.CurrentNodeId, workEntity.FlowVersionId, ref flowLineEntity); break; case (int)RejectType.Specified: break; default: throw new Exception("当前节点驳回配置异常!"); } } } else { throw new Exception("当前节点异常!"); } } } } return(nextNode); } catch (Exception ex) { throw ex; } }
private FlowNodeEntity GetNextNodeId(string workId, ApprovalStatus approvalStatus, RejectType rejectType = RejectType.Last) { try { FlowNodeEntity nextNode = new FlowNodeEntity(); using (var db = new RepositoryBase()) { WorkEntity workEntity = db.FindEntity <WorkEntity>(m => m.Id == workId); if (workEntity != null && !string.IsNullOrEmpty(workEntity.Id)) { if (approvalStatus == ApprovalStatus.Pass) { if (string.IsNullOrEmpty(workEntity.CurrentNodeId)) { FlowNodeEntity flowNodeEntity = db.FindEntity <FlowNodeEntity>(m => m.IsStartNode == true && m.FlowVersionId == workEntity.FlowVersionId); if (flowNodeEntity != null && !string.IsNullOrEmpty(flowNodeEntity.Id)) { workEntity.CurrentNodeId = flowNodeEntity.Id; } } nextNode = GetNextNodeIdPass(workId, workEntity.CurrentNodeId, workEntity.FlowVersionId); } } } return(nextNode); } catch (Exception ex) { throw ex; } }