internal void UpdateKnownRTW2VersionsFromMirrors(IList <string> mirrors) { var allKnownVersions = new List <Rtw2Version>(Rtw2Versions); foreach (var mirror in mirrors) { Log.Debug($"Retrieving version information from {mirror} if available"); var mirrorKnownVersions = new List <Rtw2Version>(); var versionsUrl = Path.Combine(mirror, "rtw2_versions.ini"); using (var client = new WebClient()) { try { var response = client.DownloadString(versionsUrl); mirrorKnownVersions.AddRange(ModConfigurationReader.Rtw2VersionsFromString(response)); } catch (Exception e) { Log.Error($"Didn't find a RTW2 version listing at {versionsUrl}", e); } } foreach (var version in mirrorKnownVersions) { if (!allKnownVersions.Any(existing => version.Checksum == existing.Checksum)) { allKnownVersions.Add(version); } } } Rtw2Versions.AddRange(allKnownVersions); UpdateCache(); }
internal void UpdateKnownVersionsFromCache() { Log.Debug($"Loading RTW2 versions from {Path.Combine(Program.Rtw2ExecutableDirectory, "rtw2_versions.ini")}"); try { var rawFileContents = File.ReadAllText(Path.Combine(Program.Rtw2ExecutableDirectory, "rtw2_versions.ini")); Rtw2Versions.AddRange(ModConfigurationReader.Rtw2VersionsFromString(rawFileContents).ToList()); } catch (Exception e) { Log.Error($"Failed to parse version data", e); } }