/// <summary> Outputs all block changes which affect the given coordinates. </summary> /// <remarks> You must lock using Locker.AccquireRead() **before** entering this method. </remarks> public void FindChangesAt(ushort x, ushort y, ushort z, Action <BlockDBEntry> output) { if (!File.Exists(FilePath)) { FindInMemoryAt(x, y, z, output); return; } Vec3U16 dims; using (Stream s = OpenRead()) { BlockDBFile format = BlockDBFile.ReadHeader(s, out dims); if (x >= dims.X || y >= dims.Y || z >= dims.Z) { return; } int index = (y * dims.Z + z) * dims.X + x; format.FindChangesAt(s, index, output); } FindInMemoryAt(x, y, z, output); }
/// <summary> Finds all block changes which affect the given coordinates. </summary> public void FindChangesAt(ushort x, ushort y, ushort z, Action <BlockDBEntry> output) { using (IDisposable readLock = locker.AccquireReadLock()) { if (!File.Exists(FilePath)) { return; } using (Stream s = File.OpenRead(FilePath)) { Vec3U16 dims; BlockDBFile.ReadHeader(s, out dims); if (x >= dims.X || y >= dims.Y || z >= dims.Z) { return; } int index = (y * dims.Z + z) * dims.X + x; BlockDBFile.FindChangesAt(s, index, output); } } }