public override bool Equals(object obj) { ChannelCountDescription channelCountDescription = obj as ChannelCountDescription; if (channelCountDescription == null) { return(false); } if (!this.ServiceType.Equals(channelCountDescription.ServiceType)) { return(false); } if (!this.Program.Equals(channelCountDescription.Program)) { return(false); } if (this.HasChannelType != channelCountDescription.HasChannelType || this.HasChannelType && !this.ChannelType.Equals(channelCountDescription.ChannelType)) { return(false); } if (this.HasChannelId == channelCountDescription.HasChannelId && (!this.HasChannelId || this.ChannelId.Equals(channelCountDescription.ChannelId))) { return(true); } return(false); }
public static ChannelCountDescription DeserializeLengthDelimited(Stream stream, ChannelCountDescription instance) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; return(ChannelCountDescription.Deserialize(stream, instance, position)); }
public static ChannelCountDescription DeserializeLengthDelimited(Stream stream) { ChannelCountDescription channelCountDescription = new ChannelCountDescription(); ChannelCountDescription.DeserializeLengthDelimited(stream, channelCountDescription); return(channelCountDescription); }
public static ChannelCountDescription DeserializeLengthDelimited(Stream stream, ChannelCountDescription instance) { long num = (long)((ulong)ProtocolParser.ReadUInt32(stream)); num += stream.get_Position(); return(ChannelCountDescription.Deserialize(stream, instance, num)); }
public static ChannelCountDescription Deserialize(Stream stream, ChannelCountDescription instance, long limit) { BinaryReader binaryReader = new BinaryReader(stream); 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 == 8) { instance.ServiceType = ProtocolParser.ReadUInt32(stream); } else if (num == 21) { instance.Program = binaryReader.ReadUInt32(); } else if (num == 26) { instance.ChannelType = ProtocolParser.ReadString(stream); } else if (num != 34) { 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 IncrementChannelCountRequest Deserialize(Stream stream, IncrementChannelCountRequest instance, long limit) { if (instance.Descriptions == null) { instance.Descriptions = new List <ChannelCountDescription>(); } 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.Descriptions.Add(ChannelCountDescription.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.AgentId != null) { EntityId.DeserializeLengthDelimited(stream, instance.AgentId); } else { instance.AgentId = EntityId.DeserializeLengthDelimited(stream); } } else { if (stream.Position != limit) { throw new ProtocolBufferException("Read past max limit"); } break; } } return(instance); }
public override int GetHashCode() { int num = base.GetType().GetHashCode(); num ^= this.AgentId.GetHashCode(); using (List <ChannelCountDescription> .Enumerator enumerator = this.Descriptions.GetEnumerator()) { while (enumerator.MoveNext()) { ChannelCountDescription current = enumerator.get_Current(); num ^= current.GetHashCode(); } } return(num); }
public static void Serialize(Stream stream, IncrementChannelCountRequest instance) { if (instance.AgentId == null) { throw new ArgumentNullException("AgentId", "Required by proto specification."); } stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, instance.AgentId.GetSerializedSize()); EntityId.Serialize(stream, instance.AgentId); if (instance.Descriptions.Count > 0) { foreach (ChannelCountDescription description in instance.Descriptions) { stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, description.GetSerializedSize()); ChannelCountDescription.Serialize(stream, description); } } }
public static void Serialize(Stream stream, ChannelCountDescription instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); stream.WriteByte(8); ProtocolParser.WriteUInt32(stream, instance.ServiceType); stream.WriteByte(21); binaryWriter.Write(instance.Program); if (instance.HasChannelType) { stream.WriteByte(26); ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.ChannelType)); } if (instance.HasChannelId) { stream.WriteByte(34); ProtocolParser.WriteUInt32(stream, instance.ChannelId.GetSerializedSize()); EntityId.Serialize(stream, instance.ChannelId); } }
public uint GetSerializedSize() { uint num = 0u; uint serializedSize = this.AgentId.GetSerializedSize(); num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize); if (this.Descriptions.get_Count() > 0) { using (List <ChannelCountDescription> .Enumerator enumerator = this.Descriptions.GetEnumerator()) { while (enumerator.MoveNext()) { ChannelCountDescription current = enumerator.get_Current(); num += 1u; uint serializedSize2 = current.GetSerializedSize(); num += serializedSize2 + ProtocolParser.SizeOfUInt32(serializedSize2); } } } num += 1u; return(num); }
public static void Serialize(Stream stream, IncrementChannelCountRequest instance) { if (instance.AgentId == null) { throw new ArgumentNullException("AgentId", "Required by proto specification."); } stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, instance.AgentId.GetSerializedSize()); EntityId.Serialize(stream, instance.AgentId); if (instance.Descriptions.get_Count() > 0) { using (List <ChannelCountDescription> .Enumerator enumerator = instance.Descriptions.GetEnumerator()) { while (enumerator.MoveNext()) { ChannelCountDescription current = enumerator.get_Current(); stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, current.GetSerializedSize()); ChannelCountDescription.Serialize(stream, current); } } } }
public void AddDescriptions(ChannelCountDescription val) { this._Descriptions.Add(val); }
public static ChannelCountDescription Deserialize(Stream stream, ChannelCountDescription instance) { return(ChannelCountDescription.Deserialize(stream, instance, (long)-1)); }
public void Deserialize(Stream stream) { ChannelCountDescription.Deserialize(stream, this); }
public override bool Equals(object obj) { ChannelCountDescription channelCountDescription = obj as ChannelCountDescription; return(channelCountDescription != null && this.ServiceType.Equals(channelCountDescription.ServiceType) && this.Program.Equals(channelCountDescription.Program) && this.HasChannelType == channelCountDescription.HasChannelType && (!this.HasChannelType || this.ChannelType.Equals(channelCountDescription.ChannelType)) && this.HasChannelId == channelCountDescription.HasChannelId && (!this.HasChannelId || this.ChannelId.Equals(channelCountDescription.ChannelId))); }