public static int ReadBinary(byte[] buf, int ofs, out OsmRelation relation) { int p = 0; ulong tmp; p += ProtoBuf.ReadVarInt(buf, ofs + p, out tmp); long id = (long)tmp; p += ProtoBuf.ReadVarInt(buf, ofs + p, out tmp); var values = new KeyValuePair <string, string> [tmp]; for (int i = 0; i < values.Length; i++) { string key, val; p += ProtoBuf.ReadString(buf, ofs + p, out key); p += ProtoBuf.ReadString(buf, ofs + p, out val); values[i] = new KeyValuePair <string, string>(key, val); } p += ProtoBuf.ReadVarInt(buf, ofs + p, out tmp); var members = new OsmRelationMember[tmp]; for (int i = 0; i < members.Length; i++) { p += OsmRelationMember.ReadBinary(buf, ofs + p, out members[i]); } relation = new OsmRelation(id, values, members); return(p); }
public static int ReadBinary(byte[] buf, int ofs, out OsmRelationMember member) { int p = 0; ulong tmp; p += ProtoBuf.ReadVarInt(buf, ofs + p, out tmp); long id = (long)tmp; var type = (MemberType)buf[ofs + p]; p++; string str; p += ProtoBuf.ReadString(buf, ofs + p, out str); member = new OsmRelationMember(id, type, str); return(p); }