返回提交历史
Modified
XFEToolBox.Server/Profiles/Data/MainDataProfile.cs
+2
-10
Modified
XFEToolBox.Server/Profiles/Data/UserDataProfile.cs
+2
-9
Modified
XFEToolBox.Server/Profiles/ServerProfile.cs
+14
-27
XFEstudio/XFEToolBox
将配置字段改为全局静态属性并移除特性
将 MainDataProfile、UserDataProfile 和 ServerProfile 类中的多个实例字段替换为带有 public static 修饰符的属性,并添加 get/set 访问器,实现全局访问。移除了 ProfilePropertyAddGet 特性,简化了属性声明。
791ede7
代码差异
3 个文件
+18
-46
@@ -7,14 +7,6 @@ namespace XFEToolBox.Server.Profiles.Data;
7
7
public partial class MainDataProfile : XFEProfile
8
8
{
9
9
public MainDataProfile() => DefaultProfileOperationMode = ProfileOperationMode.Xml;
10
11
[ProfileProperty]
12
[ProfilePropertyAddGet("Current.downloadAddressList.CurrentProfile = Current")]
13
[ProfilePropertyAddGet("return Current.downloadAddressList")]
14
private ProfileList<string> downloadAddressList = [];
15
16
[ProfileProperty]
17
[ProfilePropertyAddGet("Current.softwareCatalog.CurrentProfile = Current")]
18
[ProfilePropertyAddGet("return Current.softwareCatalog")]
19
private ProfileList<SoftwareCatalogItem> softwareCatalog = [];
10
[ProfileProperty] public static partial ProfileList<string> DownloadAddressList { get; set; } = [];
11
[ProfileProperty] public static partial ProfileList<SoftwareCatalogItem> SoftwareCatalog { get; set; } = [];
20
12
}
@@ -6,13 +6,6 @@ namespace XFEToolBox.Server.Profiles.Data;
6
6
7
7
internal partial class UserDataProfile : XFEProfile
8
8
{
9
[ProfileProperty]
10
[ProfilePropertyAddGet("Current._userTable.CurrentProfile = Current")]
11
[ProfilePropertyAddGet("return Current._userTable")]
12
private ProfileList<ToolBoxUser> _userTable = [];
13
14
[ProfileProperty]
15
[ProfilePropertyAddGet("Current._loginTable.CurrentProfile = Current")]
16
[ProfilePropertyAddGet("return Current._loginTable")]
17
private ProfileList<EncryptedUserLoginModel> _loginTable = [];
9
[ProfileProperty] public static partial ProfileList<ToolBoxUser> UserTable { get; set; } = [];
10
[ProfileProperty] public static partial ProfileList<EncryptedUserLoginModel> LoginTable { get; set; } = [];
18
11
}
@@ -11,31 +11,18 @@ public partial class ServerProfile : XFEProfile
11
11
12
12
public ServerProfile() => DefaultProfileOperationMode = ProfileOperationMode.Xml;
13
13
14
[ProfileProperty] private string _httpAddress = "http://localhost:3000/";
15
16
[ProfileProperty] private string _httpsAddress = "https://localhost:3400/";
17
18
[ProfileProperty] private string _storageRoot = "Data/ToolPackages";
19
20
[ProfileProperty] private string _softwareStorageRoot = "Data/SoftwareFiles";
21
22
[ProfileProperty] private string _adminApiKey = string.Empty;
23
24
[ProfileProperty] private long _maxPackageBytes = 10 * 1024 * 1024;
25
26
[ProfileProperty] private long _maxSoftwareBytes = 256 * 1024 * 1024;
27
28
[ProfileProperty] private long _maxExpandedBytes = 30 * 1024 * 1024;
29
30
[ProfileProperty] private int _maxFileCount = 256;
31
32
[ProfileProperty] private double _maxCompressionRatio = 100;
33
34
[ProfileProperty] private int _loginKeepDays = 30;
35
36
[ProfileProperty] private string _initialAdminUserName = "admin";
37
38
[ProfileProperty] private string _initialAdminPassword = DefaultInitialAdminPassword;
39
40
[ProfileProperty] private bool _allowRegistration = true;
14
[ProfileProperty] public static string HttpAddress { get; set; } = "http://localhost:3000/";
15
[ProfileProperty] public static string HttpsAddress { get; set; } = "https://localhost:3400/";
16
[ProfileProperty] public static string StorageRoot { get; set; } = "Data/ToolPackages";
17
[ProfileProperty] public static string SoftwareStorageRoot { get; set; } = "Data/SoftwareFiles";
18
[ProfileProperty] public static string AdminApiKey { get; set; } = string.Empty;
19
[ProfileProperty] public static long MaxPackageBytes { get; set; } = 10 * 1024 * 1024;
20
[ProfileProperty] public static long MaxSoftwareBytes { get; set; } = 256 * 1024 * 1024;
21
[ProfileProperty] public static long MaxExpandedBytes { get; set; } = 30 * 1024 * 1024;
22
[ProfileProperty] public static int MaxFileCount { get; set; } = 256;
23
[ProfileProperty] public static double MaxCompressionRatio { get; set; } = 100;
24
[ProfileProperty] public static int LoginKeepDays { get; set; } = 30;
25
[ProfileProperty] public static string InitialAdminUserName { get; set; } = "admin";
26
[ProfileProperty] public static string InitialAdminPassword { get; set; } = DefaultInitialAdminPassword;
27
[ProfileProperty] public static bool AllowRegistration { get; set; } = true;
41
28
}