BaseSyndicationWriter.cs :  » Bloggers » SubText » Subtext » Framework » Syndication » 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 » Framework » Syndication » BaseSyndicationWriter.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.IO;
using System.Xml;
using Subtext.Framework.Routing;

namespace Subtext.Framework.Syndication{
    /// <summary>
    /// Base class for writing RSS and ATOM feeds.
    /// </summary>
    public abstract class BaseSyndicationWriter : XmlTextWriter
    {
        private readonly TextWriter _writer;

        /// <summary>
        /// Creates a new <see cref="BaseSyndicationWriter"/> instance.
        /// </summary>
        protected BaseSyndicationWriter(TextWriter writer, DateTime dateLastViewedFeedItemPublished,
                                        bool useDeltaEncoding, ISubtextContext context) : base(writer)
        {
            LatestPublishDate = NullValue.NullDateTime;

            DateLastViewedFeedItemPublished = dateLastViewedFeedItemPublished;
            _writer = writer;
            SubtextContext = context;
            Blog = context.Blog;
            UrlHelper = context.UrlHelper;
            UseDeltaEncoding = useDeltaEncoding;
            Formatting = Formatting.Indented;
            Indentation = 4;
        }

        public ISubtextContext SubtextContext { get; private set; }

        public UrlHelper UrlHelper { get; private set; }

        public Blog Blog { get; private set; }

        public bool UseDeltaEncoding { get; protected set; }

        /// <summary>
        /// Gets the underlying text writer.
        /// </summary>
        /// <value></value>
        public TextWriter TextWriter
        {
            get
            {
                Build();
                return _writer;
            }
        }

        /// <summary>
        /// Gets the XML.
        /// </summary>
        /// <value></value>
        public string Xml
        {
            get
            {
                var xml = TextWriter.ToString();
                return xml;
            }
        }

        /// <summary>
        /// Gets a value indicating whether the feed client has all the feed items.
        /// </summary>
        /// <value>
        ///   <c>true</c> if the client has all feed items; otherwise, <c>false</c>.
        /// </value>
        public bool ClientHasAllFeedItems { get; protected set; }

        /// <summary>
        /// Gets the publish date of the latest syndicated item.
        /// </summary>
        /// <value></value>
        public DateTime LatestPublishDate { get; protected set; }

        /// <summary>
        /// Gets the publish date of the last syndicated feed item 
        /// that the client aggregator viewed.  This is sent as 
        /// the ETag.
        /// </summary>
        /// <value></value>
        public DateTime DateLastViewedFeedItemPublished { get; private set; }

        public bool UseAggBugs { get; set; }

        public bool AllowComments { get; set; }

        /// <summary>
        /// Returns the XML
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return Xml;
        }

        /// <summary>
        /// Builds the feed.
        /// </summary>
        protected abstract void Build();

        /// <summary>
        /// Builds the feed with delta-encoding possible.
        /// </summary>
        /// <param name="dateLastViewedFeedItemPublished">The date last viewed feed item published.</param>
        protected abstract void Build(DateTime dateLastViewedFeedItemPublished);
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.