private void HandleNewUrl(string url) { KnownGlobalLinks.Add(url); IsDataChanged = true; if (url.Length == 0 || url.StartsWith("#")) { return; } var r = new Regex(@"^(?:(?<protocol>[a-zA-Z0-9]+)\:)?(?:\/\/)?(?<host>[^\/]+)?(?:\:(?<port>[0-9]+))?(?<subpath>.*)$"); var match = r.Match(url); if (!match.Success) { throw new NotImplementedException($"Unexpected url format could not be understood: {url}"); } var host = match.Groups["host"].Value; // A link without a host is a relative link. As we only visit content from our host under test the relative links are always links to the host under test. var isLocal = host.Length == 0 || HostNames.Contains(host); if (!isLocal) { return; } KnownLocalSubpaths.Add(match.Groups["subpath"].Value); IsDataChanged = true; }
private void UpdateHostNames() { if (HostNames != null) { string hostname = WebsitesClient.GetHostName(Name, Slot); List <string> newHostNames = new List <string>(); if (!HostNames.Contains(hostname)) { newHostNames.Add(hostname); newHostNames.AddRange(HostNames); } if (newHostNames.Count > 0) { WebsitesClient.UpdateWebsiteHostNames(website, newHostNames, Slot); } } }
public void DisplayHosts(List <string> hostNames) { if (hostNames == null || hostNames.Equals(HostNames)) { return; } HostNames.Clear(); foreach (string hostname in hostNames) { HostNames.Add(hostname.Split(':').Last()); } if (!HostNames.Contains(SelectedHost)) { SelectedHost = string.Empty; joinButton.interactable = false; } Rebuild(HostNames, SelectHost, SelectedHost); }