// Override this method to save options. public override void Save() { /*=== update the global project options, then save ===*/ List <OptionsElement> options = ProjectOptions.Options; ProjectOptionsSet optionsSet = OptionsManager.GetProjectOptions(project); foreach (OptionsElement oe in options) { optionsSet.GetNewConfiguration(oe.Configuration, oe.Platform).Options = new Options(oe.Options); } optionsSet.Save(); }
// Save this project's options file. public override void Save() { if (project == null) { return; } string file = Paths.GetProjectOptionsFilename(project); ProjectOptionsSet os = this; if (!XmlUtility.SaveXml(file, ref os)) { MessageBox.Show("opC++ unable to save project options file '" + file + "'."); } }
/*=== utility ===*/ // Call this to initialize settings. public virtual void Initialize(Project p) { project = p; gOptions = new Options(OptionsManager.GetGlobalOptions().GetGlobalConfiguration().Options); ProjectOptions = new ProjectOptionsSet(project); /*=== add the existing options ===*/ List <OptionsElement> options = OptionsManager.GetProjectOptions(p).Options; foreach (OptionsElement oe in options) { OptionsElement newOE = new OptionsElement(); newOE.Configuration = oe.Configuration; newOE.Platform = oe.Platform; newOE.Options = new Options(oe.Options); ProjectOptions.AddConfiguration(newOE); } }
public static ProjectOptionsSet GetProjectOptions(Project p) { if (p == null) { return(null); } ProjectOptionsSet project = null; if (!ProjectOptions.TryGetValue(p, out project)) { project = new ProjectOptionsSet(p); project.Load(); ProjectOptions.Add(p, project); } return(project); }
/*=== overrides ===*/ // Reload this project's options file. public override void Load() { if (project == null) { return; } string file = Paths.GetProjectOptionsFilename(project); ProjectOptionsSet os = null; // Load the project options. XmlUtility.LoadXml(file, ref os); if (os == null) { this.Options = new List <OptionsElement>(); } else { this.Options = os.Options; } string activeConfiguration = ProjectUtility.GetActiveConfiguration(project); string activePlatform = ProjectUtility.GetActivePlatform(project); if (GetConfiguration(activeConfiguration, activePlatform) == null) { OptionsElement oe = new OptionsElement(); oe.Configuration = activeConfiguration; oe.Platform = activePlatform; oe.Options.SetDefaults(); AddConfiguration(oe); // Save the new project options. Save(); } }