예제 #1
0
        public string GetGrimLocation()
        {
            if (_settingsService.GetLocal().GrimDawnLocation != null)
            {
                foreach (var loc in _settingsService.GetLocal().GrimDawnLocation)
                {
                    if (!string.IsNullOrEmpty(loc) && Directory.Exists(loc) && !loc.Contains(".arz"))
                    {
                        return(loc);
                    }
                }
            }

            string location = string.Empty;

            try {
                try {
                    // Horrible copy from pluralized version.
                    var steamPath         = SteamDetection.GetSteamDirectory();
                    var steamInstallPaths = SteamDetection.ExtractSteamLibraryPaths(Path.Combine(steamPath, "config", "config.vdf"));
                    steamInstallPaths.Add(steamPath); // May not be included in the VDF
                    var locations = new List <string>();
                    SteamDetection.GetGrimFolderFromSteamLibrary(steamInstallPaths).ForEach(loc => locations.Add(CleanInvertedSlashes(loc)));
                    if (locations.Count > 0)
                    {
                        location = locations[0];
                    }
                }
                catch (Exception ex) {
                    Logger.Warn(ex.Message);
                    Logger.Warn(ex.StackTrace);
                }

                location = FindGogByRegistry();
                if (!string.IsNullOrEmpty(location))
                {
                    return(location);
                }

                location = FindByWindow();
                if (!string.IsNullOrEmpty(location))
                {
                    return(location);
                }
            }

            // Cache the location
            finally {
                _settingsService.GetLocal().AddGrimDawnLocation(location);
            }

            return(string.Empty);
        }
예제 #2
0
 public static void AppendSteamPaths(ICollection <string> locations)
 {
     try {
         var steamPath         = SteamDetection.GetSteamDirectory();
         var steamInstallPaths = SteamDetection.ExtractSteamLibraryPaths(Path.Combine(steamPath, "config", "config.vdf"));
         steamInstallPaths.Add(steamPath); // May not be included in the VDF
         SteamDetection.GetGrimFolderFromSteamLibrary(steamInstallPaths).ForEach(loc => locations.Add(CleanInvertedSlashes(loc)));
     }
     catch (Exception ex) {
         Logger.Warn(ex.Message);
         Logger.Warn(ex.StackTrace);
     }
 }