public List <string> DumpTextByPointer(uint initialPointer) { var pointers = ScanForPointers(); int startingIndex = -1; for (int i = 0; i < pointers.Count; i++) { if (pointers[i].At == initialPointer) { startingIndex = i; break; } } if (startingIndex == -1) { throw new ArgumentException("No such pointer in file"); } Console.WriteLine("Looking for adjacent text..."); int dumpStartIndex = startingIndex; // Look back while (true) { var pointerToPointer = pointers .DefaultIfEmpty(null) .FirstOrDefault(ptr => ptr.PointsAt == pointers[dumpStartIndex].At); if (pointerToPointer != null) { break; } if (dumpStartIndex == 0) { break; } if (pointers[dumpStartIndex].At - pointers[dumpStartIndex - 1].At != 4) { break; } dumpStartIndex--; } // Look ahead int dumpEndIndex = startingIndex; while (true) { if (dumpEndIndex >= pointers.Count - 1) { break; } if (pointers[dumpEndIndex + 1].At - pointers[dumpEndIndex].At != 4) { break; } var pointerToPointer = pointers .DefaultIfEmpty(null) .FirstOrDefault(ptr => ptr.PointsAt == pointers[dumpEndIndex + 1].At); if (pointerToPointer != null) { break; } dumpEndIndex++; } Console.WriteLine("Writing result..."); var results = new List <string>(); var fontMap = new FontMap(settings.PathToFontMap); for (int i = dumpStartIndex; i <= dumpEndIndex; i++) { uint offset = pointers[i].PointsAt; var blockLine = blocks .Where(block => (block.offset <= offset) && (block.offset + block.length > offset)) .Select(block => block.lines) .First() .First(line => line.Offset == offset); string textLine = fontMap.FromBinary(blockLine.Data); results.Add($"{pointers[i].At}|{offset}|{textLine}"); } return(results); }