@@ -39,6 +39,13 @@ public class FilterWheelHardware
3939
4040 private const string m_sRegVer = "1" ; // Used to track id registry entries exist or need updating
4141
42+
43+ //
44+ // Create some 'realistic' defaults
45+ //
46+ private static Color [ ] DefaultColors = new Color [ 8 ] { Color . Red , Color . Green , Color . Blue , Color . Gray ,
47+ Color . DarkRed , Color . Teal , Color . Violet , Color . Black } ;
48+
4249 public static bool m_bLogTraffic ; // Do we log traffic?
4350
4451 //
@@ -361,11 +368,12 @@ private static void LoadSettings()
361368 {
362369 m_asFilterNames [ i ] = g_Profile . GetValue ( $ "FilterNames { i } ") ;
363370 m_aiFocusOffsets [ i ] = Convert . ToInt32 ( g_Profile . GetValue ( $ "FocusOffsets { i } ") ) ;
364- m_acFilterColours [ i ] = ColorTranslator . FromWin32 ( Convert . ToInt32 ( g_Profile . GetValue ( $ "FilterColours { i } " ) ) ) ;
371+ m_acFilterColours [ i ] = Color . FromName ( g_Profile . GetValue ( $ "Filter { i } Color" , DefaultColors [ i ] . Name ) ) ;
365372 }
366373 }
367- catch
374+ catch ( Exception ex )
368375 {
376+ LogTraffic ( ex . Message ) ;
369377 SetDefaultSettings ( ) ;
370378 }
371379 }
@@ -375,10 +383,7 @@ private static void SetDefaultSettings()
375383 //
376384 // initialize variables that are not present
377385 //
378- // Create some 'realistic' defaults
379- //
380- Color [ ] colours = new Color [ 8 ] { Color . Red , Color . Green , Color . Blue , Color . Gray ,
381- Color . DarkRed , Color . Teal , Color . Violet , Color . Black } ;
386+
382387 string [ ] names = new string [ 8 ] { "Red" , "Green" , "Blue" , "Clear" , "Ha" , "OIII" , "LPR" , "Dark" } ;
383388 Random rand = new Random ( ) ;
384389
@@ -393,7 +398,7 @@ private static void SetDefaultSettings()
393398 {
394399 g_Profile . WriteValue ( $ "FilterNames { i } ", names [ i ] ) ;
395400 g_Profile . WriteValue ( $ "FocusOffsets { i } ", rand . Next ( 10000 ) . ToString ( ) ) ;
396- g_Profile . WriteValue ( $ "FilterColours { i } ", ColorTranslator . ToWin32 ( colours [ i ] ) . ToString ( ) ) ;
401+ g_Profile . WriteValue ( $ "Filter { i } Color ", DefaultColors [ i ] . Name ) ;
397402 }
398403 }
399404
@@ -409,7 +414,7 @@ public static void SaveSettings(int slots, double seconds, string[] names, int[]
409414 {
410415 g_Profile . WriteValue ( $ "FilterNames { i } ", names [ i ] ) ;
411416 g_Profile . WriteValue ( $ "FocusOffsets { i } ", offsets [ i ] . ToString ( ) ) ;
412- g_Profile . WriteValue ( $ "FilterColours { i } ", ColorTranslator . ToWin32 ( colors [ i ] ) . ToString ( ) ) ;
417+ g_Profile . WriteValue ( $ "Filter { i } Color ", colors [ i ] . Name ) ;
413418 }
414419 g_Profile . WriteValue ( "ImplementsNames" , implementsNames . ToString ( ) ) ;
415420 g_Profile . WriteValue ( "ImplementsOffsets" , implementsOffsets . ToString ( ) ) ;
0 commit comments