Beispiel #1
0
        public void OnCondBroadcastMessage(Message msg)
        {
            switch (msg.Header.CommandValue)
            {
            case LOGMSGID:
            {
                MessageV2ReaderHelper reader     = new MessageV2ReaderHelper(msg);
                UserPolicyData        policyData = new UserPolicyData(reader);
                if (!policyData.RemoveSelf)
                {
                    UpdateUserOnlineInfo(policyData.UserID);
                }
                else
                {
                    lock (_lockObj)
                    {
                        DateTime lastActiveTime;
                        if (_onlineUserMap.TryGetValue(policyData.UserID, out lastActiveTime))
                        {
                            _onlineUserMap.Remove(policyData.UserID);
                        }
                    }
                }
                _UIControl.SyncUpdatePolicyList(ref policyData);
                break;
            }

            case CHANGESERVERMSGID:
            {
                MessageV2ReaderHelper reader = new MessageV2ReaderHelper(msg);
                string userID = reader.ReadStr();
                if (userID.Equals(_userID, StringComparison.OrdinalIgnoreCase))
                {
                    _UIControl.ChangeServerIP();
                }
                break;
            }

            case CHANGEPOLICYMSGID:
            {
                MessageV2ReaderHelper reader = new MessageV2ReaderHelper(msg);
                string         adminUserID   = reader.ReadStr();
                UserPolicyData policyData    = new UserPolicyData(reader);
                if (policyData.UserID.Equals(_userID, StringComparison.OrdinalIgnoreCase))
                {
                    _UIControl.AsyncUpdatePolicy(adminUserID, ref policyData);
                }
                break;
            }

            default:
            {
                break;
            }
            }
        }
Beispiel #2
0
 public UserPolicyData(MessageV2ReaderHelper reader)
 {
     try
     {
         UserID           = reader.ReadStr();
         OfferTime        = reader.ReadDouble();
         PriceMarkup      = reader.ReadStr();
         Submit400        = reader.ReadDouble();
         Submit500        = reader.ReadDouble();
         SubmitForce      = reader.ReadDouble();
         ServerIP         = reader.ReadStr();
         RemoveSelf       = reader.ReadBool();
         CanRemoteControl = reader.ReadBool();
     }
     catch (Exception e)
     {
         StringBuilder sb = new StringBuilder();
         sb.Append("UserPolicyData反序列化失败,").Append(e.Message);
         Console.WriteLine(sb.ToString());
     }
 }