static public void Dump(System.String path, System.Int32 versionMajor, System.Int32 versionMinor, System.Int32 versionBuild, System.Int32 versionPrivate) { var streamWriter = new System.IO.StreamWriter(path, false); var offsets = AddressLibrary.Read(versionMajor, versionMinor, versionBuild, versionPrivate); foreach (var offset in offsets) { streamWriter.WriteLine($"{offset.Key}\t{offset.Value:X}"); } streamWriter.Close(); }
static private System.Collections.Generic.SortedList <System.UInt64, System.IntPtr> Read(System.Int32 versionMajor, System.Int32 versionMinor, System.Int32 versionBuild, System.Int32 versionPrivate) { try { var fileInfo = new System.IO.FileInfo(System.IO.Path.Combine(Main.MainModuleDirectoryName, "Data", "SKSE", "Plugins", $"version-{versionMajor}-{versionMinor}-{versionBuild}-{versionPrivate}.bin")); using var fileStream = fileInfo.OpenRead(); using var binaryReader = new System.IO.BinaryReader(fileStream, new System.Text.UTF8Encoding()); return(AddressLibrary.ReadFile(binaryReader, AddressLibrary.ReadHeader(binaryReader, versionMajor, versionMinor, versionBuild, versionPrivate))); } catch (System.Exception exception) // System.IO.FileNotFoundException { Log.Information($"{exception}"); throw; } }
static public System.Boolean MatchPattern(System.IntPtr address, System.Byte?[] pattern, System.Int32 offset) { return(AddressLibrary.MatchPattern(address + offset, pattern)); }
static public System.IntPtr GetAddress(System.UInt64 identifier, System.Int32 offset) { return(AddressLibrary.GetAddress(identifier) + offset); }