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); }
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); }
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); }
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); } } }
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); }
public override byte[] Serialize(Pointer p) { base.Serialize(p); BitPacker.AddInt(ref m_SerializeBuffer, p, (int)Kind); if (TheGame == null) { BitPacker.AddBool(ref m_SerializeBuffer, p, false); // do not have game data } else { BitPacker.AddBool(ref m_SerializeBuffer, p, true); // have game data BitPacker.AddComponent(ref m_SerializeBuffer, p, TheGame, false); } BitPacker.AddBool(ref m_SerializeBuffer, p, TargetPlayer != null); if (TargetPlayer != null) { BitPacker.AddComponent(ref m_SerializeBuffer, p, TargetPlayer, false); } BitPacker.AddString(ref m_SerializeBuffer, p, TheGameID.ToString()); return(m_SerializeBuffer); }
public override byte[] Serialize(Pointer p) { base.Serialize(p); BitPacker.AddBytes(ref m_SerializeBuffer, p, RijndaelExchangeData); BitPacker.AddBytes(ref m_SerializeBuffer, p, PublicRSAKey); return(m_SerializeBuffer); }
public override bool DeSerialize(byte[] data, Pointer p) { base.DeSerialize(data, p); m_rijndaelExchange = BitPacker.GetBytes(data, p); PublicRSAKey = BitPacker.GetBytes(data, p); return(true); }
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); }
public override byte[] Serialize(Pointer p) { base.Serialize(p); BitPacker.AddBool(ref m_SerializeBuffer, p, IsRefresh); BitPacker.AddBool(ref m_SerializeBuffer, p, IsServerPacket); BitPacker.AddInt(ref m_SerializeBuffer, p, TheGames.Count); for (int i = 0; i < TheGames.Count; i++) { if (!IsRefresh) { BitPacker.AddInt(ref m_SerializeBuffer, p, (int)Kinds[i]); } // determine if this packet goes to another server, in which case we need to send the full game data, // or to the client in which case we need to just send a matchInfo object BitPacker.AddComponent(ref m_SerializeBuffer, p, TheGames[i], IsServerPacket); BitPacker.AddBool(ref m_SerializeBuffer, p, TargetPlayers.Count > i); if (!IsRefresh && TargetPlayers[i] != null) { BitPacker.AddComponent(ref m_SerializeBuffer, p, TargetPlayers[i], false); } } return(m_SerializeBuffer); }
public override byte[] Serialize(Pointer p) { base.Serialize(p); BitPacker.AddInt(ref m_SerializeBuffer, p, (GameMessageKind)); return(m_SerializeBuffer); }
public override void Serialize(ref byte[] buffer, Pointer p) { base.Serialize(ref buffer, p); BitPacker.AddInt(ref buffer, p, PhaseID); BitPacker.AddString(ref buffer, p, PhaseName); BitPacker.AddLong(ref buffer, p, ResponseTime); }
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); }
public override bool DeSerialize(byte[] data, Pointer p) { base.DeSerialize(data, p); GameMessageKind = BitPacker.GetInt(data, p); return(true); }
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); }
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); }
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); }
public override void Serialize(ref byte[] buffer, Pointer p) { BitPacker.AddInt(ref buffer, p, GamesPlayed); BitPacker.AddDouble(ref buffer, p, RatingMean); BitPacker.AddDouble(ref buffer, p, RatingStandardDeviation); base.Serialize(ref buffer, p); }
public void Deserialize(byte[] data, Pointer p) { CommandName = BitPacker.GetString(data, p); CommandGroup = BitPacker.GetString(data, p); UsageHelp = BitPacker.GetString(data, p); AllowedRoles = BitPacker.GetStringList(data, p).ToArray(); ParmNames = BitPacker.GetStringList(data, p).ToArray(); }
public void Serialize(ref byte[] buffer, Pointer p) { BitPacker.AddString(ref buffer, p, CommandName); BitPacker.AddString(ref buffer, p, CommandGroup); BitPacker.AddString(ref buffer, p, UsageHelp); BitPacker.AddStringList(ref buffer, p, new List <string>(AllowedRoles)); BitPacker.AddStringList(ref buffer, p, new List <string>(ParmNames)); }
public override void Serialize(ref byte[] buffer, Pointer p, bool includeComponents) { BitPacker.AddPropertyBag(ref buffer, p, Properties); BitPacker.AddStatBag(ref buffer, p, Stats); BitPacker.AddInt(ref buffer, p, ID); base.Serialize(ref buffer, p, includeComponents); }
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); }
public override bool DeSerialize(byte[] data, Pointer p) { base.DeSerialize(data, p); TextMessage = BitPacker.GetString(data, p); Parms = BitPacker.GetPropertyBag(data, p); return(true); }
public override void SerializeValue(ref byte[] dat, Pointer p) { BitPacker.AddInt(ref dat, p, m_Value.Length); for (int i = 0; i < m_Value.Length; i++) { BitPacker.AddString(ref dat, p, Name); BitPacker.AddLong(ref dat, p, m_Value[i].Ticks); } }
public override void SerializeValue(ref byte[] dat, Pointer p) { if (m_Value == null) { return; } BitPacker.AddString(ref dat, p, Name); BitPacker.AddComponent(ref dat, p, m_Value); }
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); }
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); } }
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); }
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); }
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); }