namespace OsmXmlToRegionConverter; public class TmpNode { public ulong id { get; } public Coordinates coordinates { get; } public TmpNode(ulong id, float latitude, float longitude) { this.id = id; this.coordinates = new Coordinates(latitude, longitude); } public TmpNode(ulong id, Coordinates coordinates) { this.id = id; this.coordinates = coordinates; } public const int ByteSize = sizeof(ulong) + Coordinates.ByteSize; public static TmpNode FromBytes(byte[] bytes) { using (MemoryStream m = new MemoryStream(bytes)) { using (BinaryReader r = new BinaryReader(m)) { ulong id = r.ReadUInt64(); byte coordinatesType = r.ReadByte(); byte[] coordinateBytes = r.ReadBytes(sizeof(float) * 2); Coordinates coordinates = Coordinates.FromBytes(coordinateBytes); return new TmpNode(id, coordinates); } } } }