Migrate to Avalonia 12 and Plugin SDK v5

Upgrade project to the Avalonia 12 baseline and Plugin SDK v5: centralize Avalonia packages, remove legacy WebView.Avalonia usage (use NativeWebView/WebView2 EnvironmentRequested), and update Fluent/Material icon/package usages. Bump multiple package/project versions to 5.0.0 and Avalonia 12.0.1, update plugin template and README/docs to SDK v5, and add PLUGIN_SDK_V5_MIGRATION.md.

Also fix runtime/behavior bugs: make DataLocationResolver use a fixed bootstrap launcher data path and avoid recursive ResolveDataRoot; add legacy-state handling and extraction in OobeStateService; and update component settings tests to reflect migrated storage (DB/backup) and reset cache for test reloads. Various csproj, tests, and docs updated to reflect the migration and ensure build/test compatibility.
This commit is contained in:
lincube
2026-04-29 10:16:25 +08:00
parent 9fb41378eb
commit 93d6d93815
25 changed files with 197 additions and 156 deletions

View File

@@ -32,6 +32,11 @@ internal sealed class DataLocationResolver
/// </summary>
public string DefaultPortableDataPath => Path.Combine(_appRoot, "AppData");
private string ResolveBootstrapLauncherDataPath()
{
return Path.Combine(_defaultSystemDataPath, LauncherFolderName);
}
/// <summary>
/// 检查是否允许便携模式(应用目录是否可写)
/// </summary>
@@ -56,6 +61,11 @@ internal sealed class DataLocationResolver
public string ResolveDataRoot()
{
var config = LoadConfig();
return ResolveDataRoot(config);
}
private string ResolveDataRoot(DataLocationConfig? config)
{
if (config is null)
{
return _defaultSystemDataPath;
@@ -65,7 +75,7 @@ internal sealed class DataLocationResolver
{
var portablePath = !string.IsNullOrWhiteSpace(config.PortableDataPath)
? config.PortableDataPath
: _defaultSystemDataPath;
: DefaultPortableDataPath;
return Path.GetFullPath(portablePath);
}
@@ -95,7 +105,7 @@ internal sealed class DataLocationResolver
/// </summary>
public string ResolveConfigPath()
{
return Path.Combine(ResolveLauncherDataPath(), ConfigFileName);
return Path.Combine(ResolveBootstrapLauncherDataPath(), ConfigFileName);
}
/// <summary>
@@ -151,7 +161,7 @@ internal sealed class DataLocationResolver
{
try
{
var launcherPath = ResolveLauncherDataPath();
var launcherPath = ResolveBootstrapLauncherDataPath();
Directory.CreateDirectory(launcherPath);
var configPath = ResolveConfigPath();
@@ -182,8 +192,9 @@ internal sealed class DataLocationResolver
// 先创建目录结构
try
{
Directory.CreateDirectory(ResolveLauncherDataPath());
Directory.CreateDirectory(ResolveDesktopDataPath());
var resolvedDataRoot = ResolveDataRoot(config);
Directory.CreateDirectory(Path.Combine(resolvedDataRoot, LauncherFolderName));
Directory.CreateDirectory(Path.Combine(resolvedDataRoot, DesktopFolderName));
}
catch (Exception ex)
{