Esempio n. 1
0
        public virtual void Deserialize(byte[] data, Pointer p)
        {
            int numScripts = BitPacker.GetInt(data, p);

            for (int i = 0; i < numScripts; i++)
            {
                uint scriptId = BitPacker.GetUInt(data, p);
                Scripts.AttachScript(scriptId);
            }

            int numEffects = BitPacker.GetInt(data, p);

            for (int i = 0; i < numEffects; i++)
            {
                uint   effectId = BitPacker.GetUInt(data, p);
                Effect e        = Effect.GetEffect(effectId);

                if (e != null)
                {
                    e.Deserialize(data, p);
                }

                Effects.AttachEffect(this, null, effectId);
            }

            PhysicalState.Position.X = BitPacker.GetDouble(data, p);
            PhysicalState.Position.Y = BitPacker.GetDouble(data, p);
            PhysicalState.Position.Z = BitPacker.GetDouble(data, p);

            PhysicalState.Rotation.X = BitPacker.GetDouble(data, p);
            PhysicalState.Rotation.Y = BitPacker.GetDouble(data, p);
            PhysicalState.Rotation.Z = BitPacker.GetDouble(data, p);
        }
Esempio n. 2
0
 public override void Deserialize(byte[] data, Pointer p)
 {
     base.Deserialize(data, p);
     PhaseID      = BitPacker.GetInt(data, p);
     PhaseName    = BitPacker.GetString(data, p);
     ResponseTime = BitPacker.GetLong(data, p);
 }
Esempio n. 3
0
 public virtual void Deserialize(byte[] data, Pointer p, bool includeSubComponents)
 {
     if (!includeSubComponents)
     {
         return;
     }
     lock (m_Components)
     {
         int count = BitPacker.GetInt(data, p);
         for (int i = 0; i < count; i++)
         {
             uint       typeHash = BitPacker.GetUInt(data, p);
             IComponent wisp     = Factory.Instance.CreateObject(typeHash) as IComponent;
             if (wisp == null)
             {
                 throw new ArgumentException("Error deserializing wisp object.  Did you remember to register the Wisp Object's ISerializableWispObject.TypeHash with the Factory? Try: |> Factory.Instance.Register(typeof(YourCharacterComponentClassName), () => { return new YourCharacterComponentClassName(); });|");
             }
             if (wisp is IComponent)
             {
                 AddComponent(wisp as IComponent);
             }
             wisp.Deserialize(data, p, includeSubComponents);
         }
     }
 }
Esempio n. 4
0
        public override bool DeSerialize(byte[] data, Pointer p)
        {
            base.DeSerialize(data, p);

            GameMessageKind = BitPacker.GetInt(data, p);
            return(true);
        }
Esempio n. 5
0
        public override bool DeSerialize(byte[] data, Pointer p)
        {
            base.DeSerialize(data, p);
            IsRefresh      = BitPacker.GetBool(data, p);
            IsServerPacket = BitPacker.GetBool(data, p);
            int num = BitPacker.GetInt(data, p);

            for (int i = 0; i < num; i++)
            {
                if (!IsRefresh)
                {
                    MatchNotificationType kind = (MatchNotificationType)BitPacker.GetInt(data, p);
                    Kinds.Add(kind);
                }

                Game theGame = BitPacker.GetComponent(data, p, IsServerPacket) as Game;

                TheGames.Add(theGame);
                bool hasTargetPlayer = BitPacker.GetBool(data, p);
                if (!IsRefresh && hasTargetPlayer)
                {
                    TargetPlayers.Add(BitPacker.GetComponent(data, p, false) as ICharacterInfo);
                }
            }
            return(true);
        }
Esempio n. 6
0
 public override void Deserialize(byte[] data, Pointer p, bool includeComponents)
 {
     Properties = BitPacker.GetPropertyBag(data, p);
     Stats      = BitPacker.GetStatBag(data, p);
     ID         = BitPacker.GetInt(data, p);
     base.Deserialize(data, p, includeComponents);
 }
Esempio n. 7
0
        public override void Deserialize(byte[] data, Pointer p)
        {
            GamesPlayed             = BitPacker.GetInt(data, p);
            RatingMean              = BitPacker.GetDouble(data, p);
            RatingStandardDeviation = BitPacker.GetDouble(data, p);

            base.Deserialize(data, p);
        }
Esempio n. 8
0
        public void Deserialize(byte[] data, Pointer p)
        {
            LastLogin          = new DateTime(BitPacker.GetLong(data, p), DateTimeKind.Utc);
            UserSince          = new DateTime(BitPacker.GetLong(data, p), DateTimeKind.Utc);
            LastPasswordChange = new DateTime(BitPacker.GetLong(data, p), DateTimeKind.Utc);

            ID = new Guid(BitPacker.GetString(data, p));

            Email    = BitPacker.GetString(data, p);
            Username = BitPacker.GetString(data, p);

            IsLocked   = BitPacker.GetBool(data, p);
            IsOnline   = BitPacker.GetBool(data, p);
            IsApproved = BitPacker.GetBool(data, p);

            Roles = BitPacker.GetStringList(data, p);

            int notes = BitPacker.GetInt(data, p);

            for (int i = 0; i < notes; i++)
            {
                ServiceLogEntry sle = new ServiceLogEntry();
                sle.Account      = ID;
                sle.EntryBy      = BitPacker.GetString(data, p);
                sle.Note         = BitPacker.GetString(data, p);
                sle.EntryType    = BitPacker.GetString(data, p);
                sle.CharacterId  = BitPacker.GetInt(data, p);
                sle.TimeStampUTC = new DateTime(BitPacker.GetLong(data, p), DateTimeKind.Utc);
                ServiceNotes.Add(sle);
            }

            AddedProperties = BitPacker.GetPropertyBag(data, p);

            int numSessions = BitPacker.GetInt(data, p);

            for (int i = 0; i < numSessions; i++)
            {
                DateTime login  = new DateTime(BitPacker.GetLong(data, p), DateTimeKind.Utc);
                DateTime logout = new DateTime(BitPacker.GetLong(data, p), DateTimeKind.Utc);
                string   ip     = BitPacker.GetString(data, p);
                ip = ip.Substring(0, ip.LastIndexOf("]") + 1);
                AccountProfile.Session s = new AccountProfile.Session(login, logout, ip);
                LoginSessions.Add(s);
            }

            //LoginSessions = LoginSessions.OrderBy(session => session.LogoutUTC).ToList();
            LoginSessions.Reverse();
            CurrentLoginTime = new DateTime(BitPacker.GetLong(data, p), DateTimeKind.Utc);

            int characters = BitPacker.GetInt(data, p);

            for (int i = 0; i < characters; i++)
            {
                ICharacterInfo ci = BitPacker.GetComponent(data, p) as ICharacterInfo;
                Characters.Add(ci);
            }
        }
Esempio n. 9
0
 public override bool DeSerialize(byte[] data, Pointer p)
 {
     base.DeSerialize(data, p);
     ServerName     = BitPacker.GetString(data, p);
     MaxPlayers     = BitPacker.GetInt(data, p);
     CurrentPlayers = BitPacker.GetInt(data, p);
     UserID         = BitPacker.GetString(data, p);
     return(true);
 }
Esempio n. 10
0
 public override bool DeSerialize(byte[] data, Pointer p)
 {
     base.DeSerialize(data, p);
     LoginConnectionType = (ConnectionType)BitPacker.GetInt(data, p);
     m_AccountName       = BitPacker.GetString(data, p); // System.Text.Encoding.UTF8.GetString(data, 4, userLen);
     m_Password          = BitPacker.GetString(data, p); // System.Text.Encoding.UTF8.GetString(data, 8 + userLen, passLen);
     IsNewAccount        = BitPacker.GetBool(data, p);
     Parms = BitPacker.GetPropertyBag(data, p);
     return(true);
 }
Esempio n. 11
0
        public override void DeserializeValue(byte[] dat, Pointer p)
        {
            int num = BitPacker.GetInt(dat, p);

            m_Value = new DateTime[num];
            for (int i = 0; i < num; i++)
            {
                Name       = BitPacker.GetString(dat, p);
                m_Value[i] = new DateTime(BitPacker.GetLong(dat, p), DateTimeKind.Utc);
            }
        }
Esempio n. 12
0
        public override void DeserializeValue(byte[] dat, Pointer p)
        {
            int num = BitPacker.GetInt(dat, p);

            m_Value = new bool[num];
            for (int i = 0; i < num; i++)
            {
                Name       = BitPacker.GetString(dat, p);
                m_Value[i] = BitPacker.GetBool(dat, p);
            }
        }
Esempio n. 13
0
 public override bool DeSerialize(byte[] data, Pointer p)
 {
     base.DeSerialize(data, p);
     AuthTicket         = new Guid(BitPacker.GetString(data, p));
     ServerName         = BitPacker.GetString(data, p);
     ServerIP           = BitPacker.GetString(data, p);
     ServerPort         = BitPacker.GetInt(data, p);
     TargetResource     = new Guid(BitPacker.GetString(data, p));
     IsAssistedTransfer = BitPacker.GetBool(data, p);
     return(true);
 }
