public static urn.microsoft.guidanceexplorer.Folder xmlDB_Add_Folder(this TM_Library tmLibrary, Guid parentFolderId, string folderCaption, TM_Xml_Database tmDatabase) { try { if (parentFolderId != Guid.Empty) { var folder = tmDatabase.xmlDB_Folder(tmLibrary.Id, parentFolderId); if (folder != null) { /* var subFolder = tmDatabase.xmlDB_Folder(tmLibrary.Id,parentFolderId,folderCaption); * if (subFolder.notNull()) // there was already a subfolder with this caption * return subFolder; */ var newFolder = new urn.microsoft.guidanceexplorer.Folder() { caption = folderCaption, folderId = Guid.NewGuid().str() }; folder.folder1.Add(newFolder); var _guidanceExplorer = tmLibrary.guidanceExplorer(tmDatabase); _guidanceExplorer.xmlDB_Save_GuidanceExplorer(tmDatabase); return(tmDatabase.xmlDB_Folder(tmLibrary.Id, newFolder.folderId.guid())); } return(null); } else { /* var folder = tmLibrary.xmlDB_Folder(folderCaption, tmDatabase); * if (folder.notNull()) * { * "[TM_Xml_Database] in xmlDB_Add_Folder folder already existed, so returning existing one".debug(); * return folder; * } */ var _guidanceExplorer = tmLibrary.guidanceExplorer(tmDatabase); var newFolder = new urn.microsoft.guidanceexplorer.Folder() { caption = folderCaption, folderId = Guid.NewGuid().str() }; _guidanceExplorer.library.libraryStructure.folder.Add(newFolder); _guidanceExplorer.xmlDB_Save_GuidanceExplorer(tmDatabase); return(tmDatabase.xmlDB_Folder(tmLibrary.Id, newFolder.folderId.guid())); //return tmLibrary.xmlDB_Folder(folderCaption, tmDatabase); } } catch (Exception ex) { ex.log(); return(null); } }
public static List <urn.microsoft.guidanceexplorer.View> xmlDB_Views_InLibraryRoot(this TM_Library tmLibrary, TM_Xml_Database tmDatabase) { try { return(tmLibrary.guidanceExplorer(tmDatabase).library.libraryStructure.view.toList()); } catch { return(new List <urn.microsoft.guidanceexplorer.View>()); } }
public static string xmlDB_Path_Library_RootFolder(this TM_FileStorage tmFileStorage, TM_Library tmLibrary) { var guidanceExplorer = tmLibrary.guidanceExplorer(tmFileStorage.tmXmlDatabase()); return(tmFileStorage.xmlDB_Path_Library_RootFolder(guidanceExplorer)); }