public static TM_Library tmLibrary(this urn.microsoft.guidanceexplorer.View viewToFind, TM_Xml_Database tmDatabase) { return((from tmLibrary in tmDatabase.tmLibraries() from view in tmLibrary.xmlDB_Views(tmDatabase) where view == viewToFind select tmLibrary).first()); }
public static TM_Xml_Database setupGitSupport(this TM_Xml_Database tmDatabase) { var gitConfig = tmDatabase.tmConfig().Git; if (gitConfig.LibraryData_Git_Enabled) { foreach (var library in tmDatabase.tmLibraries()) { var libraryPath = tmDatabase.xmlDB_Path_Library_XmlFile(library).parentFolder(); if (libraryPath.isGitRepository()) { var nGit = libraryPath.git_Open(); try { nGit.git_Pull_Library(); nGit.git_Push_Library(); } catch (Exception ex) { ex.log(); } tmDatabase.NGits.Add(nGit); } } tmDatabase.triggerGitCommit(); } return(tmDatabase); }
public static string Get_Path_To_File(this TM_Xml_Database tmDatabase, string fileKey) { var filePath = TM_Xml_Database.Current.Path_XmlLibraries.pathCombine("_Images").pathCombine(fileKey); if (filePath.fileExists()) { return(filePath); } var splitedFileKey = fileKey.split("/"); if (splitedFileKey.size() == 2) { var item = splitedFileKey[0].trim(); var fileName = splitedFileKey[1].trim(); if (item.isGuid()) { return(tmDatabase.Get_Path_To_File(item.guid(), fileName)); } return(tmDatabase.Get_Path_To_File(item, fileName)); } foreach (var library in tmDatabase.tmLibraries()) { filePath = tmDatabase.Get_Path_To_File(library.Caption, fileKey); if (filePath.notNull()) { return(filePath); } } return(null); }
public static TM_Library tmLibrary(this urn.microsoft.guidanceexplorer.View viewToFind, TM_Xml_Database tmDatabase) { return (from tmLibrary in tmDatabase.tmLibraries() from view in tmLibrary.xmlDB_Views(tmDatabase) where view == viewToFind select tmLibrary).first(); }
public static TM_Xml_Database setupGitSupport(this TM_Xml_Database tmDatabase) { if (tmDatabase.AutoGitCommit) { foreach (var library in tmDatabase.tmLibraries()) { var libraryPath = tmDatabase.xmlDB_LibraryPath(library.Caption).parentFolder(); if (libraryPath.isGitRepository()) { var nGit = libraryPath.git_Open(); try { nGit.pull(); nGit.push(); } catch (Exception ex) { ex.log(); } tmDatabase.NGits.Add(nGit); } } tmDatabase.triggerGitCommit(); /*tmDatabase.NGit = tmDatabase.Path_XmlLibraries.isGitRepository() * ? tmDatabase.Path_XmlLibraries.git_Open() * : tmDatabase.Path_XmlLibraries.git_Init(); * tmDatabase.triggerGitCommit();*/ } return(tmDatabase); }
public static TM_Library tmLibrary(this TM_Xml_Database tmDatabase, Guid libraryId) { var tmLibrary = (from library in tmDatabase.tmLibraries() where library.Id == libraryId select library).first(); //if (tmLibrary.isNull()) // "[TM_Xml_Database] couldn't find library with id: {0}".error(libraryId); return(tmLibrary); }
public static List <View_V3> tmViews(this TM_Xml_Database tmDatabase) { var tmViews = new List <View_V3>(); foreach (var tmLibrary in tmDatabase.tmLibraries()) { tmViews.add(tmDatabase.tmViews(tmLibrary)); } return(tmViews); }
//gets all folders (recursive search) public static List <Folder_V3> tmFolders(this TM_Xml_Database tmDatabase) { var tmFolders = new List <Folder_V3>(); foreach (var tmLibrary in tmDatabase.tmLibraries()) { tmFolders.add(tmDatabase.tmFolders_All(tmLibrary.Id)); } return(tmFolders); }
public static TM_Library tmLibrary(this TM_Xml_Database tmDatabase, string caption) { if (caption.isGuid()) // if the value provided is a guid, then { return(tmDatabase.tmLibrary(caption.guid())); } var tmLibrary = (from library in tmDatabase.tmLibraries() where library.Caption == caption select library).first(); //if (tmLibrary.isNull()) // "[TM_Xml_Database] couldn't find library with caption: {0}".error(caption); return(tmLibrary); }
public static TM_Xml_Database setupGitSupport(this TM_Xml_Database tmDatabase) { if (tmDatabase.AutoGitCommit) { var online = MiscUtils.online(); if (online) { "[TM_Xml_Database] [setupGitSupport] we are online, so git Pull and Pull will be attempted".info(); } else { "[TM_Xml_Database] [setupGitSupport] we are offline, so no git Pull and Pulls".info(); } foreach (var library in tmDatabase.tmLibraries()) { var libraryPath = tmDatabase.xmlDB_Path_Library_XmlFile(library).parentFolder(); if (libraryPath.isGitRepository()) { var nGit = libraryPath.git_Open(); if (online) { try { "[TM_Xml_Database] [setupGitSupport] doing git Pull and Push for: {0}".debug(libraryPath.folderName()); nGit.pull(); nGit.push(); } catch (Exception ex) { ex.log(); } } tmDatabase.NGits.Add(nGit); } else { "[TM_Xml_Database] [setupGitSupport] library {0} is currently not a git repo".info(libraryPath.folderName()); } } tmDatabase.triggerGitCommit(); /*tmDatabase.NGit = tmDatabase.Path_XmlLibraries.isGitRepository() * ? tmDatabase.Path_XmlLibraries.git_Open() * : tmDatabase.Path_XmlLibraries.git_Init(); * tmDatabase.triggerGitCommit();*/ } return(tmDatabase); }
public static IList <urn.microsoft.guidanceexplorer.Folder> xmlDB_Folders_All(this TM_Xml_Database tmDatabase) { return((from tmLibrary in tmDatabase.tmLibraries() from folder in tmDatabase.xmlDB_Folders_All(tmLibrary.Id) select folder).toList()); }
public static List <urn.microsoft.guidanceexplorer.View> xmlDB_Views(this TM_Xml_Database tmDatabase) { return((from tmLibrary in tmDatabase.tmLibraries() from view in tmLibrary.xmlDB_Views(tmDatabase) select view).toList()); }
public static Folder_V3 tmFolder(this TM_Xml_Database tmDatabase, Guid folderId) { return(tmDatabase.tmLibraries() .Select(tmLibrary => tmDatabase.tmFolder(tmLibrary.Id, folderId)) .FirstOrDefault(tmFolder => tmFolder.notNull())); }