Ejemplo n.º 1
0
        public static Attack DeserializeLengthDelimited(Stream stream)
        {
            Attack attack = Pool.Get <Attack>();

            Attack.DeserializeLengthDelimited(stream, attack, false);
            return(attack);
        }
Ejemplo n.º 2
0
        public static PlayerAttack DeserializeLengthDelimited(Stream stream, PlayerAttack 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 != 10)
                {
                    if (num == 16)
                    {
                        instance.projectileID = (int)ProtocolParser.ReadUInt64(stream);
                    }
                    else
                    {
                        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);
                    }
                }
                else if (instance.attack != null)
                {
                    Attack.DeserializeLengthDelimited(stream, instance.attack, isDelta);
                }
                else
                {
                    instance.attack = Attack.DeserializeLengthDelimited(stream);
                }
            }
            if (stream.Position != position)
            {
                throw new ProtocolBufferException("Read past max limit");
            }
            return(instance);
        }
Ejemplo n.º 3
0
 public static PlayerAttack Deserialize(Stream stream, PlayerAttack instance, bool isDelta)
 {
     while (true)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             break;
         }
         if (num != 10)
         {
             if (num == 16)
             {
                 instance.projectileID = (int)ProtocolParser.ReadUInt64(stream);
             }
             else
             {
                 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);
             }
         }
         else if (instance.attack != null)
         {
             Attack.DeserializeLengthDelimited(stream, instance.attack, isDelta);
         }
         else
         {
             instance.attack = Attack.DeserializeLengthDelimited(stream);
         }
     }
     return(instance);
 }