public void ResetOptions() { Audio = new AudioSettings(); Graphics = new GraphicsSettings(); Controls = new ControlsSettings(); RubiksCube = new RubiksCubeSettings(); }
public void Initialize(GraphicsDeviceManager graphics) { graphicsDevice = graphics; string filePath = Constants.SETTINGS_FILE; Audio = new AudioSettings(); Graphics = new GraphicsSettings(); Controls = new ControlsSettings(); RubiksCube = new RubiksCubeSettings(); if (File.Exists(filePath)) { StreamReader stream = new StreamReader(filePath, true); try { LoadOptions(stream); } catch { System.Windows.Forms.MessageBox.Show( $"Error occured while loading from file '{filePath}', reseting file.", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); ResetOptions(); } finally { stream.Close(); stream.Dispose(); } } Save(); ApplyChanges(); }