private FilePath?FindEntriesPath(FilePath jamDirectoryPath) { return(FilesystemSearch.ForDirectoriesIn(jamDirectoryPath) .FindMatches("Entries") .ElseFindMatches("*Entries*") .FirstOrDefault()); }
private FilePath?FindGamePath(FilePath entryDirectoryPath) { return(FilesystemSearch.ForFilesIn(entryDirectoryPath) .WithExtensions(".exe") .FindAll() .FirstOrDefault()); }
private FilePath?FindAfterwordPath(FilePath entryDirectoryPath) { return(FilesystemSearch.ForFilesIn(entryDirectoryPath) .IncludingTopDirectoryOnly() .FindMatches("*afterword*") .FirstOrDefault()); }
private FilePath?FindLogoPath(FilePath jamDirectoryPath) { return(FilesystemSearch.ForFilesIn(jamDirectoryPath) .IncludingTopDirectoryOnly() .WithExtensions(".png", ".jpg", ".jpeg") .FindMatches("logo") .ElseFindMatches("logo*") .ElseFindMatches("*logo*") .FirstOrDefault()); }
private FilePath?FindSmallThumbnailPath(FilePath entryDirectoryPath) { return(FilesystemSearch.ForFilesIn(entryDirectoryPath) .WithExtensions(".png", ".jpg", ".jpeg") .RequiringPatterns("*small*", "*little*", "*tiny*") .FindMatches("thumbnail*") .ElseFindMatches("thumb*") .ElseFindMatches("*thumbnail*") .ElseFindMatches("*thumb*") .FirstOrDefault()); }
private FilePath?FindReadmePath(FilePath entryDirectoryPath) { return(FilesystemSearch.ForFilesIn(entryDirectoryPath) .IncludingTopDirectoryOnly() .FindMatches("*readme*please*") .ElseFindMatches("*readme*important*") .ElseFindMatches("*readme*") .ElseFindMatches("*read*please*") .ElseFindMatches("*read*important*") .ElseFindMatches("*read*") .ElseFindMatches("*credits*") .FirstOrDefault()); }
// ------------------ // Stubbing from file // ------------------ private JamInfo?StubJamInfoFromFile(FilePath jamDirectoryPath) { var jamInfoPath = FilesystemSearch.ForFilesIn(jamDirectoryPath) .WithExtensions(".jaminfo") .FindAll() .FirstOrDefault(); if (jamInfoPath == null) { return(null); } return(JamFilesReader.TryLoadJamInfo(jamInfoPath.Value)); }
private IEnumerable <JamEntryStub> FindEntriesStubs(FilePath entriesPath) { var jamEntries = FilesystemSearch.ForDirectoriesIn(entriesPath) .FindAll() .FoundPaths; foreach (var jamEntryPath in jamEntries) { var subpath = jamEntryPath.AsRelativeTo(entriesPath); yield return(new JamEntryStub { Id = subpath.Value, EntrySubpath = subpath.Value, }); } }
private FilePath?GetJamInfoPathInAppDirectory() { var executableFileName = Process.GetCurrentProcess().MainModule !.FileName !; var jamPlayerPath = FilePath.From(executableFileName); var jamPlayerDirectory = jamPlayerPath.GetParentDirectoryPath() !.Value; var jamInfoPaths = FilesystemSearch.ForFilesIn(jamPlayerDirectory) .IncludingTopDirectoryOnly() .WithExtensions(".jaminfo") .FindAll() .FoundPaths; // not using FirstOrDefault() // because jamInfoPaths is a collection of non-nullable FilePaths return(jamInfoPaths.Any() ? jamInfoPaths.First() : null); }
// ----------------- // Loading from file // ----------------- private JamEntryInfo?GetEntryInfoFromFile(string id, FilePath entryDirectoryPath) { var jamEntryPaths = FilesystemSearch.ForFilesIn(entryDirectoryPath) .IncludingTopDirectoryOnly() .WithExtensions(".jamentry") .FindAll() .FoundPaths; if (!jamEntryPaths.Any()) { return(null); } var entryInfoPath = jamEntryPaths.First(); return(EntryFilesReader.TryLoadJamEntryInfo(id, entryInfoPath)); }