/// <summary> /// Creates a new instance of <see cref="SitemapItem"/> /// </summary> /// <param name="url">URL of the page. Optional.</param> /// <param name="lastModified">The date of last modification of the file. Optional.</param> /// <param name="changeFrequency">How frequently the page is likely to change. Optional.</param> /// <param name="priority">The priority of this URL relative to other URLs on your site. Valid values range from 0.0 to 1.0. Optional.</param> /// <exception cref="System.ArgumentNullException">If the <paramref name="url"/> is null or empty.</exception> public SitemapItem(string url, DateTime?lastModified = null, SitemapChangeFrequency?changeFrequency = null, double?priority = null) { Url = url; LastModified = lastModified; ChangeFrequency = changeFrequency; Priority = priority; }
internal SitemapUrl(string loc, DateTimeOffset?lastmod = null, SitemapChangeFrequency?changeFreq = null, double?priority = null) { Loc = loc; Lastmod = lastmod; ChangeFreq = changeFreq; Priority = priority; }
public SitemapItem(string url, DateTime?lastModified = null, SitemapChangeFrequency?changeFrequency = null, double?priority = null) { // Ensure.Argument.NotNullOrEmpty(url, "url"); Url = url; LastModified = lastModified; ChangeFrequency = changeFrequency; Priority = priority; }
//TODO: Image //TODO: Video public SitemapItem(Uri location, DateTime?lastModified = null, SitemapChangeFrequency?changeFrequency = null, double?priority = null) { if (priority.HasValue && ((priority.Value < 0.0) || (priority.Value > 1.0))) { throw new ArgumentOutOfRangeException("priority"); } Location = location; LastModified = lastModified; ChangeFrequency = changeFrequency; Priority = priority; }
/// <summary> /// Creates a new instance of <see cref="SitemapItem"/> /// </summary> /// <param name="url">URL of the page. Optional.</param> /// <param name="lastModified">The date of last modification of the file. Optional.</param> /// <param name="changeFrequency">How frequently the page is likely to change. Optional.</param> /// <param name="priority">The priority of this URL relative to other URLs on your site. Valid values range from 0.0 to 1.0. Optional.</param> /// <exception cref="System.ArgumentNullException">If the <paramref name="url"/> is null or empty.</exception> public SitemapItem(string url, DateTime?lastModified = null, SitemapChangeFrequency?changeFrequency = null, double?priority = null) { if (url == null) { throw new NullReferenceException("GenerateSiteMap"); } Url = url; LastModified = lastModified; ChangeFrequency = changeFrequency; Priority = priority; }
public SitemapItem(string url, DateTime?lastModified = null, SitemapChangeFrequency?changeFrequency = null, double?priority = null) { if (string.IsNullOrWhiteSpace(url)) { throw new ArgumentNullException(nameof(url)); } Url = url; LastModified = lastModified; ChangeFrequency = changeFrequency; Priority = priority; }
/// <summary> /// Creates a new instance of <see cref="SiteMapItem"/> /// </summary> /// <param name="url">URL of the page. Optional.</param> /// <param name="lastModified">The date of last modification of the file. Optional.</param> /// <param name="changeFrequency">How frequently the page is likely to change. Optional.</param> /// <param name="priority">The priority of this URL relative to other URLs on your site. Valid values range from 0.0 to 1.0. Optional.</param> /// <exception cref="System.ArgumentNullException">If the <paramref name="url"/> is null or empty.</exception> public SiteMapItem(string url, DateTime?lastModified = null, SitemapChangeFrequency?changeFrequency = null, double?priority = null) { if (url == null) { throw new ArgumentNullException(nameof(url)); } if (url == string.Empty) { throw new ArgumentException("Argument cannot be empty (url)"); } Url = url; LastModified = lastModified; ChangeFrequency = changeFrequency; Priority = priority; }
public static SitemapItem ParseSitemapItemFields(Uri baseUri, string location, string lastModified = null, string changeFrequency = null, string priority = null) { if (string.IsNullOrEmpty(location)) { return(null); } var parsedLocation = SafeUriParse(baseUri, location); if (parsedLocation == null) { return(null); } var parsedLastModified = SafeDateTimeParse(lastModified); SitemapChangeFrequency?parsedChangeFrequency = null; SitemapChangeFrequency triedChangeFrequency; if (Enum.TryParse(changeFrequency, true, out triedChangeFrequency)) { parsedChangeFrequency = triedChangeFrequency; } double?parsedPriority = null; double triedPriority; if (double.TryParse(priority, out triedPriority)) { triedPriority = Math.Max(0.0, triedPriority); triedPriority = Math.Min(1.0, triedPriority); parsedPriority = triedPriority; } return(new SitemapItem(parsedLocation, parsedLastModified, parsedChangeFrequency, parsedPriority)); }
public static SitemapUrl Create(string loc, DateTimeOffset?lastmod = null, SitemapChangeFrequency?changeFreq = null, double?priority = null) { return(new SitemapUrl(loc, lastmod, changeFreq, priority)); }