@@ -11,7 +11,7 @@ public class Settings {
1111
1212
1313 private static XElement basics = new XElement ( "Basics" ,
14- new XElement ( "Address" , "" ) ,
14+ new XElement ( "Address" , "SyncPlay.pl:8995 " ) ,
1515 new XElement ( "Username" , "" ) ,
1616 new XElement ( "Password" , "" ) ,
1717 new XElement ( "RoomName" , "" ) ,
@@ -25,16 +25,20 @@ public class Settings {
2525 new XElement ( "PauseWhenAUserLeavesOrGetDisconnected" , "True" ) ,
2626 new XElement ( "SyncMyReadyToWatchStatusWithPlayState" , "True" ) ,
2727 new XElement ( "NeverSlowDownOrRewindOther" , "False" ) ,
28- new XElement ( "FastForwardIfLaggingBehind" , "True" )
28+ new XElement ( "FastForwardIfLaggingBehind" , "True" ) ,
29+ new XElement ( "DisableUnsyncModeAfterRemoteFileChange" , "True" ) ,
30+ new XElement ( "ResyncWithOthersAfterDisablingUnsyncMode" , "True" ) ,
31+ new XElement ( "ChangeLocalStateToReSyncWithOthers" , "True" )
2932 ) ;
3033
3134 private static XElement chatbehaviour = new XElement ( "Chat" ,
3235 new XElement ( "ShowMessagesInPlayerWindow" , "True" ) ,
36+ new XElement ( "AllowMultiLineMessages" , "False" ) ,
3337 new XElement ( "PlayNotificationSound" , "False" ) ,
3438 new XElement ( "DisableAnimations" , "False" ) ,
3539 new XElement ( "AutoplayGifs" , "False" ) ,
3640 new XElement ( "PreviewLinks" , "False" ) ,
37- new XElement ( "EnableOSDMessages" , "" ) ,
41+ new XElement ( "EnableOSDMessages" , "True " ) ,
3842 new XElement ( "ShowEventsInYourRoom" , "True" ) ,
3943 new XElement ( "ShowEventsFromNonOperatorsInManagedRooms" , "False" ) ,
4044 new XElement ( "ShowEventsInOtherRooms" , "False" ) ,
@@ -62,14 +66,21 @@ public class Settings {
6266 ) ;
6367
6468 public static void DefineSharedSettings ( ) {
69+
6570 Common . Shared . CurrentConfig = XDocument . Parse ( System . IO . File . ReadAllText ( "SyncPlayConfig.xml" ) ) ;
71+
6672 }
6773
6874 public static void RestoreDefaultConfiguration ( ) {
6975 if ( System . IO . File . Exists ( "SyncPlayConfig.xml" ) ) {
7076 XDocument doc = XDocument . Parse ( System . IO . File . ReadAllText ( "SyncPlayConfig.xml" ) ) ;
7177 foreach ( var sectiontag in NewConfig . Element ( "Config" ) . Elements ( ) ) {
7278 foreach ( var proptag in sectiontag . Elements ( ) ) {
79+
80+ if ( ! doc . Element ( "Config" ) . Element ( sectiontag . Name ) . Elements ( ) . Any ( t => t . Name == proptag . Name ) ) {
81+ doc . Element ( "Config" ) . Element ( sectiontag . Name ) . Add ( new XElement ( proptag . Name ) ) ;
82+ }
83+
7384 doc . Element ( "Config" ) . Element ( sectiontag . Name ) . Element ( proptag . Name ) . Value = proptag . Value ;
7485 }
7586 }
@@ -116,8 +127,20 @@ public static string GetCurrentConfigStringValue(string section, string attribut
116127 }
117128
118129 public static void WriteConfigurationToView ( Pages . SettingsPage Page ) {
119- XDocument doc = XDocument . Parse ( System . IO . File . ReadAllText ( "SyncPlayConfig.xml" ) ) ;
130+ XDocument doc = null ;
131+ doc = XDocument . Parse ( System . IO . File . ReadAllText ( "SyncPlayConfig.xml" ) ) ;
132+ try {
133+ WriteConfig ( Page , doc ) ;
134+ } catch ( Exception ) {
135+ RestoreDefaultConfiguration ( ) ;
136+ DefineSharedSettings ( ) ;
137+ WriteConfig ( Page , doc ) ;
138+ }
120139
140+
141+ }
142+
143+ private static void WriteConfig ( Pages . SettingsPage Page , XDocument doc ) {
121144 Page . ServerAddressField . Text = GetStringValue ( doc , "Basics" , "Address" ) ;
122145 Page . UsernameField . Text = GetStringValue ( doc , "Basics" , "Username" ) ;
123146 Page . RoomNameField . Text = GetStringValue ( doc , "Basics" , "RoomName" ) ;
@@ -130,8 +153,13 @@ public static void WriteConfigurationToView(Pages.SettingsPage Page) {
130153 Page . SyncReadyToPlayWithPauseState . IsChecked = GetBooleanValue ( doc , "Behaviour" , "SyncMyReadyToWatchStatusWithPlayState" ) ;
131154 Page . NeverSlowDownOrRewindOthers . IsChecked = GetBooleanValue ( doc , "Behaviour" , "NeverSlowDownOrRewindOther" ) ;
132155 Page . FastForwardIfLagginingBehind . IsChecked = GetBooleanValue ( doc , "Behaviour" , "FastForwardIfLaggingBehind" ) ;
156+ Page . DisableUnsyncModeAfterRemoteFileChange . IsChecked = GetBooleanValue ( doc , "Behaviour" , "DisableUnsyncModeAfterRemoteFileChange" ) ;
157+ Page . ResyncWithOthersAfterDisablingUnsyncMode . IsChecked = GetBooleanValue ( doc , "Behaviour" , "ResyncWithOthersAfterDisablingUnsyncMode" ) ;
158+ Page . ChangeLocalStateToReSyncWithOthers . IsChecked = GetBooleanValue ( doc , "Behaviour" , "DisableUnsyncModeAfterRemoteFileChange" ) ;
159+
133160
134161 Page . ShowMessagesInPlayerWindow . IsChecked = GetBooleanValue ( doc , "Chat" , "ShowMessagesInPlayerWindow" ) ;
162+ Page . AllowMultiLineMessages . IsChecked = GetBooleanValue ( doc , "Chat" , "AllowMultiLineMessages" ) ;
135163 Page . PlayNotificationSound . IsChecked = GetBooleanValue ( doc , "Chat" , "PlayNotificationSound" ) ;
136164 Page . DisableAnimations . IsChecked = GetBooleanValue ( doc , "Chat" , "DisableAnimations" ) ;
137165 Page . AutoPlayGIFs . IsChecked = GetBooleanValue ( doc , "Chat" , "AutoplayGifs" ) ;
0 commit comments