public static int ReadBinary(byte[] buf, int ofs, out OsmNode node) { 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); int latCode = ProtoBuf.SignedInt32((uint)tmp); p += ProtoBuf.ReadVarInt(buf, ofs + p, out tmp); int lonCode = ProtoBuf.SignedInt32((uint)tmp); p += ProtoBuf.ReadVarInt(buf, ofs + p, out tmp); var values = tmp == 0 ? emptyValues : 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); } node = new OsmNode(id, latCode, lonCode, values); return(p); }