public static void DetectLocations(List <TroveLocation> locations) { try { log.Info("Detecting Trove Locations"); var potentialLocs = new Dictionary <string, string>(); log.Debug("Adding locations from registry"); RegistrySettings.GetTroveLocations(potentialLocs); // Try common program files locations string programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); string programFilesX86 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86); if (!string.IsNullOrEmpty(programFilesX86)) { log.Debug("Adding program files x86 locations"); potentialLocs.AddIfMissing(Path.Combine(programFilesX86, @"Glyph\Games\Trove\Live"), "Trove Live (Glyph)"); potentialLocs.AddIfMissing(Path.Combine(programFilesX86, @"Glyph\Games\Trove\PTS"), "Trove PTS (Glyph)"); potentialLocs.AddIfMissing(Path.Combine(programFilesX86, @"Steam\steamapps\common\Trove\Live"), "Trove Live (Steam)"); potentialLocs.AddIfMissing(Path.Combine(programFilesX86, @"Steam\steamapps\common\Trove\Games\Trove\Live"), "Trove Live (Steam)"); potentialLocs.AddIfMissing(Path.Combine(programFilesX86, @"Steam\steamapps\common\Trove\PTS"), "Trove PTS (Steam)"); potentialLocs.AddIfMissing(Path.Combine(programFilesX86, @"Steam\steamapps\common\Trove\Games\Trove\PTS"), "Trove PTS (Steam)"); } if (!string.IsNullOrEmpty(programFiles) && programFiles != programFilesX86) { log.Debug("Adding program files locations"); potentialLocs.AddIfMissing(Path.Combine(programFiles, @"Glyph\Games\Trove\Live"), "Trove Live (Glyph)"); potentialLocs.AddIfMissing(Path.Combine(programFiles, @"Glyph\Games\Trove\PTS"), "Trove PTS (Glyph)"); potentialLocs.AddIfMissing(Path.Combine(programFiles, @"Steam\steamapps\common\Trove\Live"), "Trove Live (Steam)"); potentialLocs.AddIfMissing(Path.Combine(programFiles, @"Steam\steamapps\common\Trove\Games\Trove\Live"), "Trove Live (Steam)"); potentialLocs.AddIfMissing(Path.Combine(programFiles, @"Steam\steamapps\common\Trove\PTS"), "Trove PTS (Steam)"); potentialLocs.AddIfMissing(Path.Combine(programFiles, @"Steam\steamapps\common\Trove\Games\Trove\PTS"), "Trove PTS (Steam)"); } log.InfoFormat("Searching {0} potential locations", potentialLocs.Count); foreach (var loc in potentialLocs) { if (File.Exists(Path.Combine(loc.Key, TroveExecutableFileName))) { // Add the location if this path does not already exist if (!locations.Any(l => l.LocationPath.ToLower() == loc.Key.ToLower())) { locations.Add(new TroveLocation(loc.Value, loc.Key)); } } } } catch (Exception ex) { log.Warn("Error detecting locations", ex); } }