private void Process() { int steep = 0; var pointers = _manager.GetChunkPointersBySteep(steep++); while (pointers.Any()) { for (int i = 0; i < pointers.Count(); i += 2) { var first = pointers.ElementAt(i); string second = null; if (i + 1 < pointers.Count()) { second = pointers.ElementAt(i + 1); } if (first != null && second != null) { Merge(first, second, steep, i / 2 + i % 2, pointers.Count() <= 2 ? _output : null); } else { Copy(first, steep, i / 2 + i % 2); } } _manager.DeleteChunksBySteep(steep - 1); pointers = _manager.GetChunkPointersBySteep(steep++); } }
private void Process() { long steep = 0; var pointers = _manager.GetChunkPointersBySteep(steep++).ToArray(); while (pointers.Length > 0) { for (int i = 0; i < pointers.Length; i += 2) { var first = pointers[i]; string second = null; if (i + 1 < pointers.Length) { second = pointers[i + 1]; } if (first != null && second != null) { Merge(first, second, steep, i / 2 + i % 2, pointers.Length <= 2 ? _output : null); } else { Copy(first, steep, i / 2 + i % 2); } } _manager.DeleteChunksBySteep(steep - 1); pointers = _manager.GetChunkPointersBySteep(steep++).ToArray(); } }