add:安全中心

This commit is contained in:
2026-02-16 20:22:41 +08:00
parent 2f8c368eef
commit 45dc3cb537
18 changed files with 1167 additions and 49 deletions
+16 -3
View File
@@ -3320,8 +3320,20 @@ namespace Ink_Canvas
Settings.Startup.IsFoldAtStartup = false;
}
public void BtnResetToSuggestion_Click(object sender, RoutedEventArgs e)
public async void BtnResetToSuggestion_Click(object sender, RoutedEventArgs e)
{
try
{
if (sender != null && Ink_Canvas.Helpers.SecurityManager.IsPasswordRequiredForResetConfig(Settings))
{
bool ok = await Ink_Canvas.Helpers.SecurityManager.PromptAndVerifyAsync(Settings, this, "重置配置验证", "请输入安全密码以确认重置配置。");
if (!ok) return;
}
}
catch
{
}
try
{
isLoaded = false;
@@ -4405,10 +4417,11 @@ namespace Ink_Canvas
string configsDir = Path.Combine(App.RootPath, "Configs");
if (!Directory.Exists(configsDir))
{
Directory.CreateDirectory(configsDir);
ProcessProtectionManager.WithWriteAccess(configsDir, () => Directory.CreateDirectory(configsDir));
}
File.WriteAllText(App.RootPath + settingsFileName, text);
var path = App.RootPath + settingsFileName;
ProcessProtectionManager.WithWriteAccess(path, () => File.WriteAllText(path, text));
}
catch { }
}