@@ -20,7 +20,7 @@ public static List<ButtonInfo> GetCustomBottomBarItemsSetting()
20
20
if ( string . IsNullOrWhiteSpace ( json ) )
21
21
return ButtonInfo . DefaultButtonList ;
22
22
23
- List < ButtonInfo > ? customBottomBarItems = new ( ) ;
23
+ List < ButtonInfo > ? customBottomBarItems = [ ] ;
24
24
25
25
customBottomBarItems = JsonSerializer . Deserialize < List < ButtonInfo > > ( json ) ;
26
26
@@ -41,10 +41,9 @@ public static List<ButtonInfo> GetCustomBottomBarItemsSetting()
41
41
return customBottomBarItems ;
42
42
}
43
43
44
- // a method to save a list of collapsible buttons to the settings as json
45
44
public static void SaveCustomBottomBarItemsSetting ( List < CollapsibleButton > bottomBarButtons )
46
45
{
47
- List < ButtonInfo > customButtons = new ( ) ;
46
+ List < ButtonInfo > customButtons = [ ] ;
48
47
49
48
foreach ( CollapsibleButton collapsible in bottomBarButtons )
50
49
customButtons . Add ( new ( collapsible ) ) ;
@@ -54,20 +53,15 @@ public static void SaveCustomBottomBarItemsSetting(List<CollapsibleButton> botto
54
53
55
54
public static void SaveCustomBottomBarItemsSetting ( List < ButtonInfo > bottomBarButtons )
56
55
{
57
- // serialize the list of custom bottom bar items to json
58
56
string json = JsonSerializer . Serialize ( bottomBarButtons ) ;
59
-
60
- // save the json string to the settings
61
57
AppUtilities . TextGrabSettings . BottomButtonsJson = json ;
62
-
63
- // save the settings
64
58
AppUtilities . TextGrabSettings . Save ( ) ;
65
59
}
66
60
67
61
public static List < CollapsibleButton > GetBottomBarButtons ( EditTextWindow editTextWindow )
68
62
{
69
- List < CollapsibleButton > bottomBarButtons = new ( ) ;
70
- Dictionary < string , RoutedCommand > _localRoutedCommands = new ( ) ;
63
+ List < CollapsibleButton > bottomBarButtons = [ ] ;
64
+ Dictionary < string , RoutedCommand > _localRoutedCommands = [ ] ;
71
65
List < MethodInfo > methods = GetMethods ( editTextWindow ) ;
72
66
Dictionary < string , RoutedCommand > routedCommands = EditTextWindow . GetRoutedCommands ( ) ;
73
67
@@ -105,13 +99,11 @@ public static List<CollapsibleButton> GetBottomBarButtons(EditTextWindow editTex
105
99
return bottomBarButtons ;
106
100
}
107
101
108
- // a method which returns a list of all methods in this class
109
102
private static List < MethodInfo > GetMethods ( object obj )
110
103
{
111
- return obj . GetType ( ) . GetMethods ( BindingFlags . NonPublic | BindingFlags . Instance ) . ToList ( ) ;
104
+ return [ .. obj . GetType ( ) . GetMethods ( BindingFlags . NonPublic | BindingFlags . Instance ) ] ;
112
105
}
113
106
114
- // using the above method match a method name to a string parameter
115
107
private static MethodInfo ? GetMethodInfoForName ( string methodName , List < MethodInfo > methods )
116
108
{
117
109
foreach ( MethodInfo method in methods )
@@ -121,7 +113,6 @@ private static List<MethodInfo> GetMethods(object obj)
121
113
return null ;
122
114
}
123
115
124
- // a method to match a command name to a string parameter
125
116
private static RoutedCommand ? GetCommandBinding ( string commandName , Dictionary < string , RoutedCommand > routedCommands )
126
117
{
127
118
foreach ( string commandKey in routedCommands . Keys )
0 commit comments