Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / NetFx35 / System.ServiceModel.Web / System / ServiceModel / Syndication / SyndicationFeed.cs / 1 / SyndicationFeed.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
namespace System.ServiceModel.Syndication
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Xml;
using System.Runtime.Serialization;
using System.Globalization;
using System.Xml.Serialization;
using System.Diagnostics.CodeAnalysis;
// NOTE: This class implements Clone so if you add any members, please update the copy ctor
public class SyndicationFeed : IExtensibleSyndicationObject
{
Collection authors;
Uri baseUri;
Collection categories;
Collection contributors;
TextSyndicationContent copyright;
TextSyndicationContent description;
ExtensibleSyndicationObject extensions = new ExtensibleSyndicationObject();
string generator;
string id;
Uri imageUrl;
IEnumerable items;
string language;
DateTimeOffset lastUpdatedTime;
Collection links;
TextSyndicationContent title;
public SyndicationFeed()
: this((IEnumerable) null)
{
}
public SyndicationFeed(IEnumerable items)
: this(null, null, null, items)
{
}
public SyndicationFeed(string title, string description, Uri feedAlternateLink)
: this(title, description, feedAlternateLink, null)
{
}
public SyndicationFeed(string title, string description, Uri feedAlternateLink, IEnumerable items)
: this(title, description, feedAlternateLink, null, DateTimeOffset.MinValue, items)
{
}
public SyndicationFeed(string title, string description, Uri feedAlternateLink, string id, DateTimeOffset lastUpdatedTime)
: this(title, description, feedAlternateLink, id, lastUpdatedTime, null)
{
}
public SyndicationFeed(string title, string description, Uri feedAlternateLink, string id, DateTimeOffset lastUpdatedTime, IEnumerable items)
{
if (title != null)
{
this.title = new TextSyndicationContent(title);
}
if (description != null)
{
this.description = new TextSyndicationContent(description);
}
if (feedAlternateLink != null)
{
this.Links.Add(SyndicationLink.CreateAlternateLink(feedAlternateLink));
}
this.id = id;
this.lastUpdatedTime = lastUpdatedTime;
this.items = items;
}
protected SyndicationFeed(SyndicationFeed source, bool cloneItems)
{
if (source == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
}
this.authors = FeedUtils.ClonePersons(source.authors);
this.categories = FeedUtils.CloneCategories(source.categories);
this.contributors = FeedUtils.ClonePersons(source.contributors);
this.copyright = FeedUtils.CloneTextContent(source.copyright);
this.description = FeedUtils.CloneTextContent(source.description);
this.extensions = source.extensions.Clone();
this.generator = source.generator;
this.id = source.id;
this.imageUrl = source.imageUrl;
this.language = source.language;
this.lastUpdatedTime = source.lastUpdatedTime;
this.links = FeedUtils.CloneLinks(source.links);
this.title = FeedUtils.CloneTextContent(source.title);
this.baseUri = source.baseUri;
IList srcList = source.items as IList;
if (srcList != null)
{
Collection tmp = new NullNotAllowedCollection();
for (int i = 0; i < srcList.Count; ++i)
{
tmp.Add((cloneItems) ? srcList[i].Clone() : srcList[i]);
}
this.items = tmp;
}
else
{
if (cloneItems)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.UnbufferedItemsCannotBeCloned)));
}
this.items = source.items;
}
}
public Dictionary AttributeExtensions
{
get { return this.extensions.AttributeExtensions; }
}
public Collection Authors
{
get
{
if (this.authors == null)
{
this.authors = new NullNotAllowedCollection();
}
return authors;
}
}
public Uri BaseUri
{
get { return this.baseUri; }
set { this.baseUri = value; }
}
public Collection Categories
{
get
{
if (this.categories == null)
{
this.categories = new NullNotAllowedCollection();
}
return categories;
}
}
public Collection Contributors
{
get
{
if (this.contributors == null)
{
this.contributors = new NullNotAllowedCollection();
}
return contributors;
}
}
public TextSyndicationContent Copyright
{
get { return this.copyright; }
set { this.copyright = value; }
}
public TextSyndicationContent Description
{
get { return this.description; }
set { this.description = value; }
}
public SyndicationElementExtensionCollection ElementExtensions
{
get { return this.extensions.ElementExtensions; }
}
public string Generator
{
get { return generator; }
set { generator = value; }
}
public string Id
{
get { return id; }
set { id = value; }
}
public Uri ImageUrl
{
get { return imageUrl; }
set { imageUrl = value; }
}
public IEnumerable Items
{
get
{
if (this.items == null)
{
this.items = new NullNotAllowedCollection();
}
return this.items;
}
set
{
if (value == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");
}
this.items = value;
}
}
public string Language
{
get { return language; }
set { language = value; }
}
public DateTimeOffset LastUpdatedTime
{
get { return lastUpdatedTime; }
set { lastUpdatedTime = value; }
}
public Collection Links
{
get
{
if (this.links == null)
{
this.links = new NullNotAllowedCollection();
}
return this.links;
}
}
public TextSyndicationContent Title
{
get { return this.title; }
set { this.title = value; }
}
public static SyndicationFeed Load(XmlReader reader)
{
return Load(reader);
}
public static TSyndicationFeed Load(XmlReader reader)
where TSyndicationFeed : SyndicationFeed, new ()
{
if (reader == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader");
}
Atom10FeedFormatter atomSerializer = new Atom10FeedFormatter();
if (atomSerializer.CanRead(reader))
{
atomSerializer.ReadFrom(reader);
return atomSerializer.Feed as TSyndicationFeed;
}
Rss20FeedFormatter rssSerializer = new Rss20FeedFormatter();
if (rssSerializer.CanRead(reader))
{
rssSerializer.ReadFrom(reader);
return rssSerializer.Feed as TSyndicationFeed;
}
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR2.GetString(SR2.UnknownFeedXml, reader.LocalName, reader.NamespaceURI)));
}
public virtual SyndicationFeed Clone(bool cloneItems)
{
return new SyndicationFeed(this, cloneItems);
}
public Atom10FeedFormatter GetAtom10Formatter()
{
return new Atom10FeedFormatter(this);
}
public Rss20FeedFormatter GetRss20Formatter()
{
return GetRss20Formatter(true);
}
public Rss20FeedFormatter GetRss20Formatter(bool serializeExtensionsAsAtom)
{
return new Rss20FeedFormatter(this, serializeExtensionsAsAtom);
}
public void SaveAsAtom10(XmlWriter writer)
{
this.GetAtom10Formatter().WriteTo(writer);
}
public void SaveAsRss20(XmlWriter writer)
{
this.GetRss20Formatter().WriteTo(writer);
}
protected internal virtual SyndicationCategory CreateCategory()
{
return new SyndicationCategory();
}
protected internal virtual SyndicationItem CreateItem()
{
return new SyndicationItem();
}
protected internal virtual SyndicationLink CreateLink()
{
return new SyndicationLink();
}
protected internal virtual SyndicationPerson CreatePerson()
{
return new SyndicationPerson();
}
protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version)
{
return false;
}
protected internal virtual bool TryParseElement(XmlReader reader, string version)
{
return false;
}
protected internal virtual void WriteAttributeExtensions(XmlWriter writer, string version)
{
this.extensions.WriteAttributeExtensions(writer);
}
protected internal virtual void WriteElementExtensions(XmlWriter writer, string version)
{
this.extensions.WriteElementExtensions(writer);
}
internal void LoadElementExtensions(XmlReader readerOverUnparsedExtensions, int maxExtensionSize)
{
this.extensions.LoadElementExtensions(readerOverUnparsedExtensions, maxExtensionSize);
}
internal void LoadElementExtensions(XmlBuffer buffer)
{
this.extensions.LoadElementExtensions(buffer);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StringInfo.cs
- WebPartEditVerb.cs
- SynchronizingStream.cs
- RegexRunner.cs
- CustomCredentialPolicy.cs
- DbReferenceCollection.cs
- DataDesignUtil.cs
- XPathDocument.cs
- TextSerializer.cs
- OleDbCommand.cs
- BuildProvidersCompiler.cs
- ConnectionStringsExpressionBuilder.cs
- TranslateTransform3D.cs
- FullTextBreakpoint.cs
- SerializationInfoEnumerator.cs
- AutomationPropertyInfo.cs
- XPathDocumentIterator.cs
- DatasetMethodGenerator.cs
- SmtpMail.cs
- FactoryRecord.cs
- ToolStripDropDownClosedEventArgs.cs
- RoutedCommand.cs
- PeerName.cs
- ExtensionSurface.cs
- CharStorage.cs
- XDeferredAxisSource.cs
- Atom10FormatterFactory.cs
- RoleManagerEventArgs.cs
- PartDesigner.cs
- CanExecuteRoutedEventArgs.cs
- TouchPoint.cs
- odbcmetadatafactory.cs
- WindowsGraphics.cs
- Error.cs
- Model3D.cs
- ObjectDataProvider.cs
- BrowserInteropHelper.cs
- Rect3DValueSerializer.cs
- ReleaseInstanceMode.cs
- Dump.cs
- ScriptControl.cs
- MeasurementDCInfo.cs
- RenderTargetBitmap.cs
- XmlImplementation.cs
- RefType.cs
- CharConverter.cs
- TraceHwndHost.cs
- ColumnTypeConverter.cs
- XmlSchemaExporter.cs
- PointLightBase.cs
- PathTooLongException.cs
- DrawingContext.cs
- ScriptingRoleServiceSection.cs
- AdornerHitTestResult.cs
- BulletChrome.cs
- DBSqlParserTable.cs
- BindingValueChangedEventArgs.cs
- TemplatePagerField.cs
- OdbcConnectionString.cs
- WindowsSolidBrush.cs
- UpdatePanel.cs
- SettingsSection.cs
- CommandDevice.cs
- ExpressionBuilderCollection.cs
- ProviderManager.cs
- RowParagraph.cs
- GlyphShapingProperties.cs
- ProgressPage.cs
- TextEncodedRawTextWriter.cs
- Label.cs
- TypeBuilderInstantiation.cs
- SmiEventSink_Default.cs
- SynthesizerStateChangedEventArgs.cs
- AuthStoreRoleProvider.cs
- FolderBrowserDialog.cs
- Polygon.cs
- CompatibleComparer.cs
- DbConnectionClosed.cs
- Parameter.cs
- UrlMappingsSection.cs
- BehaviorEditorPart.cs
- DataGridViewColumnEventArgs.cs
- PositiveTimeSpanValidatorAttribute.cs
- ExpressionReplacer.cs
- PersonalizationStateInfo.cs
- ObjectDataProvider.cs
- SharedPersonalizationStateInfo.cs
- ActiveDesignSurfaceEvent.cs
- XmlSchemaAnnotation.cs
- PagePropertiesChangingEventArgs.cs
- WebServiceTypeData.cs
- WebPartZoneBaseDesigner.cs
- DataColumnMappingCollection.cs
- DocumentXmlWriter.cs
- PersistenceTypeAttribute.cs
- SamlEvidence.cs
- KeyNotFoundException.cs
- FixedTextPointer.cs
- TerminatorSinks.cs
- GridViewSelectEventArgs.cs