public void Save(ISettingsSection section) { section.Attribute(DOCUMENTLIST_NAME_ATTR, Name); foreach (var info in Documents) { DsDocumentInfoSerializer.Save(section.CreateSection(DOCUMENT_SECTION), info); } }
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 void Save(ISettingsSection section) { Debug.Assert(Content.Attribute <Guid?>(CONTENT_GUID_ATTR) != null); section.CreateSection(CONTENT_SECTION).CopyFrom(Content); section.CreateSection(UI_SECTION).CopyFrom(UI); section.CreateSection(TAB_UI_SECTION).CopyFrom(TabUI); foreach (var path in Paths) { path.Save(section.CreateSection(PATH_SECTION)); } foreach (var f in AutoLoadedDocuments) { DsDocumentInfoSerializer.Save(section.CreateSection(AUTOLOADED_SECTION), f); } }
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)); }