public static DocumentList Create(ISettingsSection section) { var documentList = new DocumentList(section.Attribute <string>(DOCUMENTLIST_NAME_ATTR)); foreach (var documentSect in section.SectionsWithName(DOCUMENT_SECTION)) { var info = DsDocumentInfoSerializer.TryLoad(documentSect); if (info is not null) { documentList.Documents.Add(info.Value); } } return(documentList); }
public static SerializedTab TryLoad(ISettingsSection section) { var contentSect = section.TryGetSection(CONTENT_SECTION); if (contentSect == null || contentSect.Attribute <Guid?>(CONTENT_GUID_ATTR) == null) { return(null); } var uiSect = section.TryGetSection(UI_SECTION); if (uiSect == null) { return(null); } var tabUISect = section.TryGetSection(TAB_UI_SECTION); if (tabUISect == null) { return(null); } var paths = new List <SerializedPath>(); foreach (var pathSection in section.SectionsWithName(PATH_SECTION)) { paths.Add(SerializedPath.Load(pathSection)); } var autoLoadedDocuments = new List <DsDocumentInfo>(); foreach (var sect in section.SectionsWithName(AUTOLOADED_SECTION)) { var info = DsDocumentInfoSerializer.TryLoad(sect); if (info != null) { autoLoadedDocuments.Add(info.Value); } } return(new SerializedTab(contentSect, tabUISect, uiSect, paths, autoLoadedDocuments)); }