public static ChannelCount DeserializeLengthDelimited(Stream stream)
        {
            ChannelCount channelCount = new ChannelCount();

            ChannelCount.DeserializeLengthDelimited(stream, channelCount);
            return(channelCount);
        }
        public static ChannelCount DeserializeLengthDelimited(Stream stream, ChannelCount instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(ChannelCount.Deserialize(stream, instance, num));
        }
        public static ChannelCount DeserializeLengthDelimited(Stream stream, ChannelCount instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(ChannelCount.Deserialize(stream, instance, position));
        }
 public static ChannelCount Deserialize(Stream stream, ChannelCount instance, long limit)
 {
     instance.ChannelType = "default";
     while (true)
     {
         if (limit < (long)0 || stream.Position < limit)
         {
             int num = stream.ReadByte();
             if (num == -1)
             {
                 if (limit >= (long)0)
                 {
                     throw new EndOfStreamException();
                 }
                 break;
             }
             else if (num != 10)
             {
                 if (num == 18)
                 {
                     instance.ChannelType = ProtocolParser.ReadString(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.ChannelId != null)
             {
                 EntityId.DeserializeLengthDelimited(stream, instance.ChannelId);
             }
             else
             {
                 instance.ChannelId = EntityId.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
 public static ChannelCount Deserialize(Stream stream, ChannelCount instance, long limit)
 {
     instance.ChannelType = "default";
     while (limit < 0L || stream.get_Position() < limit)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             if (limit >= 0L)
             {
                 throw new EndOfStreamException();
             }
             return(instance);
         }
         else
         {
             int num2 = num;
             if (num2 != 10)
             {
                 if (num2 != 18)
                 {
                     Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                     uint field = key.Field;
                     if (field == 0u)
                     {
                         throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                     }
                     ProtocolParser.SkipKey(stream, key);
                 }
                 else
                 {
                     instance.ChannelType = ProtocolParser.ReadString(stream);
                 }
             }
             else if (instance.ChannelId == null)
             {
                 instance.ChannelId = EntityId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 EntityId.DeserializeLengthDelimited(stream, instance.ChannelId);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static void Serialize(Stream stream, ChannelCount instance)
 {
     if (instance.HasChannelId)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.ChannelId.GetSerializedSize());
         EntityId.Serialize(stream, instance.ChannelId);
     }
     if (instance.HasChannelType)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.ChannelType));
     }
 }
Exemple #7
0
        public override int GetHashCode()
        {
            int num = base.GetType().GetHashCode();

            using (List <ChannelCount> .Enumerator enumerator = this.Channel.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ChannelCount current = enumerator.get_Current();
                    num ^= current.GetHashCode();
                }
            }
            return(num);
        }
Exemple #8
0
 public static void Serialize(Stream stream, ListChannelCountResponse instance)
 {
     if (instance.Channel.get_Count() > 0)
     {
         using (List <ChannelCount> .Enumerator enumerator = instance.Channel.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 ChannelCount current = enumerator.get_Current();
                 stream.WriteByte(10);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 bnet.protocol.channel_invitation.ChannelCount.Serialize(stream, current);
             }
         }
     }
 }
        public override bool Equals(object obj)
        {
            ChannelCount channelCount = obj as ChannelCount;

            if (channelCount == null)
            {
                return(false);
            }
            if (this.HasChannelId != channelCount.HasChannelId || this.HasChannelId && !this.ChannelId.Equals(channelCount.ChannelId))
            {
                return(false);
            }
            if (this.HasChannelType == channelCount.HasChannelType && (!this.HasChannelType || this.ChannelType.Equals(channelCount.ChannelType)))
            {
                return(true);
            }
            return(false);
        }
Exemple #10
0
        public uint GetSerializedSize()
        {
            uint num = 0u;

            if (this.Channel.get_Count() > 0)
            {
                using (List <ChannelCount> .Enumerator enumerator = this.Channel.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ChannelCount current = enumerator.get_Current();
                        num += 1u;
                        uint serializedSize = current.GetSerializedSize();
                        num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
                    }
                }
            }
            return(num);
        }
 public static ChannelCount Deserialize(Stream stream, ChannelCount instance)
 {
     return(ChannelCount.Deserialize(stream, instance, -1L));
 }
 public void Deserialize(Stream stream)
 {
     ChannelCount.Deserialize(stream, this);
 }
        public override bool Equals(object obj)
        {
            ChannelCount channelCount = obj as ChannelCount;

            return(channelCount != null && this.HasChannelId == channelCount.HasChannelId && (!this.HasChannelId || this.ChannelId.Equals(channelCount.ChannelId)) && this.HasChannelType == channelCount.HasChannelType && (!this.HasChannelType || this.ChannelType.Equals(channelCount.ChannelType)));
        }
Exemple #14
0
 public void AddChannel(ChannelCount val)
 {
     this._Channel.Add(val);
 }