@@ -65,26 +65,22 @@ public async Task InitializeAsync()
65
65
foreach ( var ( type , attributes ) in Configuration . Body )
66
66
{
67
67
// Skip if the setting does not have attributes or name
68
- if ( attributes ? . Name == null )
68
+ if ( attributes ? . Name == null ) continue ;
69
+
70
+ // Skip if the setting does not have attributes or name
71
+ if ( ! NeedSaveInSettings ( type ) ) continue ;
72
+
73
+ // If need save in settings, we need to make sure the setting exists in the settings file
74
+ if ( Settings . ContainsKey ( attributes . Name ) ) continue ;
75
+
76
+ if ( type == "checkbox" )
69
77
{
70
- continue ;
78
+ // If can parse the default value to bool, use it, otherwise use false
79
+ Settings [ attributes . Name ] = bool . TryParse ( attributes . DefaultValue , out var value ) && value ;
71
80
}
72
-
73
- if ( NeedSaveInSettings ( type ) )
81
+ else
74
82
{
75
- // If need save in settings, we need to make sure the setting exists in the settings file
76
- if ( ! Settings . ContainsKey ( attributes . Name ) )
77
- {
78
- if ( type == "checkbox" )
79
- {
80
- // If can parse the default value to bool, use it, otherwise use false
81
- Settings [ attributes . Name ] = bool . TryParse ( attributes . DefaultValue , out var value ) && value ;
82
- }
83
- else
84
- {
85
- Settings [ attributes . Name ] = attributes . DefaultValue ;
86
- }
87
- }
83
+ Settings [ attributes . Name ] = attributes . DefaultValue ;
88
84
}
89
85
}
90
86
}
0 commit comments