public SectionList Load() { var sectionList = new SectionList(); var globalSection = new Section("Global"); Item settingsRoot = _database.GetItem(_settingsRoot); sectionList.Add(GetSettings(settingsRoot, globalSection, settingsRoot.Name)); return sectionList; }
private static Section GetSettings(Item item, Section globalSection, string name) { foreach (Item childItem in item.Children) { string pathName = name + "." + childItem.Name; if (childItem.TemplateName.Equals("Folder")) { GetSettings(childItem, globalSection, pathName); } else { globalSection.Add(new Setting(pathName, childItem.Fields["Value"].ToString(), typeof(string))); } } return globalSection; }