public List <Server> GetAllSync() { string list = ""; if (!GameUpdater.HttpGet(serverlistUrl, out list)) { if (!GameUpdater.HttpGet(serverlistBackupUrl, out list)) { return(new List <Server>()); // Empty list.. Too bad. } } var fullList = list .Split('\n') .Select(line => { var serverInfo = line.Split(';'); Server server = server = new Server("", 0, "", ""); if (serverInfo.Count() > 4) { server = new Server(serverInfo[1], serverInfo[2].TryInt(), serverInfo[3], serverInfo[4]); } server.Settings = new SortedDictionary <string, string> { { "hostname", serverInfo[0] } }; return(server); } ) .ToList(); return(fullList); }
private void GetDayZFiles() { var files = new List <string>(); string responseBody; if (!GameUpdater.HttpGet(_latestDownloadUrl, out responseBody)) { Status = "Error getting files"; return; } var fileMatches = Regex.Matches(responseBody, @"<a\s+href\s*=\s*(?:'|"")([^'""]+\.[^'""]{3})(?:'|"")", RegexOptions.IgnoreCase); foreach (Match match in fileMatches) { if (!match.Success) { continue; } var file = match.Groups[1].Value; if (string.IsNullOrEmpty(file)) { continue; } files.Add(file); } _dayZFiles = files; ProcessNext(); }
public void CheckForUpdates() { if (_isChecking) { return; } _isChecking = true; Status = DayZeroLauncherUpdater.STATUS_CHECKINGFORUPDATES; string responseBody; Version latestVersion = null; new Thread(() => { try { Thread.Sleep(750); //In case this happens so fast the UI looks like it didn't work if (!GameUpdater.HttpGet(dayZeroVersionUrl, out responseBody)) { Status = "Zombies.nu not responding"; return; } Version version; if (Version.TryParse(responseBody, out version)) { latestVersion = version; if (!latestVersion.Equals(CalculatedGameSettings.Current.DayZVersion)) { Status = DayZeroLauncherUpdater.STATUS_OUTOFDATE; } else { Status = DayZeroLauncherUpdater.STATUS_UPTODATE; } } else { Status = "Could not determine version from filenames"; } } catch (Exception) { Status = "Error getting version"; } finally { _isChecking = false; LatestVersion = latestVersion; } }).Start(); }
public void InstallLatestVersion() { string responseBody; if (!GameUpdater.HttpGet(dayZeroTorrentFileUrl, out responseBody)) { Status = "Zombies.nu not responding"; return; } Installer.DownloadAndInstall(responseBody, deletedFilesUrl, this); }
public void CheckForUpdates() { if (_isChecking) { return; } _isChecking = true; Status = DayZeroLauncherUpdater.STATUS_CHECKINGFORUPDATES; string responseBody; int latestRevision = 0; new Thread(() => { try { Thread.Sleep(750); //In case this happens so fast the UI looks like it didn't work if (!GameUpdater.HttpGet(ArmaBetaListingUrl, out responseBody)) { Status = "Zombies.nu not responding"; return; } _latestDownloadUrl = String.Format("http://www.arma2.com/downloads/update/beta/ARMA2_OA_Build_{0}.zip", responseBody); Int32.TryParse(responseBody, out latestRevision); if (latestRevision != 0) { if (LocalMachineInfo.Current.Arma2OABetaVersion == null || LocalMachineInfo.Current.Arma2OABetaVersion.Revision != latestRevision) { Status = DayZeroLauncherUpdater.STATUS_OUTOFDATE; } else { Status = DayZeroLauncherUpdater.STATUS_UPTODATE; } } else { Status = "Coult not determine revision"; } } catch (Exception) { Status = "Error getting version"; } finally { _isChecking = false; LatestVersion = (int?)latestRevision; } }).Start(); }
public DayZUpdater() { Installer = new DayZInstaller(); Installer.PropertyChanged += (sender, args) => { if (args.PropertyName == "IsRunning") { PropertyHasChanged("InstallButtonVisible"); } else if (args.PropertyName == "Status") { if (Installer.Status == "Install complete") { CheckForUpdates(); } } }; string responseBody; if (!GameUpdater.HttpGet(dayZeroVersionUrl, out responseBody)) { Status = "Zombies.nu not responding"; return; } Version version; if (Version.TryParse(responseBody, out version)) { if (version.Equals(CalculatedGameSettings.Current.DayZVersion)) // If version is up to date. Seed. { string torrentUrl; if (!GameUpdater.HttpGet(dayZeroTorrentFileUrl, out torrentUrl)) { Status = "Zombies.nu not responding"; return; } TorrentUpdater seeder = new TorrentUpdater(torrentUrl); // Sets up launcher to start seeding current build. seeder.StartTorrents(1); } } }
public void CheckForUpdates() { if (_isChecking) { return; } _isChecking = true; Status = DayZCommanderUpdater.STATUS_CHECKINGFORUPDATES; string responseBody; Version latestVersion = null; new Thread(() => { try { Thread.Sleep(750); //In case this happens so fast the UI looks like it didn't work if (!GameUpdater.HttpGet(DayZListingUrl, out responseBody)) { Status = "cdn.armafiles.com not responding"; return; } var latestCodeFileMatch = Regex.Match(responseBody, @"<a\s+href\s*=\s*(?:'|"")(dayz_code_[^'""]+)(?:'|"")", RegexOptions.IgnoreCase); if (!latestCodeFileMatch.Success) { Status = "Filenames don't match expected pattern"; return; } var latestCodeFile = latestCodeFileMatch.Groups[1].Value; var latestCodeVersionMatch = Regex.Match(latestCodeFile, @"\d(?:\.\d){1,3}"); if (!latestCodeVersionMatch.Success) { Status = "Could not determine version from filenames"; return; } Version version; if (Version.TryParse(latestCodeVersionMatch.Value, out version)) { latestVersion = version; if (!latestVersion.Equals(CalculatedGameSettings.Current.DayZVersion)) { Status = DayZCommanderUpdater.STATUS_OUTOFDATE; } else { Status = DayZCommanderUpdater.STATUS_UPTODATE; } } else { Status = "Could not determine version from filenames"; } } catch (Exception ex) { Status = "Error getting version"; } finally { _isChecking = false; LatestVersion = latestVersion; } }).Start(); }
public void CheckForUpdates() { if (_isChecking) { return; } _isChecking = true; Status = DayZCommanderUpdater.STATUS_CHECKINGFORUPDATES; string responseBody; int? latestRevision = null; new Thread(() => { try { Thread.Sleep(750); //In case this happens so fast the UI looks like it didn't work if (!GameUpdater.HttpGet(ArmaBetaListingUrl, out responseBody)) { Status = "Arma2.com not responding"; return; } var latestBetaUrlMatch = Regex.Match(responseBody, @"Latest\s+beta\s+patch:\s*<a\s+href\s*=\s*(?:'|"")([^'""]+)(?:'|"")", RegexOptions.IgnoreCase); if (!latestBetaUrlMatch.Success) { Status = "Latest patch url doesn't match pattern"; return; } _latestDownloadUrl = latestBetaUrlMatch.Groups[1].Value; var latestBetaRevisionMatch = Regex.Match(_latestDownloadUrl, @"(\d+)\.(?:zip|rar)", RegexOptions.IgnoreCase); if (!latestBetaRevisionMatch.Success) { Status = "Latest patch doesn't match pattern"; return; } latestRevision = latestBetaRevisionMatch.Groups[1].Value.TryIntNullable(); if (latestRevision != null) { if (LocalMachineInfo.Current.Arma2OABetaVersion == null || LocalMachineInfo.Current.Arma2OABetaVersion.Revision != latestRevision) { Status = DayZCommanderUpdater.STATUS_OUTOFDATE; } else { Status = DayZCommanderUpdater.STATUS_UPTODATE; } } else { Status = "Coult not determine revision"; } } catch (Exception ex) { Status = "Error getting version"; } finally { _isChecking = false; LatestVersion = latestRevision; } }).Start(); }