/// <inheritdoc /> public virtual IWorkspaceFolder GetWorkspaceFolder(DirectoryInfo directoryInfo) { if (directoryInfo == null) { return(null); } if (!directoryInfo.Exists) { return(null); } string dirPath = directoryInfo.FullName; using (IEnumerator <IWorkspaceFolder> folderItr = FlatHierarchy <IWorkspaceFolder>().GetEnumerator()) { while (folderItr.MoveNext()) { IWorkspaceFolder folder = folderItr.Current; if (folder == null) { continue; } string folderPath = folder.Location.LocalPath; if (folderPath == dirPath) { return(folder); } } } return(null); }
/// <inheritdoc /> public virtual IWorkspaceFile GetWorkspaceFile(FileInfo fileInfo) { if (fileInfo == null) { return(null); } if (!fileInfo.Exists) { return(null); } DirectoryInfo fileDirectory = fileInfo.Directory; IWorkspaceFolder workspaceFolder = GetWorkspaceFolder(fileDirectory); if (workspaceFolder == null) { return(null); } string fileName = fileInfo.Name; IWorkspaceArtefact folderArtefact = workspaceFolder.GetArtefact(fileName); return(folderArtefact as IWorkspaceFile); }