public static async Task <List <FromSoftwareFile> > LoadChildrenAsync(FromSoftwareFile fromSoftwareFile) { if (!fromSoftwareFile.IsDirectory) { return(Empty); } var filePath = Path.Combine(fromSoftwareFile.Path, fromSoftwareFile.FileName); return(await Task.Run(() => { return FromSoftwareFileSearch.GetGameFiles(fromSoftwareFile.RootDirectory, filePath, fromSoftwareFile.FileSearchPattern) .Union(FromSoftwareFileSearch.GetSubDirectories(fromSoftwareFile.RootDirectory, filePath)) .Select(childrenFile => new FromSoftwareFile(fromSoftwareFile.RootDirectory, fromSoftwareFile.FileSearchPattern, Path.GetFileName(childrenFile), Directory.Exists(childrenFile), filePath)) .ToList(); })); }
public void FromSoftwareGamePathGetFilesTestsThrowsNotFound() { Assert.Throws <DirectoryNotFoundException>(() => FromSoftwareFileSearch.GetGameFiles(_rootDirectory, "toto", "*.*")); }
public void FromSoftwareGamePathGetSubDirectoriesDoesNotThrowException(string gamePath) { string[] files = FromSoftwareFileSearch.GetSubDirectories(_rootDirectory, gamePath); Assert.IsNotNull(files); Assert.IsTrue(files.Length > 0); }
public void FromSoftwareGamePathGetFilesTestsThrowsUnauthorized(string gamePath) { Assert.Throws <UnauthorizedAccessException>(() => FromSoftwareFileSearch.GetSubDirectories(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), gamePath)); }