using System;
using System.Collections.Generic;
using Dalamud.Game;
namespace XivCommon;
internal static class SigScannerExt {
///
/// Scan for a signature in memory.
///
/// SigScanner to use for scanning
/// signature to search for
/// pointer where signature was found or if not found
/// name of this signature - if specified, a warning will be printed if the signature could not be found
/// true if signature was found
internal static bool TryScanText(this ISigScanner scanner, string sig, out IntPtr result, string? name = null) {
result = IntPtr.Zero;
try {
result = scanner.ScanText(sig);
return true;
} catch (KeyNotFoundException) {
if (name != null) {
Util.PrintMissingSig(name);
}
return false;
}
}
}