void Options_btnClose(object sender, EventArgs e) { CompileBeforeUpload = Options.checkCompile.Checked; UseLastFile = Options.checkRememberLast.Checked; Optimalize = (Optimalize)Options.selectPrefer.SelectedIndex; //Compiler.Precompile(Board); if (File.Exists(Path.Combine("Tools", "libxboard.a"))) { File.Delete(Path.Combine("Tools", "libxboard.a")); } }
void Options_btnClose(object sender, EventArgs e) { CompileBeforeUpload = Options.checkCompile.Checked; UseLastFile = Options.checkRememberLast.Checked; Optimalize = (Optimalize)Options.selectPrefer.SelectedIndex; //Compiler.Precompile(Board); if (File.Exists(Path.Combine("Tools", "libxboard.a"))) File.Delete(Path.Combine("Tools", "libxboard.a")); }
private void LoadSettings(ref bool UseLastFile, ref bool CompileBeforeUpload, ref string OpenedFile) { if(File.Exists(Path.Combine("Tools", "Settings.xml"))) { XmlReader reader = null; try { reader = XmlReader.Create(Path.Combine("Tools", "Settings.xml")); reader.ReadStartElement("Settings"); string open = reader.ReadElementString("OpenLastFile"); string compile = reader.ReadElementString("CompileBeforeUpload"); string LastFile = reader.ReadElementString("LastFile"); string Optim = reader.ReadElementString("Optimalize"); string Brd = reader.ReadElementString("Board"); reader.Close(); if(open == "1") UseLastFile = true; else UseLastFile = false; if(compile == "1") CompileBeforeUpload = true; else CompileBeforeUpload = false; if (Optim == "Size") Optimalize = Optimalize.Size; else Optimalize = Optimalize.Speed; Board = (Board)Convert.ToInt32(Brd); OpenedFile = LastFile; if (LastFile == "" || !UseLastFile) { OpenedFile = FindNewNumber(); } OpenNewTab(OpenedFile); } catch(Exception) { if (reader != null) reader.Close(); File.Delete(Path.Combine("Tools", "Settings.xml")); } } if (!File.Exists(Path.Combine("Tools", "Settings.xml"))) { UseLastFile = false; CompileBeforeUpload = true; string max = "0"; foreach (FileInfo file in new DirectoryInfo("Projects").GetFiles("Project_*.cpp")) { max = file.Name.Substring(8, file.Name.Length - 8 - 4); } OpenedFile = Path.Combine("Projects", "Project_" + (Convert.ToInt32(max) + 1) + ".cpp"); SaveSettings(UseLastFile, CompileBeforeUpload, OpenedFile); OpenNewTab(OpenedFile); } }
private void LoadSettings(ref bool UseLastFile, ref bool CompileBeforeUpload, ref string OpenedFile) { if (File.Exists(Path.Combine("Tools", "Settings.xml"))) { XmlReader reader = null; try { reader = XmlReader.Create(Path.Combine("Tools", "Settings.xml")); reader.ReadStartElement("Settings"); string open = reader.ReadElementString("OpenLastFile"); string compile = reader.ReadElementString("CompileBeforeUpload"); string LastFile = reader.ReadElementString("LastFile"); string Optim = reader.ReadElementString("Optimalize"); string Brd = reader.ReadElementString("Board"); reader.Close(); if (open == "1") { UseLastFile = true; } else { UseLastFile = false; } if (compile == "1") { CompileBeforeUpload = true; } else { CompileBeforeUpload = false; } if (Optim == "Size") { Optimalize = Optimalize.Size; } else { Optimalize = Optimalize.Speed; } Board = (Board)Convert.ToInt32(Brd); OpenedFile = LastFile; if (LastFile == "" || !UseLastFile) { OpenedFile = FindNewNumber(); } OpenNewTab(OpenedFile); } catch (Exception) { if (reader != null) { reader.Close(); } File.Delete(Path.Combine("Tools", "Settings.xml")); } } if (!File.Exists(Path.Combine("Tools", "Settings.xml"))) { UseLastFile = false; CompileBeforeUpload = true; string max = "0"; foreach (FileInfo file in new DirectoryInfo("Projects").GetFiles("Project_*.cpp")) { max = file.Name.Substring(8, file.Name.Length - 8 - 4); } OpenedFile = Path.Combine("Projects", "Project_" + (Convert.ToInt32(max) + 1) + ".cpp"); SaveSettings(UseLastFile, CompileBeforeUpload, OpenedFile); OpenNewTab(OpenedFile); } }