@@ -61,40 +61,16 @@ public MainWindow()
6161 {
6262 Directory . CreateDirectory ( ConfigFolder ) ;
6363 SetupRoutine ( true ) ;
64+ ReadConfig ( ) ;
6465 }
6566 else if ( ! File . Exists ( ConfigFile ) )
6667 {
6768 SetupRoutine ( true ) ;
69+ ReadConfig ( ) ;
6870 }
6971 else
7072 {
71- try
72- {
73- XmlSerializer ser = new XmlSerializer ( typeof ( Configuration ) ) ;
74- StreamReader r = new StreamReader ( ConfigFile ) ;
75- AppConfiguration = ( Configuration ) ser . Deserialize ( r ) ! ;
76- r . Close ( ) ;
77- foreach ( PropertyDescriptor descriptor in TypeDescriptor . GetProperties ( AppConfiguration ) )
78- {
79- string name = descriptor . Name ;
80- object value = descriptor . GetValue ( AppConfiguration ) ;
81- Console . WriteLine ( "{0}={1}" , name , value ) ;
82- }
83- }
84- catch
85- {
86- var box = MessageBoxManager . GetMessageBoxCustom ( new MessageBoxCustomParams
87- {
88- ContentMessage = Lang . Resources . ConfigReadError ,
89- ButtonDefinitions = new List < ButtonDefinition >
90- {
91- new ButtonDefinition { Name = "Ok" }
92- } ,
93- Icon = MsBox . Avalonia . Enums . Icon . Success
94- } ) ;
95- box . ShowAsPopupAsync ( this ) ;
96- SetupRoutine ( true ) ;
97- }
73+ ReadConfig ( ) ;
9874 }
9975 } ;
10076 DragBox . Cursor = new Cursor ( StandardCursorType . Hand ) ;
@@ -158,6 +134,36 @@ public MainWindow()
158134 PlatformSelect . SelectedIndex = 0 ;
159135 }
160136
137+ private void ReadConfig ( )
138+ {
139+ try
140+ {
141+ XmlSerializer ser = new XmlSerializer ( typeof ( Configuration ) ) ;
142+ StreamReader r = new StreamReader ( ConfigFile ) ;
143+ AppConfiguration = ( Configuration ) ser . Deserialize ( r ) ! ;
144+ r . Close ( ) ;
145+ foreach ( PropertyDescriptor descriptor in TypeDescriptor . GetProperties ( AppConfiguration ) )
146+ {
147+ string name = descriptor . Name ;
148+ object value = descriptor . GetValue ( AppConfiguration ) ;
149+ Console . WriteLine ( "{0}={1}" , name , value ) ;
150+ }
151+ }
152+ catch
153+ {
154+ var box = MessageBoxManager . GetMessageBoxCustom ( new MessageBoxCustomParams
155+ {
156+ ContentMessage = Lang . Resources . ConfigReadError ,
157+ ButtonDefinitions = new List < ButtonDefinition >
158+ {
159+ new ButtonDefinition { Name = "Ok" }
160+ } ,
161+ Icon = MsBox . Avalonia . Enums . Icon . Success
162+ } ) ;
163+ box . ShowAsPopupAsync ( this ) ;
164+ SetupRoutine ( true ) ;
165+ }
166+ }
161167 private void RefreshFileList ( )
162168 {
163169 FileListPanel . Children . Clear ( ) ;
0 commit comments