public static void SerializeDelta(Stream stream, PlayerLifeStory.DeathInfo instance, PlayerLifeStory.DeathInfo previous)
            {
                MemoryStream memoryStream = Pool.Get <MemoryStream>();

                if (instance.attackerName != null && instance.attackerName != previous.attackerName)
                {
                    stream.WriteByte(10);
                    ProtocolParser.WriteString(stream, instance.attackerName);
                }
                if (instance.attackerSteamID != previous.attackerSteamID)
                {
                    stream.WriteByte(16);
                    ProtocolParser.WriteUInt64(stream, instance.attackerSteamID);
                }
                if (instance.hitBone != null && instance.hitBone != previous.hitBone)
                {
                    stream.WriteByte(26);
                    ProtocolParser.WriteString(stream, instance.hitBone);
                }
                if (instance.inflictorName != null && instance.inflictorName != previous.inflictorName)
                {
                    stream.WriteByte(34);
                    ProtocolParser.WriteString(stream, instance.inflictorName);
                }
                if (instance.lastDamageType != previous.lastDamageType)
                {
                    stream.WriteByte(40);
                    ProtocolParser.WriteUInt64(stream, (ulong)instance.lastDamageType);
                }
                Pool.FreeMemoryStream(ref memoryStream);
            }
 public static PlayerLifeStory.DeathInfo Deserialize(byte[] buffer, PlayerLifeStory.DeathInfo instance, bool isDelta = false)
 {
     using (MemoryStream memoryStream = new MemoryStream(buffer))
     {
         PlayerLifeStory.DeathInfo.Deserialize(memoryStream, instance, isDelta);
     }
     return(instance);
 }
 public void CopyTo(PlayerLifeStory.DeathInfo instance)
 {
     instance.attackerName    = this.attackerName;
     instance.attackerSteamID = this.attackerSteamID;
     instance.hitBone         = this.hitBone;
     instance.inflictorName   = this.inflictorName;
     instance.lastDamageType  = this.lastDamageType;
 }
 public static PlayerLifeStory.DeathInfo Deserialize(byte[] buffer)
 {
     PlayerLifeStory.DeathInfo deathInfo = Pool.Get <PlayerLifeStory.DeathInfo>();
     using (MemoryStream memoryStream = new MemoryStream(buffer))
     {
         PlayerLifeStory.DeathInfo.Deserialize(memoryStream, deathInfo, false);
     }
     return(deathInfo);
 }
 public virtual void WriteToStreamDelta(Stream stream, PlayerLifeStory.DeathInfo previous)
 {
     if (previous == null)
     {
         PlayerLifeStory.DeathInfo.Serialize(stream, this);
         return;
     }
     PlayerLifeStory.DeathInfo.SerializeDelta(stream, this, previous);
 }
 public static byte[] SerializeToBytes(PlayerLifeStory.DeathInfo instance)
 {
     byte[] array;
     using (MemoryStream memoryStream = new MemoryStream())
     {
         PlayerLifeStory.DeathInfo.Serialize(memoryStream, instance);
         array = memoryStream.ToArray();
     }
     return(array);
 }
 public static void ResetToPool(PlayerLifeStory.DeathInfo instance)
 {
     if (!instance.ShouldPool)
     {
         return;
     }
     instance.attackerName    = string.Empty;
     instance.attackerSteamID = (ulong)0;
     instance.hitBone         = string.Empty;
     instance.inflictorName   = string.Empty;
     instance.lastDamageType  = 0;
     Pool.Free <PlayerLifeStory.DeathInfo>(ref instance);
 }
 public static PlayerLifeStory.DeathInfo Deserialize(Stream stream, PlayerLifeStory.DeathInfo instance, bool isDelta)
 {
     while (true)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             break;
         }
         if (num <= 16)
         {
             if (num == 10)
             {
                 instance.attackerName = ProtocolParser.ReadString(stream);
                 continue;
             }
             else if (num == 16)
             {
                 instance.attackerSteamID = ProtocolParser.ReadUInt64(stream);
                 continue;
             }
         }
         else if (num == 26)
         {
             instance.hitBone = ProtocolParser.ReadString(stream);
             continue;
         }
         else if (num == 34)
         {
             instance.inflictorName = ProtocolParser.ReadString(stream);
             continue;
         }
         else if (num == 40)
         {
             instance.lastDamageType = (int)ProtocolParser.ReadUInt64(stream);
             continue;
         }
         Key key = ProtocolParser.ReadKey((byte)num, stream);
         if (key.Field == 0)
         {
             throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
         }
         ProtocolParser.SkipKey(stream, key);
     }
     return(instance);
 }
 public static void SerializeLengthDelimited(Stream stream, PlayerLifeStory.DeathInfo instance)
 {
     byte[] bytes = PlayerLifeStory.DeathInfo.SerializeToBytes(instance);
     ProtocolParser.WriteUInt32(stream, (uint)bytes.Length);
     stream.Write(bytes, 0, (int)bytes.Length);
 }
            public static PlayerLifeStory.DeathInfo DeserializeLengthDelimited(Stream stream, PlayerLifeStory.DeathInfo instance, bool isDelta)
            {
                long position = (long)ProtocolParser.ReadUInt32(stream);

                position += stream.Position;
                while (stream.Position < position)
                {
                    int num = stream.ReadByte();
                    if (num == -1)
                    {
                        throw new EndOfStreamException();
                    }
                    if (num <= 16)
                    {
                        if (num == 10)
                        {
                            instance.attackerName = ProtocolParser.ReadString(stream);
                            continue;
                        }
                        else if (num == 16)
                        {
                            instance.attackerSteamID = ProtocolParser.ReadUInt64(stream);
                            continue;
                        }
                    }
                    else if (num == 26)
                    {
                        instance.hitBone = ProtocolParser.ReadString(stream);
                        continue;
                    }
                    else if (num == 34)
                    {
                        instance.inflictorName = ProtocolParser.ReadString(stream);
                        continue;
                    }
                    else if (num == 40)
                    {
                        instance.lastDamageType = (int)ProtocolParser.ReadUInt64(stream);
                        continue;
                    }
                    Key key = ProtocolParser.ReadKey((byte)num, stream);
                    if (key.Field == 0)
                    {
                        throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    }
                    ProtocolParser.SkipKey(stream, key);
                }
                if (stream.Position != position)
                {
                    throw new ProtocolBufferException("Read past max limit");
                }
                return(instance);
            }
 public static PlayerLifeStory.DeathInfo DeserializeLengthDelimited(Stream stream)
 {
     PlayerLifeStory.DeathInfo deathInfo = Pool.Get <PlayerLifeStory.DeathInfo>();
     PlayerLifeStory.DeathInfo.DeserializeLengthDelimited(stream, deathInfo, false);
     return(deathInfo);
 }
 public static PlayerLifeStory.DeathInfo DeserializeLength(Stream stream, int length)
 {
     PlayerLifeStory.DeathInfo deathInfo = Pool.Get <PlayerLifeStory.DeathInfo>();
     PlayerLifeStory.DeathInfo.DeserializeLength(stream, length, deathInfo, false);
     return(deathInfo);
 }
 public PlayerLifeStory.DeathInfo Copy()
 {
     PlayerLifeStory.DeathInfo deathInfo = Pool.Get <PlayerLifeStory.DeathInfo>();
     this.CopyTo(deathInfo);
     return(deathInfo);
 }