internal static MilkshakePreferences Load() { try { XmlSerializer _ser = new XmlSerializer(typeof(MilkshakePreferences)); if (!File.Exists(GetPath())) { return(new MilkshakePreferences()); } Stream _stream = File.Open(GetPath(), FileMode.Open); MilkshakePreferences pref = (MilkshakePreferences)_ser.Deserialize(_stream); _stream.Close(); return(pref); } catch (Exception err) { Console.WriteLine("Error while trying to load the settings file: " + err); return(new MilkshakePreferences()); } }
private void MilkshakeForm_Load(object sender, EventArgs e) { InitializeNodes(); _preferences = MilkshakePreferences.Load(); sceneEditorControl.Preferences = _preferences; this.SceneEditorTool = MilkshakeSceneEditorTool.Select; if (_preferences.ForceWindowParametersAtStartup == true) { this.Left = _preferences.LastEditorPosition.X; this.Top = _preferences.LastEditorPosition.Y; this.Size = new Size(_preferences.LastEditorSize.X, _preferences.LastEditorSize.Y); this.WindowState = _preferences.LastEditorMaximizedState ? FormWindowState.Maximized : FormWindowState.Normal; } if (_projToLoad != string.Empty) { LoadProject(_projToLoad); } else { if (_preferences.EditorStartupAction == MilkshakePreferencesEditorStartupAction.OpenStartupWizard) { _currentProject = new IceCreamProject(); _projectWasModified = true; } else if (_preferences.EditorStartupAction == MilkshakePreferencesEditorStartupAction.OpenLastEditedProject && String.IsNullOrEmpty(_preferences.LastOpenedProject) == false) { try { LoadProject(_preferences.LastOpenedProject); } catch { } } } RefreshEditorStatus(); // focus by default on the scene sceneEditorControl.Focus(); }