예제 #1
0
        public static List <Redistributables> FindRedistributables()
        {
            if (cachedRedistributables != null && !updateRedistributables)
            {
                return(cachedRedistributables);
            }
            var steamPaths    = Steam.SteamPaths();
            var crawlableDirs = steamPaths.Select(Steam.FixPath).Where(Directory.Exists).ToList();
            var gameDirs      =
                crawlableDirs.Select(Directory.GetDirectories).SelectMany(directories => directories).ToList();

            if (Gog.Exisit())
            {
                gameDirs.AddRange(Gog.GetGames());
            }
            if (Origin.Exist())
            {
                gameDirs.AddRange(Origin.GetGames());
            }
            if (Uplay.Exist())
            {
                gameDirs.AddRange(Uplay.GetGames());
            }
            if (Battlenet.Exist())
            {
                gameDirs.AddRange(Battlenet.GetGames());
            }
            if (Desura.Exist())
            {
                gameDirs.AddRange(Desura.GetGames());
            }
            //Probably a better way to detect if some retarded publisher nested their package in a folder, but atm capcom is the only one i've seen do it.
            foreach (
                var nestedGameFolder in
                gameDirs.ToList()
                .Where(gameDir => gameDir.ToLower().Contains("capcom"))
                .Select(gameDir => new DirectoryInfo(gameDir).GetDirectories())
                .SelectMany(nestedGameFolders => nestedGameFolders))
            {
                gameDirs.Add(nestedGameFolder.FullName);
            }

            var redistFiles = new List <string>();

            foreach (var dir in gameDirs)
            {
                redistFiles.AddRange(DetectRedistributablesWalk(dir));
                redistFiles.AddRange(DetectRenPyRedistributables(dir));
            }
            var cleanAbleFiles = redistFiles.Select(file => new Redistributables
            {
                Size = new FileInfo(file).Length,
                Path = file
            }).ToList();

            cachedRedistributables = cleanAbleFiles;
            updateRedistributables = false;
            return(cleanAbleFiles);
        }
예제 #2
0
        private static List <string> GetAddtionalGames()
        {
            var gameDirs = new List <string>();

            if (Gog.Exisit())
            {
                gameDirs.AddRange(Gog.GetGames());
            }
            if (Origin.Exist())
            {
                gameDirs.AddRange(Origin.GetGames());
            }
            if (Uplay.Exist())
            {
                gameDirs.AddRange(Uplay.GetGames());
            }
            if (Battlenet.Exist())
            {
                gameDirs.AddRange(Battlenet.GetGames());
            }
            if (Desura.Exist())
            {
                gameDirs.AddRange(Desura.GetGames());
            }
            if (Custom.Exist())
            {
                gameDirs.AddRange(Custom.GetGames());
            }
            if (Gamestop.Exist())
            {
                gameDirs.AddRange(Gamestop.GetGames());
            }
            if (Nexon.Exist())
            {
                gameDirs.AddRange(Nexon.GetGames());
            }
            return(gameDirs);
        }