void Network_NetworkStatusChangeEvent(ConnectionID socket, NetworkManager.Status wError) { if (socket == ConnectionID.Game) { if (wError == NetworkManager.Status.Connected) { ClearPlayers(); //连接成功后登陆游戏服 var item = GameApp.GameListMgr.FindRoomItem(GameApp.GameData.EnterRoomID); if (item == null) { return; } uint uid = GameApp.GameData.UserInfo.UserID; string pwd = GameApp.GameData.Password; string mac = GameApp.GameData.MAC; GameApp.GameSrv.SendLoginGameSvr(item.GameNameID, uid, pwd, mac); } else { GameApp.GameData.UserInfo.SetSitInfo(CommonDefine.INVALID_TABLE, CommonDefine.INVALID_CHAIR); } } }
// checks if the "to be fit" tile fits on this tile public bool CanConnect(GenerationTile other) { string name = this.transform.name; string name1 = other.transform.name; ConnectionID idThis = this.connectionID.GetExit().id; ConnectionID idOther = other.GetConnectionId().GetEntry().id; List <ConnectionVariations> cVarThis = GetSignature(idThis.connectionID); List <ConnectionVariations> cVarOther = GetSignature(idOther.connectionID); bool idsMatch = (cVarThis.Count == cVarThis.Count); if (!idsMatch) { return(false); } for (int i = 0; i < cVarThis.Count; i++) { if (cVarThis[i] != cVarOther[i]) { return(false); } } return(true); }
private void NetworkStatusChangeEvent(ConnectionID socket, NetworkManager.Status wError) { if (wError != NetworkManager.Status.Connected) { GameApp.GameMgr.DestoryGame(true); if (bShowSocketTips == false) { return; } if (socket == ConnectionID.Lobby) { HallTransfer.Instance.cnCloseWebpage(); GameApp.PopupMgr.Confirm("提示", "为了您的账户安全,请重新登录!", delegate(MessageBoxResult style) { GameApp.GetInstance().SwitchAccount(); }, 15); } else { HallTransfer.Instance.cnCloseWebpage(); GameApp.PopupMgr.Confirm("提示", wError == NetworkManager.Status.TimeOut ? "连接超时,请重试!" : "与游戏服务器断开连接,请重试!", delegate(MessageBoxResult style) { GameApp.GetInstance().SwitchAccount(); }, 15); } } }
public override int GetHashCode() { unchecked { var hashCode = _totalBalance.GetHashCode(); hashCode = (hashCode * 397) ^ AutoSleep.GetHashCode(); hashCode = (hashCode * 397) ^ SleepThreshold.GetHashCode(); hashCode = (hashCode * 397) ^ (Login != null ? Login.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Password != null ? Password.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Role != null ? Role.GetHashCode() : 0); hashCode = (hashCode * 397) ^ LicenseExpDate.GetHashCode(); hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ConnectionID != null ? ConnectionID.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Sleep != null ? Sleep.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Alerts.GetHashCode(); hashCode = (hashCode * 397) ^ AllTrades.GetHashCode(); hashCode = (hashCode * 397) ^ AllTradesPro.GetHashCode(); hashCode = (hashCode * 397) ^ Chart.GetHashCode(); hashCode = (hashCode * 397) ^ Counter.GetHashCode(); hashCode = (hashCode * 397) ^ L2.GetHashCode(); hashCode = (hashCode * 397) ^ Logbook.GetHashCode(); hashCode = (hashCode * 397) ^ Trading.GetHashCode(); hashCode = (hashCode * 397) ^ FastOrder.GetHashCode(); hashCode = (hashCode * 397) ^ (Email != null ? Email.GetHashCode() : 0); hashCode = (hashCode * 397) ^ SleepThreshold.GetHashCode(); hashCode = (hashCode * 397) ^ ProfitControl.GetHashCode(); hashCode = (hashCode * 397) ^ ProfitLimit.GetHashCode(); hashCode = (hashCode * 397) ^ ProfitLossLimit.GetHashCode(); return(hashCode); } }
public TypeMap getConnectionProperties(ConnectionID connID) { TypeMap properties = null; connectionProperties.TryGetValue(connID, out properties); return(properties); }
public Port getServicePort(ComponentID user, string usedPortName) { string portType; if (usesPortTypes.TryGetValue(usedPortName, out portType)) { Port singleton_service_port = null; ServiceProvider service_provider = null; if (usedPortName.EndsWith(Constants.REGISTRY_PORT_NAME)) { return(this); } else if (this.provided_service_table.TryGetValue(portType, out service_provider)) { string providedPortName = service_provider.createService(portType); ConnectionID conn = frw_builder.connect(user, usedPortName, frw_services.getComponentID(), providedPortName); return(getPortProceed(usedPortName)); } else if (this.singleton_provided_port_table.TryGetValue(portType, out singleton_service_port)) { return(singleton_service_port); } } return(null); }
private void HandleNetworkStatusChangeEvent(ConnectionID socket, NetworkManager.Status wError) { if (socket == ConnectionID.Game) { GameApp.PopupMgr.HideTips(); if (wError != NetworkManager.Status.Connected) { if (retryTimes >= GlobalConst.Game.ReconnectTimes || !GameApp.GameMgr.IsInGame()) { //TODO 提示无法连接 StartCoroutine(Quit(false)); } else { //TODO 提示重连 retryTimes++; StartCoroutine(Reconnect()); } } } else { StartCoroutine(Quit(true)); } }
public GenerationConnectionID(CardinalDirections entry, CardinalDirections exit, ConnectionID enID, ConnectionID exID) { this.entry.dir = entry; this.entry.id = enID; this.exit.dir = exit; this.exit.id = exID; }
public void disconnect(ConnectionID connID, float timeout) { Console.WriteLine("WORKER OBJECT - disconnecting ..."); WorkerConnectionID hpeconnID = (WorkerConnectionID)connID; string user_port_name = connID.getUser().getInstanceName() + ":" + connID.getUserPortName(); string provider_port_name = connID.getProvider().getInstanceName() + ":" + connID.getProviderPortName(); if (!port_manager.isReleased(user_port_name)) { Console.WriteLine(": DISCONNECT - EXCEPTION RELEASE PORT - " + user_port_name); throw new CCAExceptionImpl(CCAExceptionType.UsesPortNotReleased); } if (!connectionList.ContainsKey(connID.ToString())) { throw new CCAExceptionImpl(CCAExceptionType.PortNotConnected); } connectionList.Remove(connID.ToString()); Console.WriteLine(": disconnecting " + user_port_name + " from " + provider_port_name); connByUserPort.Remove(user_port_name); connByProviderPort.Remove(provider_port_name); if (connectionProperties.ContainsKey(connID)) { connectionProperties.Remove(connID); } }
private void Network_NetworkStatusChangeEvent(ConnectionID socket, NetworkManager.Status wError) { /*if (socket == NetworkManager.ConnectionFlag.Game && * wError != NetworkManager.Status.Connected) * { * PushTableEvent(TableEvents.GAME_LOST, 0, null); * }*/ }
public bool Equals(PublisherRouter pRouter) { return( this == pRouter || ( ConnectionID.Equals(pRouter.ConnectionID) ) ); }
void Network_NetworkStatusChangeEvent(ConnectionID socket, NetworkManager.Status wError) { if (socket == ConnectionID.Game) { //主动推送心跳避免没发送消息之前被服务器断开连接 SendToHallSvr(MainCommand.MDM_KN_COMMAND, SubCommand.SUB_KN_DETECT_SOCKET, 0, null); } }
public void setConnectionProperties(ConnectionID connID, TypeMap map) { if (connectionProperties.ContainsKey(connID)) { connectionProperties.Remove(connID); } connectionProperties.Add(connID, map); }
public void UnRegisterHandler(ConnectionID flag, uint cmd, Action <Packet> handler) { var connect = GetConnect(flag); if (connect != null) { connect.UnRegisterHandler(cmd, handler); } }
public void CloseConnect(ConnectionID flag) { var connect = GetConnect(flag); if (connect == null) { return; } connect.Close(); }
public bool IsConnectionActive(ConnectionID flag) { var connect = GetConnect(flag); if (connect == null) { return(false); } return(connect.CheckAlive()); }
public bool IsConnectionVaild(ConnectionID flag) { var connect = GetConnect(flag); if (connect == null) { return(false); } return(connect.CheckSocketConnected()); }
private void OnConnect(uint connimeOut) { Connect.OnReceivedEx += Connect_OnReceivedEx; Connect.OnPublish += Connect_OnPublish; Connect.Create(App.Current.GetType().ToString() + ConnectionID.ToString()); if (Connect.Connect((int)connimeOut) == 0) { ConnectionStatus = true; } }
public void SendToSvr(ConnectionID flag, byte[] wBbyteBuffer, int len) { var connect = GetConnect(flag); if (connect == null) { return; } connect.SendData(wBbyteBuffer, len); }
private Connection GetConnect(ConnectionID flag) { var index = (int)flag; if (index >= _connections.Length) { return(null); } return(_connections[index]); }
public void SendToSvr(ConnectionID flag, uint wMainCmdID, uint wSubCmdID, int whandleCode, byte[] wBbyteBuffer) { // Logger.Net.Log("send data to hall server. MainCmd:" + wMainCmdID + " SubCmd:" + wSubCmdID); var connect = GetConnect(flag); if (connect == null) { return; } connect.SendData(wMainCmdID, wSubCmdID, whandleCode, wBbyteBuffer); }
void HandleNetworkStatusChangeEvent(ConnectionID socket, NetworkManager.Status wError) { Logger.UI.Log("network status changed. Socket:" + socket + " Status:" + wError); GameApp.PopupMgr.HideTips(); if (!bShowSocketTips) { return; } switch (wError) { case NetworkManager.Status.Connected: { nConnectCount = 0; LoginTransfer.Instance.cnNetworkError((int)wError); if (bLoginAfterConnected) { bLoginAfterConnected = false; NcLoginBtnClick(GameApp.GameData.Account, GameApp.GameData.Password, true); } else { Invoke("Disconnect", GlobalConst.Base.LoginTimeOut); } break; } case NetworkManager.Status.Disconnected: case NetworkManager.Status.TimeOut: { if (nConnectCount >= GlobalConst.Game.ReconnectTimes) { nConnectCount = 0; GameApp.PopupMgr.Confirm("提示", "与服务器连接失败,请检查网络后重试!", delegate(MessageBoxResult result) { LoginTransfer.Instance.cnNetworkError(3); }, 999f); } else { StartCoroutine(Reconnect()); } break; } } }
public override bool ToSQL(string tablename, Guid executionID, StringBuilder sb, bool firstItem) { try { Int64 elapsed = 0; // Convert.ToInt64(ResponseTimestamp.Subtract(RequestTimestamp).TotalMilliseconds); if (!firstItem) { sb.Append(","); } // (FDAExecutionID, connectionID, DeviceAddress, Attempt, TimestampUTC1, TimestampUTC2, ElapsedPeriod, TransCode, TransStatus, ApplicationMessage,DBRGUID,DBRGIdx,DBRGSize,Details01,TxSize,Details02,RxSize,ProtocolNote,Protocol) values "); sb.Append("('"); sb.Append(executionID); sb.Append("','"); sb.Append(ConnectionID.ToString()); sb.Append("','"); sb.Append(DeviceAddress); sb.Append("',"); sb.Append(AttemptNum); sb.Append(",'"); sb.Append(DateTimeHelpers.FormatDateTime(EventTime)); sb.Append("','"); sb.Append(DateTimeHelpers.FormatDateTime(EventTime)); sb.Append("',"); sb.Append(elapsed); sb.Append(","); sb.Append(EventType); sb.Append(",CAST(1 as bit),"); sb.Append("'','"); // app message sb.Append(GroupID); sb.Append("','"); sb.Append(GroupIdx); sb.Append("',"); sb.Append(GroupSize); sb.Append(",'Tx: "); sb.Append(BitConverter.ToString(AckBytes)); sb.Append("',"); sb.Append(AckBytes.Length); sb.Append(",'N/A',0,'"); sb.Append(ProtocolNote); sb.Append("','"); sb.Append(Protocol); sb.Append("')"); } catch (Exception ex) { Globals.SystemManager.LogApplicationError(Globals.FDANow(), ex, "Error occurred while adding a comms log comms transaction item to an SQL insert batch"); return(false); } return(true); }
public void Connect(ConnectionID flag, string wConnectIp, uint wConnectPort) { var connect = GetConnect(flag); if (connect == null) { return; } connect.Reset(); connect.StartConnect(wConnectIp, wConnectPort); Logger.Net.Log("connect to server, ip:" + wConnectIp + " Port:" + wConnectPort); }
private void HandleNetworkStatusChangeEvent(ConnectionID socket, NetworkManager.Status wError) { if (wError == NetworkManager.Status.Connected) { patching = true; startTime = Time.realtimeSinceStartup; // ShowStatus("获取远程版本"); GameApp.Account.ReqGetVersionInfo(); } else { startTime = 0.0f; patching = false; HideStatus(); } }
private bool addConnByProviderPort(string portName, ConnectionID connection) { IList <ConnectionID> listConn; bool first_connection = true; if (!connByProviderPort.TryGetValue(portName, out listConn)) { listConn = new List <ConnectionID>(); connByProviderPort.Add(portName, listConn); } else { first_connection = false; } listConn.Add(connection); return(first_connection); }
/// <summary> /// override this function with your specific driver config check /// throw an exception if the config is not valid /// </summary> /// <param name="IOName">IO name</param> /// <param name="ConnectionID">the connection id</param> public override void CheckIOConfig(List <string> ConnectionIDs) { if (ConnectionIDs.Count != 1) { throw new Exception("only one connection ID is allowed"); } foreach (var ConnectionID in ConnectionIDs) { string[] split = ConnectionID.Split(':'); string IpAddress = split[0]; int projectID = System.Convert.ToInt16(split[1]); int firmwareVersion = System.Convert.ToInt16(split[2]); int switchID = System.Convert.ToInt16(split[3]); int designID = System.Convert.ToInt16(split[4]); if (!XAMIO.Common.IPAddressExtensions.IsValidIP(IpAddress)) { throw new Exception("Invalid connectionID <" + ConnectionID + ">- it has to be a valid ip address"); } } }
public ConnectionID[] getConnectionIDs(ComponentID[] componentList) { IList <ComponentID> componentListList = new List <ComponentID>(componentList); IList <ConnectionID> connectionsFilter = new List <ConnectionID>(); foreach (ConnectionID conn in connectionList.Values) { ComponentID user = conn.getUser(); ComponentID provider = conn.getProvider(); if (componentListList.Contains(user) || componentListList.Contains(provider)) { connectionsFilter.Add(conn); } } ConnectionID[] connectionArray = new ConnectionID[connectionsFilter.Count]; connectionsFilter.CopyTo(connectionArray, 0); return(connectionArray); }
public override bool ToSQL(string tablename, Guid executionID, StringBuilder sb, bool firstItem) { // (FDAExecutionID, connectionID, DeviceAddress, Attempt, TimestampUTC1, TimestampUTC2, ElapsedPeriod, TransCode, TransStatus, ApplicationMessage,DBRGUID,DBRGIdx,DBRGSize,Details01,TxSize,Details02,RxSize,ProtocolNote,Protocol) values "); try { DateTime endTime = StartTime.Add(Elapsed); if (!firstItem) { sb.Append(","); } sb.Append("('"); sb.Append(executionID); sb.Append("','"); sb.Append(ConnectionID.ToString()); sb.Append("','',"); sb.Append(Attempt); sb.Append(",'"); sb.Append(DateTimeHelpers.FormatDateTime(StartTime)); sb.Append("','"); sb.Append(DateTimeHelpers.FormatDateTime(endTime)); sb.Append("',"); sb.Append(Elapsed.TotalMilliseconds); sb.Append(","); sb.Append(EventType); sb.Append(","); sb.Append("cast(" + Status + " as bit)"); sb.Append(",'"); sb.Append(Message.Replace("'", "''")); sb.Append("','00000000-0000-0000-0000-000000000000','0',0,'N/A',0,'N/A',0,'N/A','N/A')"); } catch (Exception ex) { Globals.SystemManager.LogApplicationError(Globals.FDANow(), ex, "Error occurred while adding a comms log connection event to an SQL insert batch"); return(false); } return(true); }
public override bool ToSQL(string tablename, Guid executionID, StringBuilder sb, bool firstItem) { // generate the SQL for inserting this log item into the database (will be appended to a larger query for inserting several records in a single query) // the entire insert query looks like this: // Insert into CommsLog (FDAExecutionID, connectionID, DeviceAddress, Attempt, TimestampUTC1, TimestampUTC2, ElapsedPeriod, TransCode, TransStatus, ApplicationMessage,DBRGUID,DBRGIdx,DBRGSize,Details01,TxSize,Details02,RxSize,ProtocolNote,Protocol) values ") // values (log item 1),(log item 2), etc... try { string timestampStr = DateTimeHelpers.FormatDateTime(Timestamp); if (!firstItem) { sb.Append(","); } sb.Append("('"); sb.Append(executionID); sb.Append("','"); sb.Append(ConnectionID.ToString()); sb.Append("','',0,'"); sb.Append(timestampStr); sb.Append("','"); sb.Append(timestampStr); sb.Append("',0,"); sb.Append(EventType); sb.Append(",cast(1 as bit),'"); sb.Append(Message.Replace("'", "''")); sb.Append("','00000000-0000-0000-0000-000000000000','0',0,'N/A',0,'N/A',0,'N/A','N/A')"); } catch (Exception ex) { Globals.SystemManager.LogApplicationError(Globals.FDANow(), ex, "Error occurred while adding a comms log comms event item to an SQL insert batch"); return(false); } return(true); }