void xFailSafe_CheckedChanged( object sender, EventArgs e ) { SettingsFile sf = new SettingsFile(); if( File.Exists( Paths.GameSettingsFile ) ) { sf.Load( Paths.GameSettingsFile ); } bool failSafeEnabled = sf.GetBool( "mc.failsafe", false ); if( failSafeEnabled != xFailSafe.Checked ) { sf.Set( "mc.failsafe", xFailSafe.Checked ); sf.Save( Paths.GameSettingsFile ); } lOptionsStatus.Text = "Fail-safe mode " + (xFailSafe.Checked ? "enabled" : "disabled") + "."; }
void LoadLauncherSettings() { Log( "LoadLauncherSettings" ); SettingsFile settings = new SettingsFile(); if( File.Exists( Paths.LauncherSettingsFile ) ) { settings.Load( Paths.LauncherSettingsFile ); } bool saveUsername = settings.GetBool( "rememberUsername", true ); bool multiUser = settings.GetBool( "multiUser", false ); bool savePassword = settings.GetBool( "rememberPassword", false ); bool saveUrl = settings.GetBool( "rememberServer", true ); GameUpdateMode gameUpdateMode = settings.GetEnum( "gameUpdateMode", GameUpdateMode.Ask ); StartingTab startingTab = settings.GetEnum( "startingTab", StartingTab.SignIn ); xRememberUsername.Checked = saveUsername; xMultiUser.Checked = multiUser; xRememberPassword.Checked = savePassword; xRememberServer.Checked = saveUrl; cGameUpdates.SelectedIndex = (int)gameUpdateMode; cStartingTab.SelectedIndex = (int)startingTab; settingsLoaded = true; }
void tabs_SelectedIndexChanged( object sender, EventArgs e ) { if( !tabs.Visible ) { return; } if( tabs.SelectedTab == tabSignIn ) { AcceptButton = bSignIn; if( cSignInUsername.Text.Length == 0 ) { cSignInUsername.Focus(); } else if( tSignInPassword.Text.Length == 0 ) { tSignInPassword.Focus(); } else { tSignInUrl.Focus(); } } else if( tabs.SelectedTab == tabResume ) { AcceptButton = bResume; bResume.Focus(); } else if( tabs.SelectedTab == tabDirect ) { AcceptButton = bDirectConnect; tDirectUrl.Focus(); } else if( tabs.SelectedTab == tabOptions ) { AcceptButton = null; SettingsFile sf = new SettingsFile(); if( File.Exists( Paths.GameSettingsFile ) ) { sf.Load( Paths.GameSettingsFile ); } xFailSafe.Checked = sf.GetBool( "mc.failsafe", false ); } else { AcceptButton = null; } }