Ejemplo n.º 1
0
 public static OwnerInfo Deserialize(Stream stream, OwnerInfo instance, bool isDelta)
 {
     while (true)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             break;
         }
         if (num != 8)
         {
             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
         {
             instance.steamid = ProtocolParser.ReadUInt64(stream);
         }
     }
     return(instance);
 }
Ejemplo n.º 2
0
        public static OwnerInfo DeserializeLength(Stream stream, int length, OwnerInfo instance, bool isDelta)
        {
            long position = stream.Position + (long)length;

            while (stream.Position < position)
            {
                int num = stream.ReadByte();
                if (num == -1)
                {
                    throw new EndOfStreamException();
                }
                if (num != 8)
                {
                    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
                {
                    instance.steamid = ProtocolParser.ReadUInt64(stream);
                }
            }
            if (stream.Position != position)
            {
                throw new ProtocolBufferException("Read past max limit");
            }
            return(instance);
        }
Ejemplo n.º 3
0
        public static OwnerInfo DeserializeLength(Stream stream, int length)
        {
            OwnerInfo ownerInfo = Pool.Get <OwnerInfo>();

            OwnerInfo.DeserializeLength(stream, length, ownerInfo, false);
            return(ownerInfo);
        }
Ejemplo n.º 4
0
        public static OwnerInfo Deserialize(Stream stream)
        {
            OwnerInfo ownerInfo = Pool.Get <OwnerInfo>();

            OwnerInfo.Deserialize(stream, ownerInfo, false);
            return(ownerInfo);
        }
Ejemplo n.º 5
0
        public OwnerInfo Copy()
        {
            OwnerInfo ownerInfo = Pool.Get <OwnerInfo>();

            this.CopyTo(ownerInfo);
            return(ownerInfo);
        }
Ejemplo n.º 6
0
 public static OwnerInfo Deserialize(byte[] buffer, OwnerInfo instance, bool isDelta = false)
 {
     using (MemoryStream memoryStream = new MemoryStream(buffer))
     {
         OwnerInfo.Deserialize(memoryStream, instance, isDelta);
     }
     return(instance);
 }
Ejemplo n.º 7
0
        public static void Serialize(Stream stream, OwnerInfo instance)
        {
            MemoryStream memoryStream = Pool.Get <MemoryStream>();

            stream.WriteByte(8);
            ProtocolParser.WriteUInt64(stream, instance.steamid);
            Pool.FreeMemoryStream(ref memoryStream);
        }
Ejemplo n.º 8
0
 public virtual void WriteToStreamDelta(Stream stream, OwnerInfo previous)
 {
     if (previous == null)
     {
         OwnerInfo.Serialize(stream, this);
         return;
     }
     OwnerInfo.SerializeDelta(stream, this, previous);
 }
Ejemplo n.º 9
0
 public static void ResetToPool(OwnerInfo instance)
 {
     if (!instance.ShouldPool)
     {
         return;
     }
     instance.steamid = (ulong)0;
     Pool.Free <OwnerInfo>(ref instance);
 }
Ejemplo n.º 10
0
        public static OwnerInfo Deserialize(byte[] buffer)
        {
            OwnerInfo ownerInfo = Pool.Get <OwnerInfo>();

            using (MemoryStream memoryStream = new MemoryStream(buffer))
            {
                OwnerInfo.Deserialize(memoryStream, ownerInfo, false);
            }
            return(ownerInfo);
        }
Ejemplo n.º 11
0
 public static byte[] SerializeToBytes(OwnerInfo instance)
 {
     byte[] array;
     using (MemoryStream memoryStream = new MemoryStream())
     {
         OwnerInfo.Serialize(memoryStream, instance);
         array = memoryStream.ToArray();
     }
     return(array);
 }
Ejemplo n.º 12
0
        public static void SerializeDelta(Stream stream, OwnerInfo instance, OwnerInfo previous)
        {
            MemoryStream memoryStream = Pool.Get <MemoryStream>();

            if (instance.steamid != previous.steamid)
            {
                stream.WriteByte(8);
                ProtocolParser.WriteUInt64(stream, instance.steamid);
            }
            Pool.FreeMemoryStream(ref memoryStream);
        }
Ejemplo n.º 13
0
 public void ToProto(Stream stream)
 {
     OwnerInfo.Serialize(stream, this);
 }
Ejemplo n.º 14
0
 public void CopyTo(OwnerInfo instance)
 {
     instance.steamid = this.steamid;
 }
Ejemplo n.º 15
0
 public virtual void WriteToStream(Stream stream)
 {
     OwnerInfo.Serialize(stream, this);
 }
Ejemplo n.º 16
0
 public virtual void ReadFromStream(Stream stream, int size, bool isDelta = false)
 {
     OwnerInfo.DeserializeLength(stream, size, this, isDelta);
 }
Ejemplo n.º 17
0
 public static void SerializeLengthDelimited(Stream stream, OwnerInfo instance)
 {
     byte[] bytes = OwnerInfo.SerializeToBytes(instance);
     ProtocolParser.WriteUInt32(stream, (uint)bytes.Length);
     stream.Write(bytes, 0, (int)bytes.Length);
 }
Ejemplo n.º 18
0
 public void ResetToPool()
 {
     OwnerInfo.ResetToPool(this);
 }
Ejemplo n.º 19
0
 public byte[] ToProtoBytes()
 {
     return(OwnerInfo.SerializeToBytes(this));
 }
Ejemplo n.º 20
0
 public void FromProto(Stream stream, bool isDelta = false)
 {
     OwnerInfo.Deserialize(stream, this, isDelta);
 }