Beispiel #1
0
 private FilePath?FindEntriesPath(FilePath jamDirectoryPath)
 {
     return(FilesystemSearch.ForDirectoriesIn(jamDirectoryPath)
            .FindMatches("Entries")
            .ElseFindMatches("*Entries*")
            .FirstOrDefault());
 }
Beispiel #2
0
 private FilePath?FindGamePath(FilePath entryDirectoryPath)
 {
     return(FilesystemSearch.ForFilesIn(entryDirectoryPath)
            .WithExtensions(".exe")
            .FindAll()
            .FirstOrDefault());
 }
Beispiel #3
0
 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());
 }
Beispiel #5
0
 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());
 }
Beispiel #6
0
 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());
 }
Beispiel #7
0
        // ------------------
        // 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));
        }
Beispiel #8
0
        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,
                });
            }
        }
Beispiel #9
0
        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);
        }
Beispiel #10
0
        // -----------------
        // 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));
        }