public static bnet.protocol.Path DeserializeLengthDelimited(Stream stream, bnet.protocol.Path instance) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; return(bnet.protocol.Path.Deserialize(stream, instance, position)); }
public static bnet.protocol.Path Deserialize(Stream stream, bnet.protocol.Path instance, long limit) { if (instance.Ordinal == null) { instance.Ordinal = 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.Ordinal.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 void Serialize(Stream stream, bnet.protocol.Path instance) { if (instance.Ordinal.Count > 0) { stream.WriteByte(10); uint num = 0; foreach (uint ordinal in instance.Ordinal) { num += ProtocolParser.SizeOfUInt32(ordinal); } ProtocolParser.WriteUInt32(stream, num); foreach (uint ordinal1 in instance.Ordinal) { ProtocolParser.WriteUInt32(stream, ordinal1); } } }
public override bool Equals(object obj) { bnet.protocol.Path path = obj as bnet.protocol.Path; if (path == null) { return(false); } if (this.Ordinal.Count != path.Ordinal.Count) { return(false); } for (int i = 0; i < this.Ordinal.Count; i++) { if (!this.Ordinal[i].Equals(path.Ordinal[i])) { return(false); } } return(true); }
public static bnet.protocol.Path Deserialize(Stream stream, bnet.protocol.Path instance) { return(bnet.protocol.Path.Deserialize(stream, instance, (long)-1)); }
public static bnet.protocol.Path DeserializeLengthDelimited(Stream stream) { bnet.protocol.Path path = new bnet.protocol.Path(); bnet.protocol.Path.DeserializeLengthDelimited(stream, path); return(path); }