Esempio n. 14
0
        public override bool DeSerialize(byte[] data, Pointer p)
        {
            base.DeSerialize(data, p);

            int num = BitPacker.GetInt(data, p);

            for (int i = 0; i < num; i++)
            {
                Characters.Add(BitPacker.GetComponent(data, p, false) as ICharacterInfo);
            }

            return(true);
        }
 public override bool DeSerialize(byte[] data, Pointer p)
 {
     //Log.LogMsg("Attempting deserialize Rijndael Request.");
     base.DeSerialize(data, p);
     this.m_ServerVersion     = new Version(BitPacker.GetString(data, p));
     this.m_PublicRSAKey      = BitPacker.GetBytes(data, p);
     this.m_ConnectionKeySize = BitPacker.GetInt(data, p);
     this.ServerName          = BitPacker.GetString(data, p);
     this.MaxPlayers          = BitPacker.GetInt(data, p);
     this.CurrentPlayers      = BitPacker.GetInt(data, p);
     //Log.LogMsg("Deserialized Rijndael Request." + PublicRSAKey);
     return(true);
 }
Esempio n. 16
0
        public void Deserialize(byte[] data, Pointer p)
        {
            int count = BitPacker.GetInt(data, p);

            for (int i = 0; i < count; i++)
            {
                string key   = BitPacker.GetString(data, p);
                string value = BitPacker.GetString(data, p);
                if (!Configs.ContainsKey(key))
                {
                    Configs.Add(key, value);
                }
            }
        }
Esempio n. 17
0
        public override bool DeSerialize(byte[] data, Pointer p)
        {
            base.DeSerialize(data, p);

            Remove        = BitPacker.GetBool(data, p);
            PropertyBagId = new Guid(BitPacker.GetString(data, p));
            int numProps = BitPacker.GetInt(data, p);

            Properties = new Property[numProps];
            for (int i = 0; i < numProps; i++)
            {
                Properties[i] = BitPacker.GetProperty(data, p, null);
            }
            return(true);
        }
Esempio n. 18
0
        public virtual void Deserialize(byte[] data, Pointer p)
        {
#if !IS_CLIENT
            CurrentSessionID = new Guid(BitPacker.GetString(data, p));
            Username         = BitPacker.GetString(data, p);
#endif
            MaxCharacters = BitPacker.GetInt(data, p);

            // Roles
            int numRoles = BitPacker.GetInt(data, p);
            UserRoles = new string[numRoles];
            for (int i = 0; i < numRoles; i++)
            {
                UserRoles[i] = BitPacker.GetString(data, p);
            }

#if !IS_CLIENT
            // IPs
            int numIPs = BitPacker.GetInt(data, p);
            LoginHistoryIP = new Queue <string>();
            for (int i = 0; i < numIPs; i++)
            {
                LoginHistoryIP.Enqueue(BitPacker.GetString(data, p));
            }

            // Login times
            int numLogins = BitPacker.GetInt(data, p);
            LoginHistoryTime = new Queue <DateTime>();
            for (int i = 0; i < numLogins; i++)
            {
                LoginHistoryTime.Enqueue(new DateTime(BitPacker.GetLong(data, p), DateTimeKind.Utc));
            }

            // Logoff times
            int numLogouts = BitPacker.GetInt(data, p);
            LogoffHistoryTime = new Queue <DateTime>();
            for (int i = 0; i < numLogouts; i++)
            {
                LogoffHistoryTime.Enqueue(new DateTime(BitPacker.GetLong(data, p), DateTimeKind.Utc));
            }

            // Misc
            m_CurrentSessionID = new Guid(BitPacker.GetString(data, p));
            m_CurrentLoginTime = new DateTime(BitPacker.GetLong(data, p), DateTimeKind.Utc);
            m_CurrentIP        = BitPacker.GetString(data, p);
#endif
        }
Esempio n. 19
0
        public void Deserialize(byte[] data, Pointer p)
        {
            IsEnabled      = BitPacker.GetBool(data, p);
            SampleInterval = TimeSpan.FromTicks(BitPacker.GetLong(data, p));
            Category       = BitPacker.GetString(data, p);
            CounterName    = BitPacker.GetString(data, p);
            InstanceName   = BitPacker.GetString(data, p);
            HelpText       = BitPacker.GetString(data, p);
            int numHistory = BitPacker.GetInt(data, p);

            for (int i = 0; i < numHistory; i++)
            {
                HistoryItem hi = new HistoryItem();
                hi.Value     = BitPacker.GetSingle(data, p);
                hi.Timestamp = new DateTime(BitPacker.GetLong(data, p), DateTimeKind.Utc);
                History.Add(hi);
            }
        }
