/// <summary> /// Checks if the Factorio Steam version is present on the system. /// </summary> /// <returns>Returns true if the Factorio Steam version is present on the system, otherwise false.</returns> public static bool IsPresent() { var steamLibraries = SteamHelper.ListSteamLibraries(false); if ((steamLibraries == null) || (steamLibraries.Count == 0)) { return(false); } foreach (var library in steamLibraries) { var factorioDir = library.EnumerateDirectories("Factorio").FirstOrDefault(); if (factorioDir != null) { if (FactorioFolder.TryLoad(factorioDir, out var folder)) { if (folder.Is64Bit == Environment.Is64BitOperatingSystem) { return(true); } } } } return(false); }
/// <summary> /// Loads all installed versions of Factorio. /// </summary> /// <returns>Returns a list that contains all installed Factorio versions.</returns> public static List <FactorioVersion> LoadInstalledVersions() { var versionList = new List <FactorioVersion>(); DirectoryInfo factorioDirectory = App.Instance.Settings.GetFactorioDirectory(); if (factorioDirectory.Exists) { foreach (var directory in factorioDirectory.EnumerateDirectories()) { if (FactorioFolder.TryLoad(directory, out var folder)) { if (folder.Is64Bit == Environment.Is64BitOperatingSystem) { folder.RenameToUnique(); versionList.Add(new FactorioVersion(folder)); } } } } return(versionList); }