public static BindResponse DeserializeLengthDelimited(Stream stream) { BindResponse bindResponse = new BindResponse(); BindResponse.DeserializeLengthDelimited(stream, bindResponse); return(bindResponse); }
public static BindResponse DeserializeLengthDelimited(Stream stream, BindResponse instance) { long num = (long)((ulong)ProtocolParser.ReadUInt32(stream)); num += stream.get_Position(); return(BindResponse.Deserialize(stream, instance, num)); }
public static void Serialize(Stream stream, BindResponse instance) { if (instance.ImportedServiceId.get_Count() > 0) { stream.WriteByte(10); uint num = 0u; using (List <uint> .Enumerator enumerator = instance.ImportedServiceId.GetEnumerator()) { while (enumerator.MoveNext()) { uint current = enumerator.get_Current(); num += ProtocolParser.SizeOfUInt32(current); } } ProtocolParser.WriteUInt32(stream, num); using (List <uint> .Enumerator enumerator2 = instance.ImportedServiceId.GetEnumerator()) { while (enumerator2.MoveNext()) { uint current2 = enumerator2.get_Current(); ProtocolParser.WriteUInt32(stream, current2); } } } }
public static BindResponse DeserializeLengthDelimited(Stream stream, BindResponse instance) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; return(BindResponse.Deserialize(stream, instance, position)); }
public static BindResponse Deserialize(Stream stream, BindResponse instance, long limit) { if (instance.ImportedServiceId == null) { instance.ImportedServiceId = new List <uint>(); } 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) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; while (stream.Position < position) { instance.ImportedServiceId.Add(ProtocolParser.ReadUInt32(stream)); } if (stream.Position != position) { throw new ProtocolBufferException("Read too many bytes in packed data"); } } 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 static BindResponse Deserialize(Stream stream, BindResponse instance, long limit) { if (instance.ImportedServiceId == null) { instance.ImportedServiceId = new List <uint>(); } 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) { 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 { long num3 = (long)((ulong)ProtocolParser.ReadUInt32(stream)); num3 += stream.get_Position(); while (stream.get_Position() < num3) { instance.ImportedServiceId.Add(ProtocolParser.ReadUInt32(stream)); } if (stream.get_Position() != num3) { throw new ProtocolBufferException("Read too many bytes in packed data"); } } } } if (stream.get_Position() == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }
public static void Serialize(Stream stream, BindResponse instance) { if (instance.ImportedServiceId.Count > 0) { stream.WriteByte(10); uint num = 0; foreach (uint importedServiceId in instance.ImportedServiceId) { num += ProtocolParser.SizeOfUInt32(importedServiceId); } ProtocolParser.WriteUInt32(stream, num); foreach (uint importedServiceId1 in instance.ImportedServiceId) { ProtocolParser.WriteUInt32(stream, importedServiceId1); } } }
public override bool Equals(object obj) { BindResponse bindResponse = obj as BindResponse; if (bindResponse == null) { return(false); } if (this.ImportedServiceId.get_Count() != bindResponse.ImportedServiceId.get_Count()) { return(false); } for (int i = 0; i < this.ImportedServiceId.get_Count(); i++) { if (!this.ImportedServiceId.get_Item(i).Equals(bindResponse.ImportedServiceId.get_Item(i))) { return(false); } } return(true); }
public override bool Equals(object obj) { BindResponse bindResponse = obj as BindResponse; if (bindResponse == null) { return(false); } if (this.ImportedServiceId.Count != bindResponse.ImportedServiceId.Count) { return(false); } for (int i = 0; i < this.ImportedServiceId.Count; i++) { if (!this.ImportedServiceId[i].Equals(bindResponse.ImportedServiceId[i])) { return(false); } } return(true); }
public static void Serialize(Stream stream, ConnectResponse instance) { if (instance.ServerId == null) { throw new ArgumentNullException("ServerId", "Required by proto specification."); } stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, instance.ServerId.GetSerializedSize()); ProcessId.Serialize(stream, instance.ServerId); if (instance.HasClientId) { stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, instance.ClientId.GetSerializedSize()); ProcessId.Serialize(stream, instance.ClientId); } if (instance.HasBindResult) { stream.WriteByte(24); ProtocolParser.WriteUInt32(stream, instance.BindResult); } if (instance.HasBindResponse) { stream.WriteByte(34); ProtocolParser.WriteUInt32(stream, instance.BindResponse.GetSerializedSize()); BindResponse.Serialize(stream, instance.BindResponse); } if (instance.HasContentHandleArray) { stream.WriteByte(42); ProtocolParser.WriteUInt32(stream, instance.ContentHandleArray.GetSerializedSize()); ConnectionMeteringContentHandles.Serialize(stream, instance.ContentHandleArray); } if (instance.HasServerTime) { stream.WriteByte(48); ProtocolParser.WriteUInt64(stream, instance.ServerTime); } }
public static BindResponse Deserialize(Stream stream, BindResponse instance) { return(BindResponse.Deserialize(stream, instance, -1L)); }
public void Deserialize(Stream stream) { BindResponse.Deserialize(stream, this); }
public void SetBindResponse(BindResponse val) { this.BindResponse = val; }
public static ConnectResponse Deserialize(Stream stream, ConnectResponse instance, long limit) { 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) { if (num != 24) { if (num != 34) { if (num != 42) { if (num != 48) { 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.ServerTime = ProtocolParser.ReadUInt64(stream); } } else if (instance.ContentHandleArray == null) { instance.ContentHandleArray = ConnectionMeteringContentHandles.DeserializeLengthDelimited(stream); } else { ConnectionMeteringContentHandles.DeserializeLengthDelimited(stream, instance.ContentHandleArray); } } else if (instance.BindResponse == null) { instance.BindResponse = BindResponse.DeserializeLengthDelimited(stream); } else { BindResponse.DeserializeLengthDelimited(stream, instance.BindResponse); } } else { instance.BindResult = ProtocolParser.ReadUInt32(stream); } } else if (instance.ClientId == null) { instance.ClientId = ProcessId.DeserializeLengthDelimited(stream); } else { ProcessId.DeserializeLengthDelimited(stream, instance.ClientId); } } else if (instance.ServerId == null) { instance.ServerId = ProcessId.DeserializeLengthDelimited(stream); } else { ProcessId.DeserializeLengthDelimited(stream, instance.ServerId); } } if (stream.Position == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }