public static SerializedTab TryCreate(IDocumentTabContentFactoryService documentTabContentFactoryService, IDocumentTab tab) { var contentSect = new SettingsSection(CONTENT_SECTION); var guid = documentTabContentFactoryService.Serialize(tab.Content, contentSect); if (guid == null) { return(null); } contentSect.Attribute(CONTENT_GUID_ATTR, guid.Value); var uiSect = new SettingsSection(UI_SECTION); tab.UIContext.SerializeUIState(uiSect, tab.UIContext.CreateUIState()); var tabUISect = new SettingsSection(TAB_UI_SECTION); tab.SerializeUI(tabUISect); var paths = new List <SerializedPath>(); foreach (var node in tab.Content.Nodes) { paths.Add(SerializedPath.Create(node)); } var autoLoadedDocuments = new List <DsDocumentInfo>(); foreach (var f in GetAutoLoadedDocuments(tab.Content.Nodes)) { autoLoadedDocuments.Add(f); } return(new SerializedTab(contentSect, tabUISect, uiSect, paths, autoLoadedDocuments)); }
public static SerializedPath Load(ISettingsSection pathSection) { var path = new SerializedPath(); foreach (var sect in pathSection.SectionsWithName(NAME_SECTION)) { path.Names.Add(NodePathNameSerializer.Load(sect)); } return(path); }
public static SerializedPath Create(IDocumentTreeNodeData node) { var path = new SerializedPath(); while (node != null && node.TreeNode.Parent != null) { path.Names.Add(node.NodePathName); var parent = node.TreeNode.Parent; node = parent.Data as IDocumentTreeNodeData; } path.Names.Reverse(); return(path); }
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)); }
public static SerializedPath Create(DocumentTreeNodeData node) { var path = new SerializedPath(); while (node != null && node.TreeNode.Parent != null) { path.Names.Add(node.NodePathName); var parent = node.TreeNode.Parent; node = parent.Data as DocumentTreeNodeData; } path.Names.Reverse(); return path; }
public static SerializedPath Load(ISettingsSection pathSection) { var path = new SerializedPath(); foreach (var sect in pathSection.SectionsWithName(NAME_SECTION)) path.Names.Add(NodePathNameSerializer.Load(sect)); return path; }