Ejemplo n.º 1
0
 public override byte[] Serialize(Pointer p)
 {
     base.Serialize(p);
     BitPacker.AddString(ref m_SerializeBuffer, p, TextMessage);
     BitPacker.AddPropertyBag(ref m_SerializeBuffer, p, Parms);
     return m_SerializeBuffer;
 }
Ejemplo n.º 2
0
        public override bool DeSerialize(byte[] data, Pointer p)
        {
            base.DeSerialize(data, p);

            GameMessageKind = BitPacker.GetInt(data, p);
            return true;
        }
Ejemplo n.º 3
0
 public override byte[] Serialize(Pointer p)
 {
     base.Serialize(p);
     BitPacker.AddSerializableWispObject(ref m_SerializeBuffer, p, Phase);
     BitPacker.AddByte(ref m_SerializeBuffer, p, (byte)PhaseUpdateKind);
     return m_SerializeBuffer;
 }
Ejemplo n.º 4
0
 public override bool DeSerialize(byte[] data, Pointer p)
 {
     base.DeSerialize(data, p);
     Phase = BitPacker.GetSerializableWispObject(data, p) as Phase;
     PhaseUpdateKind = (PacketPhaseUpdate.UpdateKind)BitPacker.GetByte(data, p);
     return true;
 }
Ejemplo n.º 5
0
        public override byte[] Serialize(Pointer p)
        {
            base.Serialize(p);

            BitPacker.AddInt(ref m_SerializeBuffer, p, (GameMessageKind));
            return m_SerializeBuffer;
        }
Ejemplo n.º 6
0
 public override bool DeSerialize(byte[] data, Pointer p)
 {
     base.DeSerialize(data, p);
     TargetServerName = BitPacker.GetString(data, p);
     TargetResource = new Guid(BitPacker.GetString(data, p));
     return true;
 }
Ejemplo n.º 7
0
        public override byte[] Serialize(Pointer p)
        {
            base.Serialize(p);
            BitPacker.AddString(ref m_SerializeBuffer, p, TargetServerName);
            BitPacker.AddString(ref m_SerializeBuffer, p, TargetResource.ToString());

            return m_SerializeBuffer;
        }
Ejemplo n.º 8
0
        public override bool DeSerialize(byte[] data, Pointer p)
        {
            base.DeSerialize(data, p);
            TextMessage = BitPacker.GetString(data, p);
            Parms = BitPacker.GetPropertyBag(data, p);

            return true;
        }
Ejemplo 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;
 }
Ejemplo n.º 10
0
 public override byte[] Serialize(Pointer p)
 {
     base.Serialize(p);
     byte[] serverName = System.Text.Encoding.UTF8.GetBytes(ServerName);
     BitPacker.AddString(ref m_SerializeBuffer, p, ServerName);
     BitPacker.AddInt(ref m_SerializeBuffer, p, MaxPlayers);
     BitPacker.AddInt(ref m_SerializeBuffer, p, CurrentPlayers);
     BitPacker.AddString(ref m_SerializeBuffer, p, UserID);
     return m_SerializeBuffer;
 }
Ejemplo n.º 11
0
 public void Serialize(ref byte[] buffer, Pointer p)
 {
     BitPacker.AddInt(ref buffer, p, Configs.Count);
     Dictionary<string, string>.Enumerator enu = Configs.GetEnumerator();
     while (enu.MoveNext())
     {
         BitPacker.AddString(ref buffer, p, enu.Current.Key);
         BitPacker.AddString(ref buffer, p, enu.Current.Value);
     }
 }
Ejemplo n.º 12
0
 public override bool DeSerialize(byte[] data, Pointer p)
 {
     base.DeSerialize(data, p);
     OriginServer = BitPacker.GetString(data, p);
     TargetServer = BitPacker.GetString(data, p);
     To = new Guid(BitPacker.GetString(data, p));
     From = BitPacker.GetSerializableWispObject(data, p) as CharacterInfo;
     Message = BitPacker.GetBytes(data, p);
     return true;
 }
Ejemplo n.º 13
0
 public override byte[] Serialize(Pointer p)
 {
     base.Serialize(p);
     BitPacker.AddString(ref m_SerializeBuffer, p, OriginServer);
     BitPacker.AddString(ref m_SerializeBuffer, p, TargetServer);
     BitPacker.AddString(ref m_SerializeBuffer, p, To.ToString());
     BitPacker.AddSerializableWispObject(ref m_SerializeBuffer, p, From);
     BitPacker.AddBytes(ref m_SerializeBuffer, p, Message);
     return m_SerializeBuffer;
 }
Ejemplo n.º 14
0
 public override byte[] Serialize(Pointer p)
 {
     base.Serialize(p);
     BitPacker.AddInt(ref m_SerializeBuffer, p, Characters.Count);
     for (int i = 0; i < Characters.Count; i++)
     {
         BitPacker.AddComponent(ref m_SerializeBuffer, p, Characters[i]);
     }
     return m_SerializeBuffer;
 }
