增加设置项MaxLoginAttempts(默认3)

This commit is contained in:
2026-02-28 19:39:48 +08:00
parent c5fc081977
commit ec7e0978d3
6 changed files with 64 additions and 5 deletions

View File

@@ -11,7 +11,8 @@ namespace CMLeonOS.Settings
private static Dictionary<string, string> defaultSettings = new Dictionary<string, string>
{
{ "LoggerEnabled", "true" }
{ "LoggerEnabled", "true" },
{ "MaxLoginAttempts", "3" }
};
public static bool LoggerEnabled
@@ -31,6 +32,26 @@ namespace CMLeonOS.Settings
}
}
public static int MaxLoginAttempts
{
get
{
if (settings.TryGetValue("MaxLoginAttempts", out string value))
{
if (int.TryParse(value, out int result))
{
return result;
}
}
return 3;
}
set
{
settings["MaxLoginAttempts"] = value.ToString();
SaveSettings();
}
}
public static void LoadSettings()
{
settings.Clear();