public static void SaveSettings(string path = "Gemini.xml") { Serializable.Gemini saveData = new Serializable.Gemini(); saveData.WindowMaximized = Application.OpenForms.Count == 0 ? false : Application.OpenForms[0].WindowState == FormWindowState.Maximized; saveData.WindowBounds = new Serializable.WindowBounds(saveData.WindowMaximized ? WindowBounds : Application.OpenForms[0].Bounds); saveData.AutoHideMenuBar = AutoHideMenuBar; saveData.DistracionMode = DistractionMode; List <Serializable.File> f = new List <Serializable.File>(); foreach (string s in RecentlyOpened) { f.Add(new Serializable.File(s)); } saveData.Files = new Serializable.Files(AutoOpen, f.ToArray()); saveData.UseAutoIndent = AutoIndent; saveData.UseGuideLines = GuideLines; saveData.UseLineHighLight = LineHighLight; saveData.LineHighLightColor = Serializable.ColorSerializetionHelper.Serialize(LineHighLightColor); saveData.UseCodeFolding = CodeFolding; saveData.RecentPriority = RecentPriority; saveData.AutoSaveConfig = AutoSaveConfig; saveData.UseProjectConfig = ProjectConfig; saveData.ScriptStyles = ScriptStyles; saveData.AutoComplete = new Serializable.AutoComplete(AutoComplete, AutoCompleteLength, AutoCompleteFlag, AutoCompleteCustomWords); saveData.AutoCheckUpdates = AutoCheckUpdates; if (File.Exists(path)) { File.Delete(path); } using (Stream stream = File.OpenWrite(path)) new System.Xml.Serialization.XmlSerializer(typeof(Serializable.Gemini)).Serialize(stream, saveData); }
public static void SaveSettings(string path = "Gemini.xml") { Serializable.Gemini saveData = new Serializable.Gemini(); saveData.WindowMaximized = Application.OpenForms.Count == 0 ? false : Application.OpenForms[0].WindowState == FormWindowState.Maximized; saveData.WindowBounds = new Serializable.WindowBounds(saveData.WindowMaximized ? WindowBounds : Application.OpenForms[0].Bounds); saveData.AutoHideMenuBar = AutoHideMenuBar; saveData.DistracionMode = DistractionMode; List<Serializable.File> f = new List<Serializable.File>(); foreach (string s in RecentlyOpened) f.Add(new Serializable.File(s)); saveData.Files = new Serializable.Files(AutoOpen, f.ToArray()); saveData.UseAutoIndent = AutoIndent; saveData.UseGuideLines = GuideLines; saveData.UseLineHighLight = LineHighLight; saveData.LineHighLightColor = Serializable.ColorSerializetionHelper.Serialize(LineHighLightColor); saveData.UseCodeFolding = CodeFolding; saveData.RecentPriority = RecentPriority; saveData.AutoSaveConfig = AutoSaveConfig; saveData.UseProjectConfig = ProjectConfig; saveData.ScriptStyles = ScriptStyles; saveData.AutoComplete = new Serializable.AutoComplete(AutoComplete, AutoCompleteLength, AutoCompleteFlag, AutoCompleteCustomWords); saveData.AutoCheckUpdates = AutoCheckUpdates; if (File.Exists(path)) File.Delete(path); using (Stream stream = File.OpenWrite(path)) new System.Xml.Serialization.XmlSerializer(typeof(Serializable.Gemini)).Serialize(stream, saveData); }