Ejemplo n.º 15
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;
 }
        public override byte[] Serialize(Pointer p)
        {
            base.Serialize(p);
            BitPacker.AddSerializableWispObject(ref m_SerializeBuffer, p, Profile);
            BitPacker.AddString(ref m_SerializeBuffer, p, TargetResource.ToString());
            BitPacker.AddString(ref m_SerializeBuffer, p, Player.ToString());
            BitPacker.AddString(ref m_SerializeBuffer, p, AuthTicket.ToString());
            BitPacker.AddString(ref m_SerializeBuffer, p, AccountName);

            return m_SerializeBuffer;
        }
        public override bool DeSerialize(byte[] data, Pointer p)
        {
            base.DeSerialize(data, p);
            Profile = (AccountProfile) BitPacker.GetSerializableWispObject(data, p);
            TargetResource = new Guid(BitPacker.GetString(data, p));
            Player = new Guid(BitPacker.GetString(data, p));
            AuthTicket = new Guid(BitPacker.GetString(data, p));
            AccountName = BitPacker.GetString(data, p);

            return true;
        }
Ejemplo n.º 18
0
 public override byte[] Serialize(Pointer p)
 {
     base.Serialize(p);
     BitPacker.AddString(ref m_SerializeBuffer, p, AuthTicket.ToString());
     BitPacker.AddString(ref m_SerializeBuffer, p, ServerName);
     BitPacker.AddString(ref m_SerializeBuffer, p, ServerIP);
     BitPacker.AddInt(ref m_SerializeBuffer, p, ServerPort);
     BitPacker.AddString(ref m_SerializeBuffer, p, TargetResource.ToString());
     BitPacker.AddBool(ref m_SerializeBuffer, p, IsAssistedTransfer);
     return m_SerializeBuffer;
 }
Ejemplo n.º 19
0
 public override void Deserialize(byte[] data, Pointer p)
 {
     base.Deserialize(data, p);
     switch(Version)
     {
         case 0:
             DeserializeVersion0(data, p);
             break;
     }
     // No need to load the character data, since the character data is always loaded and sent along the wire.
 }
Ejemplo n.º 20
0
        public override byte[] Serialize(Pointer p)
        {
            base.Serialize(p);

            BitPacker.AddInt(ref m_SerializeBuffer, p, Characters.Count);
            for (int i = 0; i < Characters.Count; i++)
            {
                // this is just an overview packet.  don't send component details.
                BitPacker.AddComponent(ref m_SerializeBuffer, p, Characters[i], false);
            }
            return m_SerializeBuffer;
        }
Ejemplo n.º 21
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) as ServerCharacterInfo);
            }

            return true;
        }
Ejemplo n.º 22
0
 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;
 }
Ejemplo n.º 23
0
        public override byte[] Serialize(Pointer p)
        {
            base.Serialize(p);

            BitPacker.AddBool(ref m_SerializeBuffer, p, TheGame != null);
            if (TheGame != null)
            {
                BitPacker.AddComponent(ref m_SerializeBuffer, p, TheGame, false);
            }
            BitPacker.AddBool(ref m_SerializeBuffer, p, StillLooking);

            return m_SerializeBuffer;
        }
Ejemplo n.º 24
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);
         }
     }
 }
Ejemplo n.º 25
0
        public static byte[] CompressData(byte[] data, Pointer p)
        {
            /*
            MemoryStream objStream = new MemoryStream();
            //DeflateStream objZS = new System.IO.Compression.DeflateStream(objStream, CompressionMode.Compress);
            ICSharpCode.SharpZipLib.GZip.GZipOutputStream objZS = new ICSharpCode.SharpZipLib.GZip.GZipOutputStream(objStream);
            objZS.Write(data, 0, data.Length);
            objZS.Flush();
            objZS.Close();
            return objStream.ToArray();
             * */

            return data;
        }
        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;
        }
Ejemplo n.º 27
0
        public override void Serialize(ref byte[] buffer, Pointer p)
        {
            base.Serialize(ref buffer, p);
            switch(Version)
            {
                case 0:
                    SerializeVersion0(ref buffer, p);
                    break;
            }

            // Load the character data, since WispPlayer is a composite object and we want to save the
            string msg = "";
            CharacterUtil.Instance.SaveCharacter(CharacterData.OwningAccount, CharacterData, false, ref msg);
        }
Ejemplo n.º 28
0
        public override bool DeSerialize(byte[] data, Pointer p)
        {
            base.DeSerialize(data, p);
            bool haveGame = BitPacker.GetBool(data, p);
            if(haveGame)
            {
                TheGame = BitPacker.GetComponent(data, p, false) as Game;
            }
            else
            {
                TheGame = null;
            }

            StillLooking = BitPacker.GetBool(data, p);
            return true;
        }
Ejemplo n.º 29
0
        public void Serialize(ref byte[] buffer, Pointer p)
        {
            BitPacker.AddBool(ref buffer, p, AllowRemoteConnections);
            BitPacker.AddInt(ref buffer, p, TotalUserCount);
            BitPacker.AddString(ref buffer, p, UserDataStore);
            BitPacker.AddInt(ref buffer, p, Users.Count);

            foreach(User su in Users)
            {
                BitPacker.AddString(ref buffer, p, su.Username);
                BitPacker.AddStringList(ref buffer, p, new List<string>(su.Roles));
                BitPacker.AddBool(ref buffer, p, su.IsLocked);
                BitPacker.AddString(ref buffer, p, su.ID.ToString());
                BitPacker.AddString(ref buffer, p, su.Email);
                BitPacker.AddLong(ref buffer, p, su.LastLogin.Ticks);
            }
        }
Ejemplo n.º 30
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);
            }
        }