public static BindRequest Deserialize(Stream stream, BindRequest instance, long limit) { BinaryReader binaryReader = new BinaryReader(stream); if (instance.ImportedServiceHash == null) { instance.ImportedServiceHash = new List <uint>(); } if (instance.ExportedService == null) { instance.ExportedService = new List <BoundService>(); } 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) { if (num != 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.ExportedService.Add(BoundService.DeserializeLengthDelimited(stream)); } } else { long num2 = (long)((ulong)ProtocolParser.ReadUInt32(stream)); num2 += stream.Position; while (stream.Position < num2) { instance.ImportedServiceHash.Add(binaryReader.ReadUInt32()); } if (stream.Position != num2) { throw new ProtocolBufferException("Read too many bytes in packed data"); } } } if (stream.Position == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }
public static BoundService DeserializeLengthDelimited(Stream stream) { BoundService boundService = new BoundService(); BoundService.DeserializeLengthDelimited(stream, boundService); return(boundService); }
public static BoundService DeserializeLengthDelimited(Stream stream, BoundService instance) { long num = (long)((ulong)ProtocolParser.ReadUInt32(stream)); num += stream.get_Position(); return(BoundService.Deserialize(stream, instance, num)); }
public static BoundService DeserializeLengthDelimited(Stream stream, BoundService instance) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; return(BoundService.Deserialize(stream, instance, position)); }
public uint GetSerializedSize() { uint num = 0u; if (this.ImportedServiceHash.get_Count() > 0) { num += 1u; uint num2 = num; using (List <uint> .Enumerator enumerator = this.ImportedServiceHash.GetEnumerator()) { while (enumerator.MoveNext()) { uint current = enumerator.get_Current(); num += 4u; } } num += ProtocolParser.SizeOfUInt32(num - num2); } if (this.ExportedService.get_Count() > 0) { using (List <BoundService> .Enumerator enumerator2 = this.ExportedService.GetEnumerator()) { while (enumerator2.MoveNext()) { BoundService current2 = enumerator2.get_Current(); num += 1u; uint serializedSize = current2.GetSerializedSize(); num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize); } } } return(num); }
public static void Serialize(Stream stream, BindRequest instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); if (instance.ImportedServiceHash.get_Count() > 0) { stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, (uint)(4 * instance.ImportedServiceHash.get_Count())); using (List <uint> .Enumerator enumerator = instance.ImportedServiceHash.GetEnumerator()) { while (enumerator.MoveNext()) { uint current = enumerator.get_Current(); binaryWriter.Write(current); } } } if (instance.ExportedService.get_Count() > 0) { using (List <BoundService> .Enumerator enumerator2 = instance.ExportedService.GetEnumerator()) { while (enumerator2.MoveNext()) { BoundService current2 = enumerator2.get_Current(); stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize()); BoundService.Serialize(stream, current2); } } } }
public static void Serialize(Stream stream, BoundService instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); stream.WriteByte(13); binaryWriter.Write(instance.Hash); stream.WriteByte(16); ProtocolParser.WriteUInt32(stream, instance.Id); }
public static BoundService Deserialize(Stream stream, BoundService instance, long limit) { BinaryReader binaryReader = new BinaryReader(stream); 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 == 13) { instance.Hash = binaryReader.ReadUInt32(); } else if (num == 16) { instance.Id = ProtocolParser.ReadUInt32(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 (stream.Position != limit) { throw new ProtocolBufferException("Read past max limit"); } break; } } return(instance); }
public override bool Equals(object obj) { BoundService boundService = obj as BoundService; if (boundService == null) { return(false); } if (!this.Hash.Equals(boundService.Hash)) { return(false); } if (!this.Id.Equals(boundService.Id)) { return(false); } return(true); }
public static BoundService Deserialize(Stream stream, BoundService instance, long limit) { BinaryReader binaryReader = new BinaryReader(stream); while (limit < 0L || stream.get_Position() < limit) { int num = stream.ReadByte(); if (num == -1) { if (limit >= 0L) { throw new EndOfStreamException(); } return(instance); } else { switch (num) { case 13: instance.Hash = binaryReader.ReadUInt32(); continue; case 16: instance.Id = ProtocolParser.ReadUInt32(stream); continue; } 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); } } if (stream.get_Position() == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }
public override int GetHashCode() { int num = base.GetType().GetHashCode(); using (List <uint> .Enumerator enumerator = this.ImportedServiceHash.GetEnumerator()) { while (enumerator.MoveNext()) { uint current = enumerator.get_Current(); num ^= current.GetHashCode(); } } using (List <BoundService> .Enumerator enumerator2 = this.ExportedService.GetEnumerator()) { while (enumerator2.MoveNext()) { BoundService current2 = enumerator2.get_Current(); num ^= current2.GetHashCode(); } } return(num); }
public static void Serialize(Stream stream, BindRequest instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); if (instance.ImportedServiceHash.Count > 0) { stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, (uint)(4 * instance.ImportedServiceHash.Count)); foreach (uint value in instance.ImportedServiceHash) { binaryWriter.Write(value); } } if (instance.ExportedService.Count > 0) { foreach (BoundService boundService in instance.ExportedService) { stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, boundService.GetSerializedSize()); BoundService.Serialize(stream, boundService); } } }
public void AddExportedService(BoundService val) { this._ExportedService.Add(val); }
public void Serialize(Stream stream) { BoundService.Serialize(stream, this); }
public static BoundService Deserialize(Stream stream, BoundService instance) { return(BoundService.Deserialize(stream, instance, -1L)); }
public override bool Equals(object obj) { BoundService boundService = obj as BoundService; return(boundService != null && this.Hash.Equals(boundService.Hash) && this.Id.Equals(boundService.Id)); }