XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEExtension.NetCore.MemoryEditor

【DLL】内存读写工具/编辑器

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFEExtension.NetCore.MemoryEditor

修复部分bug

980c4fb
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

9 个文件 +39 -22
Modified XFEExtension.NetCore.MemoryEditor.sln +7 -10
@@ -4,12 +4,18 @@ VisualStudioVersion = 17.9.34728.123
4 4 MinimumVisualStudioVersion = 10.0.40219.1
5 5 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XFEExtension.NetCore.MemoryEditor", "XFEExtension.NetCore.MemoryEditor\XFEExtension.NetCore.MemoryEditor.csproj", "{DBFE2E7A-C727-4E8D-AD9E-83E7EA36F937}"
6 6 EndProject
7 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SeaOfRadiationEditor", "..\SeaOfRadiationEditor\SeaOfRadiationEditor\SeaOfRadiationEditor.csproj", "{D4D904CF-7A48-4393-9B1F-DCD5D50F0B47}"
8 EndProject
7 9 Global
8 10 GlobalSection(SolutionConfigurationPlatforms) = preSolution
9 11 Debug|Any CPU = Debug|Any CPU
10 12 Release|Any CPU = Release|Any CPU
11 13 EndGlobalSection
12 14 GlobalSection(ProjectConfigurationPlatforms) = postSolution
15 {D4D904CF-7A48-4393-9B1F-DCD5D50F0B47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
16 {D4D904CF-7A48-4393-9B1F-DCD5D50F0B47}.Debug|Any CPU.Build.0 = Debug|Any CPU
17 {D4D904CF-7A48-4393-9B1F-DCD5D50F0B47}.Release|Any CPU.ActiveCfg = Release|Any CPU
18 {D4D904CF-7A48-4393-9B1F-DCD5D50F0B47}.Release|Any CPU.Build.0 = Release|Any CPU
13 19 {DBFE2E7A-C727-4E8D-AD9E-83E7EA36F937}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
14 20 {DBFE2E7A-C727-4E8D-AD9E-83E7EA36F937}.Debug|Any CPU.Build.0 = Debug|Any CPU
15 21 {DBFE2E7A-C727-4E8D-AD9E-83E7EA36F937}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -22,16 +28,7 @@ Global
22 28 SolutionGuid = {5652406C-CF19-4708-BA94-E51808552081}
23 29 EndGlobalSection
24 30 EndGlobal
25 {7D09E8EC-562E-496F-8362-5BEBD541238D}.Release|Any CPU.Build.0 = Release|Any CPU
26 {DBFE2E7A-C727-4E8D-AD9E-83E7EA36F937}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 {DBFE2E7A-C727-4E8D-AD9E-83E7EA36F937}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 {DBFE2E7A-C727-4E8D-AD9E-83E7EA36F937}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 {DBFE2E7A-C727-4E8D-AD9E-83E7EA36F937}.Release|Any CPU.Build.0 = Release|Any CPU
30 EndGlobalSection
31 GlobalSection(SolutionProperties) = preSolution
32 HideSolutionNode = FALSE
33 EndGlobalSection
34 GlobalSection(ExtensibilityGlobals) = postSolution
31 Section(ExtensibilityGlobals) = postSolution
35 32 SolutionGuid = {5652406C-CF19-4708-BA94-E51808552081}
36 33 EndGlobalSection
37 34 EndGlobal
Modified XFEExtension.NetCore.MemoryEditor/Manager/DynamicMemoryItem.cs +2 -0
@@ -37,6 +37,7 @@ public abstract class DynamicMemoryItem(string name, Func<nint?> memoryAddressGe
37 37 {
38 38 if (Listener is null)
39 39 throw new InvalidOperationException($"{nameof(Listener)} 监听器为空");
40 IsListening = false;
40 41 await Listener.StopListen();
41 42 }
42 43 /// <inheritdoc/>
@@ -45,6 +46,7 @@ public abstract class DynamicMemoryItem(string name, Func<nint?> memoryAddressGe
45 46 {
46 47 if (Listener is null)
47 48 throw new InvalidOperationException($"{nameof(Listener)} 监听器为空");
49 IsListening = true;
48 50 memoryEditor.ListenerManager.IsListening = true;
49 51 await Listener.StartListen(processHandler, frequency);
50 52 }
Modified XFEExtension.NetCore.MemoryEditor/Manager/MemoryItem.cs +4 -1
@@ -89,6 +89,9 @@ public abstract class MemoryItem
89 89 this.memoryEditor = memoryEditor;
90 90 MemoryItemType = memoryItemType;
91 91 Name = name;
92 memoryEditor.ListeningStateChanged += (sender, e) => IsListening = e;
92 memoryEditor.ListeningStateChanged += (sender, e) =>
93 {
94 IsListening = e;
95 };
93 96 }
94 97 }
Modified XFEExtension.NetCore.MemoryEditor/Manager/MemoryManager.cs +4 -0
@@ -32,6 +32,10 @@ public abstract class MemoryManager : IMemoryManager
32 32 /// </summary>
33 33 public nint ProcessHandler { get => Editor.ProcessHandler; set => Editor.ProcessHandler = value; }
34 34 /// <summary>
35 /// 目标进程名称
36 /// </summary>
37 public string ProcessName { get => Editor.ProcessName; set => Editor.ProcessName = value; }
38 /// <summary>
35 39 /// 当目标进程退出后,是否自动重新获取进程
36 40 /// </summary>
37 41 public bool AutoReacquireProcess { get => Editor.AutoReacquireProcess; set => Editor.AutoReacquireProcess = value; }
Modified XFEExtension.NetCore.MemoryEditor/Manager/MemoryManagerBuilder.cs +9 -6
@@ -65,10 +65,11 @@ public abstract class MemoryManagerBuilder()
65 65 var manager = new StaticMemoryManagerImpl(builders)
66 66 {
67 67 AutoReacquireProcess = AutoReacquireProcess,
68 ReacquireProcessFrequency = ReacquireProcessFrequency
68 ReacquireProcessFrequency = ReacquireProcessFrequency,
69 ProcessName = ProcessName
69 70 };
70 71 if (FindProcessWhenCreate)
71 _ = manager.WaitProcessEnter(ProcessName);
72 _ = manager.WaitProcessEnter(manager.ProcessName);
72 73 return manager;
73 74 }
74 75 /// <summary>
@@ -81,10 +82,11 @@ public abstract class MemoryManagerBuilder()
81 82 var manager = new DynamicMemoryManagerImpl(builders)
82 83 {
83 84 AutoReacquireProcess = AutoReacquireProcess,
84 ReacquireProcessFrequency = ReacquireProcessFrequency
85 ReacquireProcessFrequency = ReacquireProcessFrequency,
86 ProcessName = ProcessName
85 87 };
86 88 if (FindProcessWhenCreate)
87 _ = manager.WaitProcessEnter(ProcessName);
89 _ = manager.WaitProcessEnter(manager.ProcessName);
88 90 return manager;
89 91 }
90 92 /// <summary>
@@ -97,10 +99,11 @@ public abstract class MemoryManagerBuilder()
97 99 var manager = new UpdatableMemoryManager(builders)
98 100 {
99 101 AutoReacquireProcess = AutoReacquireProcess,
100 ReacquireProcessFrequency = ReacquireProcessFrequency
102 ReacquireProcessFrequency = ReacquireProcessFrequency,
103 ProcessName = ProcessName
101 104 };
102 105 if (FindProcessWhenCreate)
103 _ = manager.WaitProcessEnter(ProcessName);
106 _ = manager.WaitProcessEnter(manager.ProcessName);
104 107 return manager;
105 108 }
106 109 }
Modified XFEExtension.NetCore.MemoryEditor/Manager/StaticMemoryItem.cs +2 -0
@@ -37,6 +37,7 @@ public abstract class StaticMemoryItem(string name, nint memoryAddress, Type mem
37 37 {
38 38 if (Listener is null)
39 39 throw new InvalidOperationException($"{nameof(Listener)} 监听器为空");
40 IsListening = false;
40 41 await Listener.StopListen();
41 42 }
42 43 /// <inheritdoc/>
@@ -45,6 +46,7 @@ public abstract class StaticMemoryItem(string name, nint memoryAddress, Type mem
45 46 {
46 47 if (Listener is null)
47 48 throw new InvalidOperationException($"{nameof(Listener)} 监听器为空");
49 IsListening = true;
48 50 memoryEditor.ListenerManager.IsListening = true;
49 51 await Listener.StartListen(processHandler, frequency);
50 52 }
Modified XFEExtension.NetCore.MemoryEditor/Manager/UpdatableMemoryItem.cs +2 -0
@@ -58,6 +58,7 @@ public abstract class UpdatableMemoryItem(string name, Func<nint?> memoryAddress
58 58 {
59 59 if (Listener is null)
60 60 throw new InvalidOperationException($"{nameof(Listener)} 监听器为空");
61 IsListening = false;
61 62 await Listener.StopListen();
62 63 }
63 64 /// <inheritdoc/>
@@ -83,6 +84,7 @@ public abstract class UpdatableMemoryItem(string name, Func<nint?> memoryAddress
83 84 {
84 85 if (Listener is null)
85 86 throw new InvalidOperationException($"{nameof(Listener)} 监听器为空");
87 IsListening = true;
86 88 memoryEditor.ListenerManager.IsListening = true;
87 89 await Listener.StartListen(processHandler, frequency);
88 90 }
Modified XFEExtension.NetCore.MemoryEditor/MemoryEditor.cs +4 -0
@@ -37,6 +37,10 @@ public partial class MemoryEditor : MemoryListenerManagerBase, IDisposable
37 37 /// </summary>
38 38 public nint ProcessHandler { get => listenerManager.ProcessHandler; set => listenerManager.ProcessHandler = value; }
39 39 /// <summary>
40 /// 目标进程名称
41 /// </summary>
42 public string ProcessName { get => listenerManager.ProcessName; set => listenerManager.ProcessName = value; }
43 /// <summary>
40 44 /// 内存监听器
41 45 /// </summary>
42 46 public MemoryListenerManager ListenerManager
Modified XFEExtension.NetCore.MemoryEditor/MemoryListener.cs +5 -5
@@ -46,7 +46,7 @@ public abstract class MemoryListener(string customName, Type memoryAddressType)
46 46 public bool IsListening
47 47 {
48 48 get { return isListening; }
49 set { isListening = value; listeningStateChanged?.Invoke(this, value); }
49 set { listeningStateChanged?.Invoke(this, value); isListening = value; }
50 50 }
51 51 private protected nint processHandler;
52 52 /// <summary>
@@ -66,9 +66,9 @@ public abstract class MemoryListener(string customName, Type memoryAddressType)
66 66 /// <exception cref="InvalidOperationException">监听已启动,无法重复启动监听</exception>
67 67 public virtual async Task StartListen(nint processHandler, TimeSpan? frequency)
68 68 {
69 if (isListening)
69 if (IsListening)
70 70 throw new InvalidOperationException("监听已启动,无法重复启动监听");
71 isListening = true;
71 IsListening = true;
72 72 this.frequency = frequency ?? TimeSpan.FromMilliseconds(1);
73 73 this.processHandler = processHandler;
74 74 await Task.CompletedTask;
@@ -87,7 +87,7 @@ public abstract class MemoryListener(string customName, Type memoryAddressType)
87 87 /// <returns></returns>
88 88 public async Task StopListen()
89 89 {
90 isListening = false;
90 IsListening = false;
91 91 if (CurrentListeningTask is not null)
92 92 await CurrentListeningTask;
93 93 }
@@ -101,7 +101,7 @@ public abstract class MemoryListener(string customName, Type memoryAddressType)
101 101 {
102 102 if (disposing)
103 103 {
104 isListening = false;
104 IsListening = false;
105 105 CurrentListeningTask = null;
106 106 }
107 107