UrlElement.cs :  » Bloggers » SubText » Subtext » Web » SiteMap » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Bloggers » SubText 
SubText » Subtext » Web » SiteMap » UrlElement.cs
#region Disclaimer/Info

///////////////////////////////////////////////////////////////////////////////////////////////////
// Subtext WebLog
// 
// Subtext is an open source weblog system that is a fork of the .TEXT
// weblog system.
//
// For updated news and information please visit http://subtextproject.com/
// Subtext is hosted at Google Code at http://code.google.com/p/subtext/
// The development mailing list is at subtext@googlegroups.com 
//
// This project is licensed under the BSD license.  See the License.txt file for more information.
///////////////////////////////////////////////////////////////////////////////////////////////////

#endregion

using System;
using System.Xml.Serialization;
using Subtext.Web.Properties;

namespace Subtext.Web.SiteMap{
    [XmlType(TypeName = "url")]
    public class UrlElement
    {
        private Uri _pageUrl;
        private decimal _priority;

        /// <summary>
        /// We need this contructor if we want to serialize the class.
        /// </summary>
        public UrlElement()
        {
        }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="pageUrl">URL of the page. This URL must begin with the protocol (such as http) and end with a trailing slash, if your web server requires it. This value must be less than 2048 characters.</param>
        /// <param name="lastModified">he date of last modification of the file. This date should be in W3C Datetime format. This format allows you to omit the time portion, if desired, and use YYYY-MM-DD.</param>
        /// <param name="changeFrequency">How frequently the page is likely to change. This value provides general information to search engines and may not correlate exactly to how often they crawl the page. Valid values are:
        /// * always
        /// * hourly
        /// * daily
        /// * monthly
        /// * yearly
        /// * never
        /// The value "always" should be used to describe documents that change each time they are accessed. The value "never" should be used to describe archived URLs.
        /// Please note that the value of this tag is considered a hint and not a command. Even though search engine crawlers consider this information when making decisions, they may crawl pages marked "hourly" less frequently than that, and they may crawl pages marked "yearly" more frequently than that. It is also likely that crawlers will periodically crawl pages marked "never" so that they can handle unexpected changes to those pages.</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. This value has no effect on your pages compared to pages on other sites, and only lets the search engines know which of your pages you deem most important so they can order the crawl of your pages in the way you would most like.
        /// The default priority of a page is 0.5.
        /// Please note that the priority you assign to a page has no influence on the position of your URLs in a search engine's result pages. Search engines use this information when selecting between URLs on the same site, so you can use this tag to increase the likelihood that your more important pages are present in a search index.
        /// Also, please note that assigning a high priority to all of the URLs on your site will not help you. Since the priority is relative, it is only used to select between URLs on your site; the priority of your pages will not be compared to the priority of pages on other sites.</param>
        public UrlElement(Uri pageUrl, DateTime lastModified, ChangeFrequency changeFrequency, decimal priority)
        {
            _pageUrl = pageUrl;
            LastModified = lastModified;
            ChangeFrequency = changeFrequency;
            Priority = priority;
        }

        [XmlElement(DataType = "anyURI", ElementName = "loc")]
        public string Location
        {
            get
            {
                string encodedString = _pageUrl.ToString();
                return encodedString;
            }
            set { _pageUrl = new Uri(value); }
        }

        [XmlElement(ElementName = "lastmod", DataType = "date")]
        public DateTime LastModified { get; set; }

        [XmlElement(ElementName = "changefreq")]
        public ChangeFrequency ChangeFrequency { get; set; }

        [XmlElement(ElementName = "priority")]
        public decimal Priority
        {
            get { return _priority; }
            set
            {
                if(value < 0.0M || value > 1.0M)
                {
                    throw new ArgumentOutOfRangeException(Resources.ArgumentOutOfRange_Priority);
                }
                _priority = value;
            }
        }
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.