public void NormalizeFilePath() { Assert.AreEqual("\\sitecore\\test.txt", PathHelper.NormalizeFilePath("\\sitecore\\test.txt")); Assert.AreEqual("\\sitecore\\test.txt", PathHelper.NormalizeFilePath("/sitecore/test.txt")); Assert.AreEqual("sitecore\\test.txt", PathHelper.NormalizeFilePath("sitecore/test.txt")); Assert.AreEqual("test.txt", PathHelper.NormalizeFilePath("test.txt")); }
public virtual bool TryGetProjectFileName(string websiteFileName, out string projectFileName) { projectFileName = string.Empty; websiteFileName = '\\' + PathHelper.NormalizeFilePath(websiteFileName).TrimStart('\\'); foreach (var mapper in WebsiteDirectoryToProjectDirectories) { if (mapper.TryGetProjectFileName(websiteFileName, out projectFileName)) { return(true); } } return(false); }
public virtual bool TryGetWebsiteItemPath(string projectFileName, out string databaseName, out string itemPath, out bool isImport, out bool uploadMedia) { itemPath = string.Empty; databaseName = string.Empty; isImport = false; uploadMedia = true; projectFileName = '\\' + PathHelper.NormalizeFilePath(projectFileName).TrimStart('\\'); foreach (var mapper in ProjectDirectoryToWebsiteItemPaths) { if (mapper.TryGetWebsiteItemPath(projectFileName, out databaseName, out itemPath, out isImport, out uploadMedia)) { return(true); } } return(false); }
public bool IsMatch(string fileName) { fileName = PathHelper.NormalizeFilePath(fileName); return(Includes.Any(include => include.IsMatch(fileName) && Excludes.All(exclude => !exclude.IsMatch(fileName)))); }
public bool IsExcluded(string fileName) { fileName = PathHelper.NormalizeFilePath(fileName); return(Excludes.Any(exclude => exclude.IsMatch(fileName))); }