Exemplo n.º 1
0
 private void AddPaths(ObservableCollection <string> pathsInternal)
 {
     if (Gog.Exisit())
     {
         _pathsInternal.Add("GoG Games Detected");
     }
     if (Origin.Exist())
     {
         _pathsInternal.Add("Origin Games Detected");
     }
     if (Uplay.Exist())
     {
         _pathsInternal.Add("Uplay Games Detected");
     }
     if (Battlenet.Exist())
     {
         _pathsInternal.Add("Battle.net Games Detected");
     }
     if (Desura.Exist())
     {
         _pathsInternal.Add("Desura Games Detected");
     }
     if (Custom.Exist())
     {
         _pathsInternal.Add("Custom Game Paths Detected");
     }
     if (Nexon.Exist())
     {
         _pathsInternal.Add("Nexon Games Detected");
     }
 }
Exemplo n.º 2
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);
        }
        private void RunRefresh()
        {
            //needs to be called to ensure we aren't loading a previously stored object.
            CleanerUtilities.updateRedistributables = true;
            _pathsInternal.Clear();
            var steamPaths = Steam.SteamPaths();

            _pathsInternal.AddRange(steamPaths.Select(steamPath => Steam.FixPath(steamPath)).Where(path => Directory.Exists(path)).ToList());
            if (Gog.Exisit())
            {
                _pathsInternal.Add("GoG Games Detected");
            }
            if (Origin.Exist())
            {
                _pathsInternal.Add("Origin Games Detected");
            }
            if (Uplay.Exist())
            {
                _pathsInternal.Add("Uplay Games Detected");
            }
            if (Battlenet.Exist())
            {
                _pathsInternal.Add("Battle.net Games Detected");
            }
            if (Desura.Exist())
            {
                _pathsInternal.Add("Desura Games Detected");
            }
            _filesInternal.Clear();
            foreach (
                var fileViewModel in
                CleanerUtilities.FindRedistributables()
                .Select(r => new FileViewModel(r.Path, StringUtilities.GetBytesReadable(r.Size))))
            {
                _filesInternal.Add(fileViewModel);
            }

            Statistics = CleanerUtilities.TotalFiles() + " files have been found (" + CleanerUtilities.TotalTakenSpace() +
                         ") ";
        }
Exemplo n.º 4
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);
        }