Esempio n. 20
0
        public override bool DeSerialize(byte[] data, Pointer p)
        {
            base.DeSerialize(data, p);

            ReplyCode          = (ReplyType)BitPacker.GetInt(data, p);
            ReplyPacketID      = BitPacker.GetInt(data, p);
            ReplyMessage       = BitPacker.GetString(data, p);
            ReplyPacketType    = BitPacker.GetInt(data, p);
            ReplyPacketSubType = BitPacker.GetInt(data, p);

            bool hasProps = BitPacker.GetBool(data, p);

            if (hasProps)
            {
                Parms = BitPacker.GetPropertyBag(data, p);
            }
            return(true);
        }
Esempio n. 21
0
        public void Deserialize(byte[] data, Pointer p)
        {
            AllowRemoteConnections = BitPacker.GetBool(data, p);
            TotalUserCount         = BitPacker.GetInt(data, p);
            UserDataStore          = BitPacker.GetString(data, p);

            int count = BitPacker.GetInt(data, p);

            for (int i = 0; i < count; i++)
            {
                string   username  = BitPacker.GetString(data, p);
                string[] roles     = BitPacker.GetStringList(data, p).ToArray();
                bool     isLocked  = BitPacker.GetBool(data, p);
                Guid     id        = new Guid(BitPacker.GetString(data, p));
                string   email     = BitPacker.GetString(data, p);
                DateTime lastLogin = new DateTime(BitPacker.GetLong(data, p), DateTimeKind.Utc);
                User     urs       = new User(username, roles, isLocked, id, email, lastLogin);
                Users.Add(urs);
            }
        }
Esempio n. 22
0
        public override bool DeSerialize(byte[] data, Pointer p)
        {
            base.DeSerialize(data, p);
            Kind = (MatchNotificationType)BitPacker.GetInt(data, p);

            bool haveGame = BitPacker.GetBool(data, p);

            if (haveGame)
            {
                TheGame = BitPacker.GetComponent(data, p, false) as IGame;
            }

            bool haveTargetPlayer = BitPacker.GetBool(data, p);

            if (haveTargetPlayer)
            {
                TargetPlayer = BitPacker.GetComponent(data, p, false) as ICharacterInfo;
            }

            TheGameID = new Guid(BitPacker.GetString(data, p));
            return(true);
        }
Esempio n. 23
0
        public override void Deserialize(byte[] data, Pointer p, bool includeSubComponents)
        {
            // General match info
            Owner  = BitPacker.GetInt(data, p);
            GameID = new Guid(BitPacker.GetString(data, p));

            // Options
            Properties = BitPacker.GetPropertyBag(data, p);

            // Players
            int numPlayers = BitPacker.GetInt(data, p);

            for (int i = 0; i < numPlayers; i++)
            {
                CharacterInfo ci = new CharacterInfo();
                ci.Properties = BitPacker.GetPropertyBag(data, p);
                ci.Stats      = BitPacker.GetStatBag(data, p);
                ci.ID         = BitPacker.GetInt(data, p);
                Players.Add(ci.ID, ci);
            }

            base.Deserialize(data, p, includeSubComponents);
        }
Esempio n. 24
0
 public override bool DeSerialize(byte[] dat, Pointer p)
 {
     base.DeSerialize(dat, p);
     ListenOnPort = BitPacker.GetInt(dat, p);
     return(true);
 }
Esempio n. 25
0
 public override void Deserialize(byte[] data, Pointer p)
 {
     base.Deserialize(data, p);
     Version = BitPacker.GetInt(data, p);
 }
Esempio n. 26
0
 /// <summary>
 /// Takes raw data and constructs members from it.
 /// Override this method to reconstitute the packet object from raw data in the form of the ArrayList argument
 /// </summary>
 /// <returns>failure or success</returns>
 public virtual bool DeSerialize(byte[] dat, Pointer p)
 {
     PacketID  = BitPacker.GetInt(dat, p);
     SentOnUTC = BitPacker.GetLong(dat, p);
     return(false);
 }
Esempio n. 27
0
 public override void DeserializeValue(byte[] dat, Pointer p)
 {
     Name    = BitPacker.GetString(dat, p);
     m_Value = BitPacker.GetInt(dat, p);
 }