/// <summary> /// Get all values from the given section in the SettingStorage /// </summary> /// <param name="section">name of the section</param> /// <returns>A List with all entries of the given section</returns> public override List <KeyValuePair <string, string> > GetValues(string section) { if (!section.EndsWith("\\")) { section += "\\"; } try { TreeData dataSection = findSection(section); return(dataSection.getValues()); } catch { return(new List <KeyValuePair <string, string> >()); } }
/// <summary> /// Remove a whole section with entries and subsections /// </summary> /// <param name="section">the section to remove</param> public override void RemoveSection(string section) { try { if (section.IndexOf('\\') >= 0) { string sectionName = section.Substring(section.LastIndexOf('\\') + 1); TreeData parentSection = findParentSection(section); parentSection.RemoveSection(sectionName); } else { sections.Remove(section); } } catch { } }
/// <summary> /// Removes the value with the given name /// </summary> /// <param name="name">name of the value to remove</param> public override void RemoveValue(string name) { if (!IsValidEntryName(name)) { return; } try { if (name.IndexOf('\\') >= 0) { string valueName = name.Substring(name.LastIndexOf('\\') + 1); TreeData section = findSection(name); section.RemoveValue(valueName); } else { values.Remove(name); } } catch { } }
/// <summary> /// Factory method to create a new instance of the preferred implementation /// </summary> /// <returns>The newly created instance</returns> public static Data CreateDataStorage() { return(TreeData.CreateInstance()); }
/// <summary> /// Get all subsections of the given section and all subsections that currently exist in the DataStorage /// </summary> /// <param name="section">name of the parent section</param> /// <returns>An array with all subsection names</returns> public override string[] GetSubSections(string section) { TreeData dataSection = findSection(section); return(getSubSections(dataSection, section).ToArray()); }