返回提交历史
Added
HaloPixelToolBox.Server/HaloPixelToolBox.Server.csproj
+14
-0
Added
HaloPixelToolBox.Server/Profiles/Data/MainDataProfile.cs
+17
-0
Added
HaloPixelToolBox.Server/Profiles/Data/UserDataProfile.cs
+27
-0
Added
HaloPixelToolBox.Server/Profiles/Manage/ServerProfile.cs
+9
-0
Added
HaloPixelToolBox.Server/Program.cs
+31
-0
Added
HaloPixelToolBox.Server/Services/Data/AddressResolverService.cs
+24
-0
Modified
HaloPixelToolBox.slnx
+1
-0
Modified
HaloPixelToolBox/HaloPixelToolBox.Core/HaloPixelToolBox.Core.csproj
+5
-4
Renamed
HaloPixelToolBox/HaloPixelToolBox.Core/Models/Bar/HaloPixelTextLayout.cs
+1
-1
Renamed
HaloPixelToolBox/HaloPixelToolBox.Core/Models/Bar/HaloPixelUIModel.cs
+1
-1
Deleted
HaloPixelToolBox/HaloPixelToolBox.Core/Models/MyModel.cs
+0
-6
Added
HaloPixelToolBox/HaloPixelToolBox.Core/Models/User/LoginStatus.cs
+20
-0
Added
HaloPixelToolBox/HaloPixelToolBox.Core/Models/User/MyUser.cs
+12
-0
Added
HaloPixelToolBox/HaloPixelToolBox.Core/Models/User/MyUserFaceInfo.cs
+66
-0
Added
HaloPixelToolBox/HaloPixelToolBox.Core/Models/User/UserRole.cs
+27
-0
Modified
HaloPixelToolBox/HaloPixelToolBox.Core/Utilities/HaloPixelDevice.cs
+1
-1
Modified
HaloPixelToolBox/HaloPixelToolBox.Core/Utilities/HidPacketBuilder.cs
+1
-1
Modified
HaloPixelToolBox/HaloPixelToolBox/Profiles/CrossVersionProfiles/CloudMusicLyricsProfile.cs
+1
-1
Modified
HaloPixelToolBox/HaloPixelToolBox/ViewModels/CloudMusicLyricsToolPageViewModel.cs
+3
-2
Modified
HaloPixelToolBox/HaloPixelToolBox/Views/CloudMusicLyricsToolPage.xaml.cs
+1
-1
XFEstudio/HaloPixelToolBox
新增后端服务子项目及用户数据模型重构
本次提交: - 新增 HaloPixelToolBox.Server 子项目,基于 XFEExtension.NetCore.ServerInteractive 实现后端服务,支持用户与版本地址管理。 - 升级 HaloPixelToolBox.Core 相关依赖库版本。 - 新增并重构用户相关模型(Core.Models.User),迁移并规范 HaloPixelTextLayout、HaloPixelUIModel 至 Core.Models.Bar,删除无用模型。 - 新增 AddressResolverService、MainDataProfile、UserDataProfile、ServerProfile 等服务与配置文件。 - 适配主程序及相关调用,调整命名空间引用。 - 解决方案文件添加 Server 项目引用。
52324f2
代码差异
20 个文件
+262
-18
@@ -0,0 +1,14 @@
1
<Project Sdk="Microsoft.NET.Sdk">
2
3
<PropertyGroup>
4
<OutputType>Exe</OutputType>
5
<TargetFramework>net10.0</TargetFramework>
6
<ImplicitUsings>enable</ImplicitUsings>
7
<Nullable>enable</Nullable>
8
</PropertyGroup>
9
10
<ItemGroup>
11
<ProjectReference Include="..\HaloPixelToolBox\HaloPixelToolBox.Core\HaloPixelToolBox.Core.csproj" />
12
</ItemGroup>
13
14
</Project>
@@ -0,0 +1,17 @@
1
using XFEExtension.NetCore.AutoConfig;
2
3
namespace HaloPixelToolBox.Server.Profiles.Data;
4
5
/// <summary>
6
/// 主要数据配置文件
7
/// </summary>
8
public partial class MainDataProfile : XFEProfile
9
{
10
/// <summary>
11
/// 版本地址表
12
/// </summary>
13
[ProfileProperty]
14
[ProfilePropertyAddGet("Current.versionAddressTable.CurrentProfile = Current")]
15
[ProfilePropertyAddGet("return Current.versionAddressTable")]
16
private ProfileDictionary<string, string> versionAddressTable = [];
17
}
@@ -0,0 +1,27 @@
1
using HaloPixelToolBox.Core.Models.User;
2
using XFEExtension.NetCore.AutoConfig;
3
using XFEExtension.NetCore.ServerInteractive.Models.UserModels;
4
5
namespace HaloPixelToolBox.Server.Profiles.Data;
6
7
/// <summary>
8
/// 用户数据配置文件
9
/// </summary>
10
public partial class UserDataProfile : XFEProfile
11
{
12
/// <summary>
13
/// 用户信息表
14
/// </summary>
15
[ProfileProperty]
16
[ProfilePropertyAddGet("Current._myUserTable.CurrentProfile = Current")]
17
[ProfilePropertyAddGet("return Current._myUserTable")]
18
private ProfileList<MyUser> _myUserTable = [];
19
20
/// <summary>
21
/// 加密用户登录模型表
22
/// </summary>
23
[ProfileProperty]
24
[ProfilePropertyAddGet("Current._encryptedUserLoginModelTable.CurrentProfile = Current")]
25
[ProfilePropertyAddGet("return Current._encryptedUserLoginModelTable")]
26
private ProfileList<EncryptedUserLoginModel> _encryptedUserLoginModelTable = [];
27
}
@@ -0,0 +1,9 @@
1
using XFEExtension.NetCore.AutoConfig;
2
3
namespace HaloPixelToolBox.Server.Profiles.Manage;
4
5
public partial class ServerProfile : XFEProfile
6
{
7
[ProfileProperty]
8
private string serverBindingIpAddress = "http://*:3300/";
9
}
@@ -0,0 +1,31 @@
1
using HaloPixelToolBox.Core.Models.User;
2
using HaloPixelToolBox.Server.Profiles.Data;
3
using HaloPixelToolBox.Server.Profiles.Manage;
4
using HaloPixelToolBox.Server.Services.Data;
5
using XFEExtension.NetCore.ServerInteractive.Interfaces;
6
using XFEExtension.NetCore.ServerInteractive.Utilities.Extensions;
7
using XFEExtension.NetCore.ServerInteractive.Utilities.Server;
8
9
var server = XFEServerBuilder.CreateBuilder()
10
.UseXFEServer()
11
.AddServerCore(XFEServerCoreBuilder.CreateBuilder()
12
.UseXFEStandardServerCore<MyUserFaceInfo>(options =>
13
{
14
options.GetUserFunction = static () => UserDataProfile.MyUserTable;
15
options.AddUserFunction = static userInfo => UserDataProfile.MyUserTable.Add(userInfo);
16
options.GetEncryptedUserLoginModelFunction = static () => UserDataProfile.EncryptedUserLoginModelTable;
17
options.AddEncryptedUserLoginModelFunction = UserDataProfile.EncryptedUserLoginModelTable.Add;
18
options.RemoveEncryptedUserLoginModelFunction = UserDataProfile.EncryptedUserLoginModelTable.Remove;
19
options.GetLoginKeepDays = static () => 2;
20
options.LoginResultConvertFunction = static user => MyUserFaceInfo.FromUser((IUserInfo)user);
21
})
22
.AddService<AddressResolverService>()
23
.Build(options =>
24
{
25
options.ServerCoreName = "HaloPixelToolBoxServer";
26
options.MainEntryPoint = "api";
27
options.BindIP(ServerProfile.ServerBindingIpAddress);
28
}));
29
.Build();
30
31
await server.Start();
@@ -0,0 +1,24 @@
1
using HaloPixelToolBox.Core.Models.User;
2
using HaloPixelToolBox.Server.Profiles.Data;
3
using XFEExtension.NetCore.ServerInteractive.Attributes;
4
using XFEExtension.NetCore.ServerInteractive.Implements.CoreService;
5
using XFEExtension.NetCore.ServerInteractive.Utilities.Helpers;
6
7
namespace HaloPixelToolBox.Server.Services.Data;
8
9
/// <summary>
10
/// 地址解析服务
11
/// </summary>
12
public partial class AddressResolverService : ServerCoreStandardServiceBase
13
{
14
public int AddAddressPermission { get; set; } = (int)UserRole.管理员;
15
16
[EntryPoint("data/get/versionAddress")]
17
public async Task GetVersionAddressEntryPoint() => await Close(MainDataProfile.VersionAddressTable);
18
19
[EntryPoint("data/add/versionAddress")]
20
public async Task AddVersionAddressEntryPoint()
21
{
22
UserHelper.ValidateUserPermission(Json > "session", Json > "deviceInfo", ClientIP, AddAddressPermission, UserDataProfile.EncryptedUserLoginModelTable, UserDataProfile.MyUserTable);
23
}
24
}
@@ -6,6 +6,7 @@
6
6
</Configurations>
7
7
<Project Path="HaloPixelToolBox.Installer.Package/HaloPixelToolBox.Installer.Package.csproj" Id="d37a90a9-f8fa-4f45-80bb-e34dadffb7f9" />
8
8
<Project Path="HaloPixelToolBox.Installer/HaloPixelToolBox.Installer.csproj" Id="2ff32c8b-4030-4872-af93-8176e0a1edec" />
9
<Project Path="HaloPixelToolBox.Server/HaloPixelToolBox.Server.csproj" Id="8483c595-234b-447b-92e5-a92090e7a46d" />
9
10
<Project Path="HaloPixelToolBox/HaloPixelToolBox.Core/HaloPixelToolBox.Core.csproj" />
10
11
<Project Path="HaloPixelToolBox/HaloPixelToolBox.Test/HaloPixelToolBox.Test.csproj" />
11
12
<Project Path="HaloPixelToolBox/HaloPixelToolBox/HaloPixelToolBox.csproj">
@@ -9,12 +9,13 @@
9
9
<ItemGroup>
10
10
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
11
11
<PackageReference Include="HidSharp" Version="2.6.4" />
12
<PackageReference Include="XFEExtension.NetCore" Version="4.2.0" />
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.XFEConsole" Version="2.0.0" />
15
<PackageReference Include="XFEExtension.NetCore.AutoConfig" Version="2.0.*" />
14
<PackageReference Include="XFEExtension.NetCore.ServerInteractive" Version="3.1.0" />
15
<PackageReference Include="XFEExtension.NetCore.XFEConsole" Version="2.2.2" />
16
<PackageReference Include="XFEExtension.NetCore.AutoConfig" Version="3.0.0" />
16
17
<PackageReference Include="XFEExtension.NetCore.InputSimulator" Version="2.3.0" />
17
<PackageReference Include="XFEExtension.NetCore.UpgradeHelper" Version="1.0.1" />
18
<PackageReference Include="XFEExtension.NetCore.UpgradeHelper" Version="2.0.0" />
18
19
</ItemGroup>
19
20
20
21
</Project>
@@ -1,4 +1,4 @@
1
namespace HaloPixelToolBox.Core.Models;
1
namespace HaloPixelToolBox.Core.Models.Bar;
2
2
3
3
public enum HaloPixelTextLayout
4
4
{
@@ -1,4 +1,4 @@
1
namespace HaloPixelToolBox.Core.Models;
1
namespace HaloPixelToolBox.Core.Models.Bar;
2
2
3
3
/// <summary>
4
4
/// 花再像素UI模型
@@ -1,6 +0,0 @@
1
namespace HaloPixelToolBox.Core.Models;
2
3
public class MyModel
4
{
5
public int MyProperty { get; set; }
6
}
@@ -0,0 +1,20 @@
1
using XFEExtension.NetCore.ServerInteractive.Models.RequesterModels;
2
3
namespace HaloPixelToolBox.Core.Models.User;
4
5
/// <summary>
6
/// 登录状态
7
/// </summary>
8
/// <param name="isLogin"></param>
9
/// <param name="userInfo"></param>
10
public class LoginStatus(bool isLogin, UserLoginResult<MyUserFaceInfo>? userInfo = null)
11
{
12
/// <summary>
13
/// 是否登录
14
/// </summary>
15
public bool IsLogin { get; set; } = isLogin;
16
/// <summary>
17
/// 登录结果
18
/// </summary>
19
public UserLoginResult<MyUserFaceInfo>? LoginResult { get; set; } = userInfo;
20
}