返回提交历史
Modified
HaloPixelToolBox.Installer.Package/HaloPixelToolBox.Installer.Package.csproj
+1
-1
Modified
HaloPixelToolBox.Installer/HaloPixelToolBox.Installer.csproj
+3
-3
Modified
HaloPixelToolBox.Server/Profiles/Data/MainDataProfile.cs
+68
-2
Modified
HaloPixelToolBox.Server/Program.cs
+1
-0
Modified
HaloPixelToolBox.Server/Services/Data/AddressResolverService.cs
+52
-7
Modified
HaloPixelToolBox/HaloPixelToolBox.Core/HaloPixelToolBox.Core.csproj
+1
-1
Added
HaloPixelToolBox/HaloPixelToolBox.Core/Models/Bar/AddressResolverModel.cs
+20
-0
Modified
HaloPixelToolBox/HaloPixelToolBox.Test/HaloPixelToolBox.Test.csproj
+1
-1
Modified
HaloPixelToolBox/HaloPixelToolBox/HaloPixelToolBox.csproj
+3
-3
Modified
HaloPixelToolBox/HaloPixelToolBox/Profiles/CacheProfiles/CacheProfile.cs
+10
-11
XFEstudio/HaloPixelToolBox
升级依赖与重构地址解析模型及服务
本次提交包含以下主要变更: - 升级各项目至 .NET 10.0 并同步更新相关依赖包,提升兼容性和新特性支持。 - 新增 AddressResolverModel 类,优化地址解析数据结构。 - MainDataProfile 和 CacheProfile 的版本地址表由 string 改为 AddressResolverModel,初始化多版本默认数据。 - AddressResolverService 增强,支持获取、添加、移除、修改版本地址,增加权限校验。 - 服务注册增加 EditAddressPermission 参数,细化权限控制。 - 优化代码风格和注释,提升可维护性和扩展性。
559b1fd
代码差异
10 个文件
+160
-29
@@ -2,7 +2,7 @@
2
2
3
3
<PropertyGroup>
4
4
<OutputType>Exe</OutputType>
5
<TargetFramework>net8.0</TargetFramework>
5
<TargetFramework>net10.0</TargetFramework>
6
6
<ImplicitUsings>enable</ImplicitUsings>
7
7
<Nullable>enable</Nullable>
8
8
<InvariantGlobalization>true</InvariantGlobalization>
@@ -2,7 +2,7 @@
2
2
3
3
<PropertyGroup>
4
4
<OutputType>WinExe</OutputType>
5
<TargetFramework>net8.0-windows</TargetFramework>
5
<TargetFramework>net10.0-windows</TargetFramework>
6
6
<Nullable>enable</Nullable>
7
7
<ImplicitUsings>enable</ImplicitUsings>
8
8
<UseWPF>true</UseWPF>
@@ -50,9 +50,9 @@
50
50
</ItemGroup>
51
51
52
52
<ItemGroup>
53
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
53
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
54
54
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
55
<PackageReference Include="XFEExtension.NetCore" Version="3.2.7" />
55
<PackageReference Include="XFEExtension.NetCore" Version="4.2.4" />
56
56
<PackageReference Include="XFEExtension.NetCore.InputSimulator" Version="2.3.0" />
57
57
</ItemGroup>
58
58
@@ -1,4 +1,5 @@
1
using XFEExtension.NetCore.AutoConfig;
1
using HaloPixelToolBox.Core.Models.Bar;
2
using XFEExtension.NetCore.AutoConfig;
2
3
3
4
namespace HaloPixelToolBox.Server.Profiles.Data;
4
5
@@ -13,5 +14,70 @@ public partial class MainDataProfile : XFEProfile
13
14
[ProfileProperty]
14
15
[ProfilePropertyAddGet("Current.versionAddressTable.CurrentProfile = Current")]
15
16
[ProfilePropertyAddGet("return Current.versionAddressTable")]
16
private ProfileDictionary<string, string> versionAddressTable = [];
17
private ProfileDictionary<string, AddressResolverModel> versionAddressTable = new()
18
{
19
{
20
"3.1.35",
21
new()
22
{
23
ModuleName = "cloudmusic.dll",
24
BaseAddress = 0x01ED9690,
25
Offsets = [0x120, 0x8, 0x0]
26
}
27
},
28
{
29
"3.1.30",
30
new()
31
{
32
ModuleName = "cloudmusic.dll",
33
BaseAddress = 0x01DF44D0,
34
Offsets = [0x120, 0x8, 0x0]
35
}
36
},
37
{
38
"3.1.29",
39
new()
40
{
41
ModuleName = "cloudmusic.dll",
42
BaseAddress = 0x01DEB4D0,
43
Offsets = [0x120, 0x8, 0x0]
44
}
45
},
46
{
47
"3.1.28",
48
new()
49
{
50
ModuleName = "cloudmusic.dll",
51
BaseAddress = 0x01DDF290,
52
Offsets = [0x120, 0x8, 0x0]
53
}
54
},
55
{
56
"3.1.27",
57
new()
58
{
59
ModuleName = "cloudmusic.dll",
60
BaseAddress = 0x01DDE290,
61
Offsets = [ 0xE0, 0x8, 0xE8, 0x38, 0x118, 0x8, 0x0]
62
}
63
},
64
{
65
"3.1.26",
66
new()
67
{
68
ModuleName = "cloudmusic.dll",
69
BaseAddress = 0x01DD5130,
70
Offsets = [ 0xE8, 0x38, 0x120, 0x18, 0x0]
71
}
72
},
73
{
74
"3.1.25",
75
new()
76
{
77
ModuleName = "cloudmusic.dll",
78
BaseAddress = 0x01DAFF60,
79
Offsets = [0xE0, 0x8, 0x128, 0x18, 0x0]
80
}
81
}
82
};
17
83
}
@@ -20,6 +20,7 @@ var server = XFEServerBuilder.CreateBuilder()
20
20
options.LoginResultConvertFunction = static user => MyUserFaceInfo.FromUser((IUserInfo)user);
21
21
})
22
22
.AddService<AddressResolverService>()
23
.AddParameter("EditAddressPermission", (int)UserRole.管理员)
23
24
.Build(options =>
24
25
{
25
26
options.ServerCoreName = "HaloPixelToolBoxServer";
@@ -1,24 +1,69 @@
1
using HaloPixelToolBox.Core.Models.User;
1
using HaloPixelToolBox.Core.Models.Bar;
2
using HaloPixelToolBox.Core.Models.User;
2
3
using HaloPixelToolBox.Server.Profiles.Data;
4
using System.Text.Json;
3
5
using XFEExtension.NetCore.ServerInteractive.Attributes;
4
using XFEExtension.NetCore.ServerInteractive.Implements.CoreService;
5
using XFEExtension.NetCore.ServerInteractive.Utilities.Helpers;
6
using XFEExtension.NetCore.ServerInteractive.Utilities.Server.Services.CoreService;
7
using XFEExtension.NetCore.StringExtension;
6
8
7
9
namespace HaloPixelToolBox.Server.Services.Data;
8
10
9
11
/// <summary>
10
12
/// 地址解析服务
11
13
/// </summary>
12
public partial class AddressResolverService : ServerCoreStandardServiceBase
14
public partial class AddressResolverService : ServerCoreUserServiceBase
13
15
{
14
public int AddAddressPermission { get; set; } = (int)UserRole.管理员;
16
public int EditAddressPermission { get; set; } = (int)UserRole.管理员;
15
17
16
18
[EntryPoint("data/get/versionAddress")]
17
public async Task GetVersionAddressEntryPoint() => await Close(MainDataProfile.VersionAddressTable);
19
public async Task GetVersionAddressEntryPoint()
20
{
21
string? version = Json > "version";
22
if (!version.NullOrWhiteSpace)
23
{
24
if (MainDataProfile.VersionAddressTable.TryGetValue(version, out var addressResolverModel))
25
await Close(addressResolverModel);
26
else
27
throw Error($"未找到版本 v{version} 对应的解析地址,请联系作者更新");
28
}
29
else
30
{
31
await Close(MainDataProfile.VersionAddressTable);
32
}
33
}
18
34
19
35
[EntryPoint("data/add/versionAddress")]
20
36
public async Task AddVersionAddressEntryPoint()
21
37
{
22
UserHelper.ValidateUserPermission(Json > "session", Json > "deviceInfo", ClientIP, AddAddressPermission, UserDataProfile.EncryptedUserLoginModelTable, UserDataProfile.MyUserTable);
38
VerifyPermission();
39
string version = Json > "version" ?? throw Error("缺少版本号");
40
if (version.NullOrWhiteSpace) throw Error("版本号不可为空");
41
var addressModel = JsonSerializer.Deserialize<AddressResolverModel>(Json > "addressModel" ?? throw Error("缺少地址解析模型")) ?? throw Error("缺少地址解析模型");
42
MainDataProfile.VersionAddressTable.Add(version, addressModel);
43
}
44
45
[EntryPoint("data/remove/versionAddress")]
46
public async Task RemoveVersionAddressEntryPoint()
47
{
48
VerifyPermission();
49
string version = Json > "version" ?? throw Error("缺少版本号");
50
if (version.NullOrWhiteSpace) throw Error("版本号不可为空");
51
MainDataProfile.VersionAddressTable.Remove(version);
52
}
53
54
[EntryPoint("data/change/versionAddress")]
55
public async Task ChangeVersionAddressEntryPoint()
56
{
57
VerifyPermission();
58
string version = Json > "version" ?? throw Error("缺少版本号");
59
if (version.NullOrWhiteSpace) throw Error("版本号不可为空");
60
var addressModel = JsonSerializer.Deserialize<AddressResolverModel>(Json > "addressModel" ?? throw Error("缺少地址解析模型")) ?? throw Error("缺少地址解析模型");
61
MainDataProfile.VersionAddressTable[version] = addressModel;
62
}
63
64
private void VerifyPermission()
65
{
66
if (User.PermissionLevel > EditAddressPermission)
67
throw Error("权限不足");
23
68
}
24
69
}
@@ -11,7 +11,7 @@
11
11
<PackageReference Include="HidSharp" Version="2.6.4" />
12
12
<PackageReference Include="XFEExtension.NetCore" Version="4.2.4" />
13
13
<PackageReference Include="XFEExtension.NetCore.MemoryEditor" Version="2.1.0" />
14
<PackageReference Include="XFEExtension.NetCore.ServerInteractive" Version="3.1.0" />
14
<PackageReference Include="XFEExtension.NetCore.ServerInteractive" Version="3.2.2" />
15
15
<PackageReference Include="XFEExtension.NetCore.XFEConsole" Version="2.2.2" />
16
16
<PackageReference Include="XFEExtension.NetCore.AutoConfig" Version="3.0.0" />
17
17
<PackageReference Include="XFEExtension.NetCore.InputSimulator" Version="2.3.0" />
@@ -0,0 +1,20 @@
1
namespace HaloPixelToolBox.Core.Models.Bar;
2
3
/// <summary>
4
/// 地址解析模型
5
/// </summary>
6
public class AddressResolverModel
7
{
8
/// <summary>
9
/// 组件名称
10
/// </summary>
11
public string ModuleName { get; set; } = string.Empty;
12
/// <summary>
13
/// 基础地址
14
/// </summary>
15
public nint BaseAddress { get; set; }
16
/// <summary>
17
/// 偏移
18
/// </summary>
19
public nint[] Offsets { get; set; } = [];
20
}
@@ -8,7 +8,7 @@
8
8
</PropertyGroup>
9
9
10
10
<ItemGroup>
11
<PackageReference Include="XFEExtension.NetCore.XUnit" Version="2.1.1" />
11
<PackageReference Include="XFEExtension.NetCore.XUnit" Version="3.0.0" />
12
12
</ItemGroup>
13
13
14
14
<ItemGroup>
@@ -73,10 +73,10 @@
73
73
</ItemGroup>
74
74
<ItemGroup>
75
75
<FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms" />
76
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.7463" />
77
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.*" />
76
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.28000.2270" />
77
<PackageReference Include="Microsoft.WindowsAppSDK" Version="2.2.0" />
78
78
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.2.251219" />
79
<PackageReference Include="XFEExtension.NetCore.WinUIHelper" Version="1.2.*" />
79
<PackageReference Include="XFEExtension.NetCore.WinUIHelper" Version="2.0.1" />
80
80
</ItemGroup>
81
81
<ItemGroup>
82
82
<ProjectReference Include="..\HaloPixelToolBox.Core\HaloPixelToolBox.Core.csproj" />
@@ -1,16 +1,15 @@
1
using XFEExtension.NetCore.AutoConfig;
1
using HaloPixelToolBox.Core.Models.Bar;
2
using XFEExtension.NetCore.AutoConfig;
2
3
using XFEExtension.NetCore.WinUIHelper.Utilities.Helper;
3
4
4
namespace HaloPixelToolBox.Profiles.CacheProfiles
5
namespace HaloPixelToolBox.Profiles.CacheProfiles;
6
7
public partial class CacheProfile : XFEProfile
5
8
{
6
public partial class CacheProfile : XFEProfile
7
{
8
public CacheProfile() => ProfilePath = $@"{AppPathHelper.CacheProfile}\{nameof(CacheProfile)}";
9
public CacheProfile() => ProfilePath = $@"{AppPathHelper.CacheProfile}\{nameof(CacheProfile)}";
9
10
10
/// <summary>
11
/// 你的缓存内容
12
/// </summary>
13
[ProfileProperty]
14
private string cacheContent = string.Empty;
15
}
11
[ProfileProperty]
12
[ProfilePropertyAddGet("Current.versionAddress.CurrentProfile = Current")]
13
[ProfilePropertyAddGet("return Current.versionAddress")]
14
private ProfileDictionary<string, AddressResolverModel> versionAddress = [];
16
15
}