public static XmlDocument FetchUrls(string title, string authPublicKey, List <string> urls, Dictionary <string, string> parameters) { parameters["login"] = Engine.Instance.Storage.Get("login"); parameters["password"] = Engine.Instance.Storage.Get("password"); parameters["system"] = Platform.Instance.GetSystemCode(); parameters["version"] = Constants.VersionInt.ToString(CultureInfo.InvariantCulture); string firstError = ""; int hostN = 0; foreach (string url in urls) { string host = Utils.HostFromUrl(url); hostN++; if (IpAddress.IsIP(host) == false) { // If locked network are enabled, skip the hostname and try only by IP. // To avoid DNS issue (generally, to avoid losing time). if (Engine.Instance.NetworkLockManager.IsDnsResolutionAvailable(host) == false) { continue; } } try { RouteScope routeScope = new RouteScope(host); XmlDocument xmlDoc = AirExchange.FetchUrl(authPublicKey, url, parameters); routeScope.End(); if (xmlDoc == null) { throw new Exception("No answer."); } if (xmlDoc.DocumentElement.Attributes["error"] != null) { throw new Exception(xmlDoc.DocumentElement.Attributes["error"].Value); } return(xmlDoc); } catch (Exception e) { string info = e.Message; string proxyMode = Engine.Instance.Storage.Get("proxy.mode").ToLowerInvariant(); string proxyAuth = Engine.Instance.Storage.Get("proxy.auth").ToLowerInvariant(); if (proxyMode != "none") { info += " - with '" + proxyMode + "' proxy and '" + proxyAuth + "' auth"; } if (Engine.Instance.Storage.GetBool("advanced.expert")) { Engine.Instance.Logs.Log(LogType.Verbose, MessagesFormatter.Format(Messages.ExchangeTryFailed, title, hostN.ToString(), info)); } if (firstError == "") { firstError = info; } } } throw new Exception(firstError); }