public string GetClosestFilePath(string pathToLinkedFile, out ClosestFileStatus status) { FailWhenDisposed(); if (!String.IsNullOrWhiteSpace(pathToLinkedFile)) { status = ClosestFileStatus.ExactMatch; // Link other file and get metadata from there. var languageForFile = TransformationData.CurrentFolderDetails.Language; var linkedFileDir = new DirectoryInfo( Path.Combine(Path.Combine(TransformationData.CurrentFolderDetails.AbsoluteMarkdownPath, pathToLinkedFile))); if (!linkedFileDir.Exists || linkedFileDir.GetFiles(string.Format("*.{0}.udn", TransformationData.CurrentFolderDetails.Language)).Length == 0) { // if this is not an INT file check for the INT version. if (TransformationData.CurrentFolderDetails.Language != "INT") { if (!linkedFileDir.Exists || linkedFileDir.GetFiles("*.INT.udn").Length == 0) { status = ClosestFileStatus.FileMissing; return(null); } status = ClosestFileStatus.ChangedToIntVersion; } else { status = ClosestFileStatus.FileMissing; return(null); } } if (linkedFileDir.Exists && linkedFileDir.GetFiles(string.Format("*.{0}.udn", languageForFile)).Length > 0) { return(linkedFileDir.GetFiles(string.Format("*.{0}.udn", languageForFile))[0].FullName); } } status = ClosestFileStatus.FileMissing; return(null); }
public EMDocument GetClosest(string path, out ClosestFileStatus status) { FailWhenDisposed(); if (!string.IsNullOrWhiteSpace(path)) { var closestPath = GetClosestFilePath(path, out status); if (status == ClosestFileStatus.FileMissing) { return(null); } return(Get(closestPath)); } status = ClosestFileStatus.ExactMatch; return(CurrentFileDocument); }
public string GetClosestFilePath(string pathToLinkedFile, out ClosestFileStatus status) { FailWhenDisposed(); if (!String.IsNullOrWhiteSpace(pathToLinkedFile)) { status = ClosestFileStatus.ExactMatch; // Link other file and get metadata from there. var languageForFile = TransformationData.CurrentFolderDetails.Language; var linkedFileDir = new DirectoryInfo( Path.Combine(Path.Combine(TransformationData.CurrentFolderDetails.AbsoluteMarkdownPath, pathToLinkedFile))); if (!linkedFileDir.Exists || linkedFileDir.GetFiles(string.Format("*.{0}.udn", TransformationData.CurrentFolderDetails.Language)).Length == 0) { // if this is not an INT file check for the INT version. if (TransformationData.CurrentFolderDetails.Language != "INT") { if (!linkedFileDir.Exists || linkedFileDir.GetFiles("*.INT.udn").Length == 0) { status = ClosestFileStatus.FileMissing; return null; } status = ClosestFileStatus.ChangedToIntVersion; } else { status = ClosestFileStatus.FileMissing; return null; } } if (linkedFileDir.Exists && linkedFileDir.GetFiles(string.Format("*.{0}.udn", languageForFile)).Length > 0) { return linkedFileDir.GetFiles(string.Format("*.{0}.udn", languageForFile))[0].FullName; } } status = ClosestFileStatus.FileMissing; return null; }
public EMDocument GetClosest(string path, out ClosestFileStatus status) { FailWhenDisposed(); if (!string.IsNullOrWhiteSpace(path)) { var closestPath = GetClosestFilePath(path, out status); if (status == ClosestFileStatus.FileMissing) { return null; } return Get(closestPath); } status = ClosestFileStatus.ExactMatch; return CurrentFileDocument; }