示例#1
0
        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);
    }
示例#3
0
        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);
                }
            }
        }
示例#4
0
文件: User.cs 项目: mpvyard/InsideMMA
 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);
     }
 }
示例#5
0
        public TypeMap getConnectionProperties(ConnectionID connID)
        {
            TypeMap properties = null;

            connectionProperties.TryGetValue(connID, out properties);
            return(properties);
        }
示例#6
0
        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);
        }
示例#7
0
 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));
     }
 }
示例#8
0
 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;
 }
示例#9
0
        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);
            }
        }
示例#10
0
 private void Network_NetworkStatusChangeEvent(ConnectionID socket, NetworkManager.Status wError)
 {
     /*if (socket == NetworkManager.ConnectionFlag.Game &&
      *  wError != NetworkManager.Status.Connected)
      * {
      *  PushTableEvent(TableEvents.GAME_LOST, 0, null);
      * }*/
 }
示例#11
0
 public bool Equals(PublisherRouter pRouter)
 {
     return(
         this == pRouter || (
             ConnectionID.Equals(pRouter.ConnectionID)
             )
         );
 }
示例#12
0
 void Network_NetworkStatusChangeEvent(ConnectionID socket, NetworkManager.Status wError)
 {
     if (socket == ConnectionID.Game)
     {
         //主动推送心跳避免没发送消息之前被服务器断开连接
         SendToHallSvr(MainCommand.MDM_KN_COMMAND, SubCommand.SUB_KN_DETECT_SOCKET, 0, null);
     }
 }
示例#13
0
 public void setConnectionProperties(ConnectionID connID, TypeMap map)
 {
     if (connectionProperties.ContainsKey(connID))
     {
         connectionProperties.Remove(connID);
     }
     connectionProperties.Add(connID, map);
 }
示例#14
0
        public void UnRegisterHandler(ConnectionID flag, uint cmd, Action <Packet> handler)
        {
            var connect = GetConnect(flag);

            if (connect != null)
            {
                connect.UnRegisterHandler(cmd, handler);
            }
        }
示例#15
0
        public void CloseConnect(ConnectionID flag)
        {
            var connect = GetConnect(flag);

            if (connect == null)
            {
                return;
            }
            connect.Close();
        }
示例#16
0
        public bool IsConnectionActive(ConnectionID flag)
        {
            var connect = GetConnect(flag);

            if (connect == null)
            {
                return(false);
            }
            return(connect.CheckAlive());
        }
示例#17
0
        public bool IsConnectionVaild(ConnectionID flag)
        {
            var connect = GetConnect(flag);

            if (connect == null)
            {
                return(false);
            }
            return(connect.CheckSocketConnected());
        }
示例#18
0
 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;
     }
 }
示例#19
0
        public void SendToSvr(ConnectionID flag, byte[] wBbyteBuffer, int len)
        {
            var connect = GetConnect(flag);

            if (connect == null)
            {
                return;
            }
            connect.SendData(wBbyteBuffer, len);
        }
示例#20
0
        private Connection GetConnect(ConnectionID flag)
        {
            var index = (int)flag;

            if (index >= _connections.Length)
            {
                return(null);
            }

            return(_connections[index]);
        }
示例#21
0
        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);
        }
示例#22
0
        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;
            }
            }
        }
示例#23
0
        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);
        }
示例#24
0
        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);
        }
示例#25
0
        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();
            }
        }
示例#26
0
        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);
        }
示例#27
0
        /// <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");
                }
            }
        }
示例#28
0
        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);
        }
示例#29
0
        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);
        }
示例#30
0
        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);
        }