/// <summary> /// Set the source, status and depth for the specified URL. /// </summary> /// <param name="url">The URL to set.</param> /// <param name="source">The source of this URL.</param> /// <param name="status"> The status of this URL.</param> /// <param name="depth">The depth of this URL.</param> private void SetStatus(Uri url, Uri source, URLStatus.Status status, int depth) { URLStatus s; if (!this.workload.ContainsKey(url)) { s = new URLStatus(); this.workload.Add(url, s); } else { s = this.workload[url]; } s.CurrentStatus = status; if (source != null) { s.Source = source; } if (depth != -1) { s.Depth = depth; } workloadEvent.Set(); }
/// <summary> /// Get the depth of the specified URL. /// </summary> /// <param name="url">The URL to get the depth of.</param> /// <returns>The depth of the specified URL.</returns> public int GetDepth(Uri url) { URLStatus s = this.workload[url]; if (s != null) { return(s.Depth); } else { return(1); } }
/// <summary> /// Get the source page that contains the specified URL. /// </summary> /// <param name="url">The URL to seek the source for.</param> /// <returns>The source of the specified URL.</returns> public Uri GetSource(Uri url) { URLStatus s = this.workload[url]; if (s == null) { return(null); } else { return(s.Source); } }
/// <summary> /// Set the source, status and depth for the specified URL. /// </summary> /// <param name="url">The URL to set.</param> /// <param name="source">The source of this URL.</param> /// <param name="status"> The status of this URL.</param> /// <param name="depth">The depth of this URL.</param> private void SetStatus(Uri url, Uri source, URLStatus.Status status, int depth) { URLStatus s; if (!this.workload.ContainsKey(url)) { s = new URLStatus(); this.workload.Add(url, s); } else s = this.workload[url]; s.CurrentStatus = status; if (source != null) { s.Source = source; } if (depth != -1) { s.Depth = depth; } workloadEvent.Set(); }