namespace TftpServer.Utils { internal static class ExtensionMethods { public static int ScanNullTerminated(this byte[] bytes, long offset) { return ScanTo(bytes, offset, 0); } public static int ScanTo(this byte[] bytes, long offset, byte match) { for (var i = offset; i < bytes.Length; i++) { if (bytes[i] == match) { return (int)(i - offset); } } return -1; } } }