Beispiel #1
0
        public static ChannelDescription DeserializeLengthDelimited(Stream stream, ChannelDescription instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(ChannelDescription.Deserialize(stream, instance, num));
        }
Beispiel #2
0
        public static ChannelDescription DeserializeLengthDelimited(Stream stream)
        {
            ChannelDescription channelDescription = new ChannelDescription();

            ChannelDescription.DeserializeLengthDelimited(stream, channelDescription);
            return(channelDescription);
        }
Beispiel #3
0
 public static ChannelDescription Deserialize(Stream stream, ChannelDescription instance, long limit)
 {
     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 != 16)
                 {
                     if (num2 != 26)
                     {
                         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 if (instance.State == null)
                     {
                         instance.State = ChannelState.DeserializeLengthDelimited(stream);
                     }
                     else
                     {
                         ChannelState.DeserializeLengthDelimited(stream, instance.State);
                     }
                 }
                 else
                 {
                     instance.CurrentMembers = ProtocolParser.ReadUInt32(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");
 }
Beispiel #4
0
 public static ChannelDescription Deserialize(Stream stream, ChannelDescription instance, long limit)
 {
     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 (instance.ChannelId != null)
                 {
                     EntityId.DeserializeLengthDelimited(stream, instance.ChannelId);
                 }
                 else
                 {
                     instance.ChannelId = EntityId.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num == 16)
             {
                 instance.CurrentMembers = ProtocolParser.ReadUInt32(stream);
             }
             else if (num != 26)
             {
                 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.State != null)
             {
                 ChannelState.DeserializeLengthDelimited(stream, instance.State);
             }
             else
             {
                 instance.State = ChannelState.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
 public static ChannelInfo Deserialize(Stream stream, ChannelInfo instance, long limit)
 {
     if (instance.Member == null)
     {
         instance.Member = new List <bnet.protocol.channel.Member>();
     }
     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.Member.Add(bnet.protocol.channel.Member.DeserializeLengthDelimited(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.Description != null)
             {
                 ChannelDescription.DeserializeLengthDelimited(stream, instance.Description);
             }
             else
             {
                 instance.Description = ChannelDescription.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
 public static ChannelInfo Deserialize(Stream stream, ChannelInfo instance, long limit)
 {
     if (instance.Member == null)
     {
         instance.Member = new List <Member>();
     }
     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.Member.Add(bnet.protocol.channel.Member.DeserializeLengthDelimited(stream));
                 }
             }
             else if (instance.Description == null)
             {
                 instance.Description = ChannelDescription.DeserializeLengthDelimited(stream);
             }
             else
             {
                 ChannelDescription.DeserializeLengthDelimited(stream, instance.Description);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static void Serialize(Stream stream, FindChannelResponse instance)
 {
     if (instance.Channel.Count > 0)
     {
         foreach (ChannelDescription channel in instance.Channel)
         {
             stream.WriteByte(10);
             ProtocolParser.WriteUInt32(stream, channel.GetSerializedSize());
             ChannelDescription.Serialize(stream, channel);
         }
     }
 }
Beispiel #8
0
        public override int GetHashCode()
        {
            int num = base.GetType().GetHashCode();

            using (List <ChannelDescription> .Enumerator enumerator = this.Channel.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ChannelDescription current = enumerator.get_Current();
                    num ^= current.GetHashCode();
                }
            }
            return(num);
        }
Beispiel #9
0
 public static void Serialize(Stream stream, FindChannelResponse instance)
 {
     if (instance.Channel.get_Count() > 0)
     {
         using (List <ChannelDescription> .Enumerator enumerator = instance.Channel.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 ChannelDescription current = enumerator.get_Current();
                 stream.WriteByte(10);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 ChannelDescription.Serialize(stream, current);
             }
         }
     }
 }
Beispiel #10
0
 public static void Serialize(Stream stream, ChannelInfo instance)
 {
     if (instance.Description == null)
     {
         throw new ArgumentNullException("Description", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.Description.GetSerializedSize());
     ChannelDescription.Serialize(stream, instance.Description);
     if (instance.Member.Count > 0)
     {
         foreach (Member member in instance.Member)
         {
             stream.WriteByte(18);
             ProtocolParser.WriteUInt32(stream, member.GetSerializedSize());
             bnet.protocol.channel.Member.Serialize(stream, member);
         }
     }
 }
Beispiel #11
0
        public uint GetSerializedSize()
        {
            uint num = 0u;

            if (this.Channel.get_Count() > 0)
            {
                using (List <ChannelDescription> .Enumerator enumerator = this.Channel.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ChannelDescription current = enumerator.get_Current();
                        num += 1u;
                        uint serializedSize = current.GetSerializedSize();
                        num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
                    }
                }
            }
            return(num);
        }
Beispiel #12
0
 public static void Serialize(Stream stream, ChannelDescription instance)
 {
     if (instance.ChannelId == null)
     {
         throw new ArgumentNullException("ChannelId", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.ChannelId.GetSerializedSize());
     EntityId.Serialize(stream, instance.ChannelId);
     if (instance.HasCurrentMembers)
     {
         stream.WriteByte(16);
         ProtocolParser.WriteUInt32(stream, instance.CurrentMembers);
     }
     if (instance.HasState)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteUInt32(stream, instance.State.GetSerializedSize());
         ChannelState.Serialize(stream, instance.State);
     }
 }
Beispiel #13
0
        public override bool Equals(object obj)
        {
            ChannelDescription channelDescription = obj as ChannelDescription;

            if (channelDescription == null)
            {
                return(false);
            }
            if (!this.ChannelId.Equals(channelDescription.ChannelId))
            {
                return(false);
            }
            if (this.HasCurrentMembers != channelDescription.HasCurrentMembers || this.HasCurrentMembers && !this.CurrentMembers.Equals(channelDescription.CurrentMembers))
            {
                return(false);
            }
            if (this.HasState == channelDescription.HasState && (!this.HasState || this.State.Equals(channelDescription.State)))
            {
                return(true);
            }
            return(false);
        }
 public static FindChannelResponse Deserialize(Stream stream, FindChannelResponse instance, long limit)
 {
     if (instance.Channel == null)
     {
         instance.Channel = new List <ChannelDescription>();
     }
     while (limit < 0L || stream.Position < limit)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             if (limit >= 0L)
             {
                 throw new EndOfStreamException();
             }
             return(instance);
         }
         else if (num != 10)
         {
             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.Channel.Add(ChannelDescription.DeserializeLengthDelimited(stream));
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static void Serialize(Stream stream, ChannelInfo instance)
 {
     if (instance.Description == null)
     {
         throw new ArgumentNullException("Description", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.Description.GetSerializedSize());
     ChannelDescription.Serialize(stream, instance.Description);
     if (instance.Member.get_Count() > 0)
     {
         using (List <Member> .Enumerator enumerator = instance.Member.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 Member current = enumerator.get_Current();
                 stream.WriteByte(18);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 bnet.protocol.channel.Member.Serialize(stream, current);
             }
         }
     }
 }
Beispiel #16
0
 public void SetDescription(ChannelDescription val)
 {
     this.Description = val;
 }
Beispiel #17
0
 public static ChannelDescription Deserialize(Stream stream, ChannelDescription instance)
 {
     return(ChannelDescription.Deserialize(stream, instance, -1L));
 }
Beispiel #18
0
 public void Deserialize(Stream stream)
 {
     ChannelDescription.Deserialize(stream, this);
 }
Beispiel #19
0
        public override bool Equals(object obj)
        {
            ChannelDescription channelDescription = obj as ChannelDescription;

            return(channelDescription != null && this.ChannelId.Equals(channelDescription.ChannelId) && this.HasCurrentMembers == channelDescription.HasCurrentMembers && (!this.HasCurrentMembers || this.CurrentMembers.Equals(channelDescription.CurrentMembers)) && this.HasState == channelDescription.HasState && (!this.HasState || this.State.Equals(channelDescription.State)));
        }
Beispiel #20
0
 public void SetChannelDescription(bnet.protocol.channel.ChannelDescription val)
 {
     this.ChannelDescription = val;
 }
 public void AddChannel(ChannelDescription val)
 {
     this._Channel.Add(val);
 }