mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Update Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
Co-authored-by: Yan Li <Yusyuriv@users.noreply.github.com>
This commit is contained in:
parent
ffc5047810
commit
1d625c9134
1 changed files with 14 additions and 18 deletions
|
|
@ -65,26 +65,22 @@ namespace Flow.Launcher.Core.Plugin
|
|||
foreach (var (type, attributes) in Configuration.Body)
|
||||
{
|
||||
// Skip if the setting does not have attributes or name
|
||||
if (attributes?.Name == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (attributes?.Name == null) continue;
|
||||
|
||||
if (NeedSaveInSettings(type))
|
||||
// Skip if the setting does not have attributes or name
|
||||
if (!NeedSaveInSettings(type)) continue;
|
||||
|
||||
// If need save in settings, we need to make sure the setting exists in the settings file
|
||||
if (Settings.ContainsKey(attributes.Name)) continue;
|
||||
|
||||
if (type == "checkbox")
|
||||
{
|
||||
// If need save in settings, we need to make sure the setting exists in the settings file
|
||||
if (!Settings.ContainsKey(attributes.Name))
|
||||
{
|
||||
if (type == "checkbox")
|
||||
{
|
||||
// If can parse the default value to bool, use it, otherwise use false
|
||||
Settings[attributes.Name] = bool.TryParse(attributes.DefaultValue, out var value) && value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings[attributes.Name] = attributes.DefaultValue;
|
||||
}
|
||||
}
|
||||
// If can parse the default value to bool, use it, otherwise use false
|
||||
Settings[attributes.Name] = bool.TryParse(attributes.DefaultValue, out var value) && value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings[attributes.Name] = attributes.DefaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue