返回提交历史
Modified
XFEExtension.NetCore.MemoryEditor.sln
+0
-16
Modified
XFEExtension.NetCore.MemoryEditor/MemoryEditor.cs
+25
-0
Modified
XFEExtension.NetCore.MemoryEditor/XFEExtension.NetCore.MemoryEditor.csproj
+3
-4
XFEstudio/XFEExtension.NetCore.MemoryEditor
add-新增ReadMemory的size重载,使得用户可以直接读取指定长度的buffer
534eb2c
代码差异
3 个文件
+28
-20
@@ -22,19 +22,3 @@ Global
22
22
SolutionGuid = {5652406C-CF19-4708-BA94-E51808552081}
23
23
EndGlobalSection
24
24
EndGlobal
25
CPU.ActiveCfg = Debug|Any CPU
26
{DBFE2E7A-C727-4E8D-AD9E-83E7EA36F937}.Debug|Any CPU.Build.0 = Debug|Any CPU
27
{DBFE2E7A-C727-4E8D-AD9E-83E7EA36F937}.Release|Any CPU.ActiveCfg = Release|Any CPU
28
{DBFE2E7A-C727-4E8D-AD9E-83E7EA36F937}.Release|Any CPU.Build.0 = Release|Any CPU
29
EndGlobalSection
30
GlobalSection(SolutionProperties) = preSolution
31
HideSolutionNode = FALSE
32
EndGlobalSection
33
GlobalSection(ExtensibilityGlobals) = postSolution
34
SolutionGuid = {5652406C-CF19-4708-BA94-E51808552081}
35
EndGlobalSection
36
EndGlobal
37
Section(ExtensibilityGlobals) = postSolution
38
SolutionGuid = {5652406C-CF19-4708-BA94-E51808552081}
39
EndGlobalSection
40
EndGlobal
@@ -80,6 +80,14 @@ public partial class MemoryEditor : MemoryListenerManagerBase, IDisposable
80
80
/// <returns>是否读取成功</returns>
81
81
public bool ReadMemory<T>(nint address, out T result) where T : struct => ReadMemory(ProcessHandler, address, out result);
82
82
/// <summary>
83
/// 读取指定地址的内存
84
/// </summary>
85
/// <param name="address">指定地址</param>
86
/// <param name="size">读取长度</param>
87
/// <param name="buffer">读取结果</param>
88
/// <returns>是否读取成功</returns>
89
public bool ReadMemory(nint address, int size, out byte[] buffer) => ReadMemory(ProcessHandler, address, size, out buffer);
90
/// <summary>
83
91
/// 在指定内存地址中写入数据
84
92
/// </summary>
85
93
/// <typeparam name="T">数据类型(int,float,long等)</typeparam>
@@ -236,6 +244,23 @@ public partial class MemoryEditor : MemoryListenerManagerBase, IDisposable
236
244
}
237
245
}
238
246
/// <summary>
247
/// 读取指定地址的内存
248
/// </summary>
249
/// <param name="processHandle">进程句柄</param>
250
/// <param name="address">指定地址</param>
251
/// <param name="size">读取的长度</param>
252
/// <param name="buffer">读取结果</param>
253
/// <returns>是否读取成功</returns>
254
public static bool ReadMemory(nint processHandle, nint address, int size, out byte[] buffer)
255
{
256
unsafe
257
{
258
buffer = new byte[size];
259
var boolResult = ReadProcessMemory(processHandle, address, buffer, (uint)size, out _);
260
return boolResult;
261
}
262
}
263
/// <summary>
239
264
/// 读取指定地址的内存<br/>
240
265
/// 如非有意使用,请转到<seealso cref="ReadMemory{T}(nint, nint, out T)"/>
241
266
/// </summary>
@@ -13,14 +13,13 @@
13
13
<PackageReadmeFile>README.md</PackageReadmeFile>
14
14
<RepositoryUrl>https://github.com/XFEstudio/XFEExtension.NetCore.MemoryEditor.git</RepositoryUrl>
15
15
<PackageTags>XFE;XFEExtension;MemoryEdit;Memory</PackageTags>
16
<PackageReleaseNotes>fix-修复部分API文档说明错误
17
change-现在,内存地址构建器和内存管理器构建器只能通过方法更改内部属性值</PackageReleaseNotes>
16
<PackageReleaseNotes>add-新增ReadMemory的size重载,使得用户可以直接读取指定长度的buffer</PackageReleaseNotes>
18
17
<Copyright>寰宇朽力网络科技版权所有</Copyright>
19
18
<PackageProjectUrl>https://github.com/XFEstudio/XFEExtension.NetCore.MemoryEditor.git</PackageProjectUrl>
20
19
<GenerateDocumentationFile>True</GenerateDocumentationFile>
21
20
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
22
21
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
23
<Version>2.0.4</Version>
22
<Version>2.1.0</Version>
24
23
</PropertyGroup>
25
24
26
25
<ItemGroup>
@@ -39,7 +38,7 @@ change-现在,内存地址构建器和内存管理器构建器只能通过方
39
38
</ItemGroup>
40
39
41
40
<ItemGroup>
42
<PackageReference Include="XFEExtension.NetCore" Version="2.9.1" />
41
<PackageReference Include="XFEExtension.NetCore" Version="3.3.*" />
43
42
</ItemGroup>
44
43
45
44
</Project>