/// <summary> /// Save the cache settings to an xml document /// </summary> /// <param name="xmlOut">xml writer to use</param> public void saveState(XmlWriter xmlOut) { xmlOut.WriteStartElement(CachePreferences.TagName); xmlOut.WriteAttributeString("UnifiedCache", this.UnifiedCache.ToString()); DataCachePreferences.saveState(xmlOut); InstructionCachePreferences.saveState(xmlOut); xmlOut.WriteEndElement(); }
/// <summary> /// Load the cache settings from an xml document. /// Loads the global settings, data cache and instruction cache settings /// </summary> /// <param name="xmlIn">xml reader to read from</param> public void LoadFromXML(XmlReader xmlIn) { try { this.defaultSettings(); xmlIn.MoveToContent(); this.UnifiedCache = bool.Parse(xmlIn.GetAttribute("UnifiedCache")); xmlIn.Read(); do { if (xmlIn.NodeType == XmlNodeType.EndElement) { break; } if (xmlIn.NodeType == XmlNodeType.Element) { if (xmlIn.Name == DataCachePreferences.TagName) { DataCachePreferences.LoadFromXML(xmlIn.ReadSubtree()); }//if else if (xmlIn.Name == InstructionCachePreferences.TagName) { InstructionCachePreferences.LoadFromXML(xmlIn.ReadSubtree()); } }//if xmlIn.Skip(); } while (!xmlIn.EOF); }//try catch (Exception ex) { ARMPluginInterfaces.Utils.OutputDebugString(ex.Message); this.defaultSettings(); } }//LoadFromXML
/// <summary> /// cachePreferences ctor /// create the preferences objects and set all fields to a default value /// </summary> public CachePreferences() { DataCachePreferences = new DataCachePreferences(); InstructionCachePreferences = new InstructionCachePreferences(); this.defaultSettings(); }
}//LoadFromXML /// <summary> /// Sets all cache settings to a default value /// </summary> public void defaultSettings() { DataCachePreferences.defaultSettings(); InstructionCachePreferences.defaultSettings(); this.UnifiedCache = false; }