using System.Diagnostics; using System.IO; using Dalamud.IoC; using Dalamud.IoC.Internal; namespace Dalamud.Game; /// /// A SigScanner facilitates searching for memory signatures in a given ProcessModule. /// [PluginInterface] [InterfaceVersion("1.0")] [ServiceManager.ProvidedService] #pragma warning disable SA1015 [ResolveVia] #pragma warning restore SA1015 internal class TargetSigScanner : SigScanner, IPublicDisposableService { /// /// Initializes a new instance of the class. /// /// Whether or not to copy the module upon initialization for search operations to use, as to not get disturbed by possible hooks. /// File used to cached signatures. public TargetSigScanner(bool doCopy = false, FileInfo? cacheFile = null) : base(Process.GetCurrentProcess().MainModule!, doCopy, cacheFile) { } /// void IInternalDisposableService.DisposeService() { if (this.IsService) this.DisposeCore(); } /// void IPublicDisposableService.MarkDisposeOnlyFromService() => this.IsService = true; }