44
55namespace Common . Devices ;
66
7- public sealed class DeviceConfig : INotifyPropertyChanged , IAuroraConfig
7+ public sealed partial class DeviceConfig : INotifyPropertyChanged , IAuroraConfig
88{
99 public const string FileName = "DeviceConfig.json" ;
1010
@@ -32,11 +32,19 @@ public sealed class DeviceConfig : INotifyPropertyChanged, IAuroraConfig
3232
3333 public bool DangerousOpenRgbNonDirectEnable { get ; set ; }
3434
35- private ObservableCollection < string > ? _enabledDevices ;
36- public ObservableCollection < string > EnabledDevices
35+ private ObservableCollection < string > ? _enabledControllers ;
36+ [ JsonPropertyName ( "EnabledDevices" ) ]
37+ public ObservableCollection < string > EnabledControllers
3738 {
38- get => _enabledDevices ??= new ObservableCollection < string > ( DefaultEnabledDevices ) ;
39- set => _enabledDevices = value ;
39+ get => _enabledControllers ??= new ObservableCollection < string > ( DefaultEnabledControllers ) ;
40+ set => _enabledControllers = value ;
41+ }
42+
43+ private ObservableCollection < string > ? _disabledControllerDevices ;
44+ public ObservableCollection < string > DisabledControllerDevices
45+ {
46+ get => _disabledControllerDevices ??= [ ] ;
47+ set => _disabledControllerDevices = value ;
4048 }
4149
4250 private static readonly Dictionary < string , string > Migrations = new ( )
@@ -74,7 +82,7 @@ public ObservableCollection<string> EnabledDevices
7482 { "Wooting" , "Wooting (RGB.NET)" } ,
7583 } ;
7684
77- private static HashSet < string > DefaultEnabledDevices =>
85+ private static HashSet < string > DefaultEnabledControllers =>
7886 [
7987 "Corsair (RGB.NET)" ,
8088 "Logitech (RGB.NET)" ,
@@ -85,32 +93,32 @@ public ObservableCollection<string> EnabledDevices
8593
8694 public void OnPostLoad ( )
8795 {
88- _enabledDevices ??= new ObservableCollection < string > ( DefaultEnabledDevices ) ;
96+ _enabledControllers ??= new ObservableCollection < string > ( DefaultEnabledControllers ) ;
8997
9098 MigrateDevices ( ) ;
9199
92100 PrioritizeDevice ( "Logitech (RGB.NET)" , "Logitech" ) ;
93101
94- EnabledDevices . CollectionChanged += ( _ , _ ) =>
95- PropertyChanged ? . Invoke ( this , new PropertyChangedEventArgs ( nameof ( EnabledDevices ) ) ) ;
102+ EnabledControllers . CollectionChanged += ( _ , _ ) =>
103+ PropertyChanged ? . Invoke ( this , new PropertyChangedEventArgs ( nameof ( EnabledControllers ) ) ) ;
96104 }
97105
98106 private void MigrateDevices ( )
99107 {
100- foreach ( var loadedDeviceString in EnabledDevices . ToArray ( ) )
108+ foreach ( var loadedDeviceString in EnabledControllers . ToArray ( ) )
101109 {
102110 var typeName = loadedDeviceString . Split ( "," ) [ 0 ] ;
103111 if ( ! Migrations . TryGetValue ( typeName , out var migratedValue ) ) continue ;
104- EnabledDevices . Remove ( loadedDeviceString ) ;
105- EnabledDevices . Add ( migratedValue ) ;
112+ EnabledControllers . Remove ( loadedDeviceString ) ;
113+ EnabledControllers . Add ( migratedValue ) ;
106114 }
107115 }
108116
109117 private void PrioritizeDevice ( string primary , string secondary )
110118 {
111- if ( EnabledDevices . Contains ( primary ) )
119+ if ( EnabledControllers . Contains ( primary ) )
112120 {
113- EnabledDevices . Remove ( secondary ) ;
121+ EnabledControllers . Remove ( secondary ) ;
114122 }
115123 }
116124}
0 commit comments