Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit a08ab45

Browse files
shmaomconnew
authored andcommitted
Added support for more optional elements.
1 parent 37f7461 commit a08ab45

File tree

6 files changed

+434
-21
lines changed

6 files changed

+434
-21
lines changed

src/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.netcoreapp.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ public partial struct XmlUriData
2323
public partial class SyndicationFeed
2424
{
2525
public SyndicationLink Documentation { get{ throw null; } set{ } }
26+
public System.Collections.Generic.ICollection<string> SkipDays { get { throw null; } }
27+
public System.Collections.Generic.ICollection<int> SkipHours { get { throw null; } }
28+
public System.ServiceModel.Syndication.SyndicationTextInput TextInput { get { throw null; } set { } }
29+
public int TimeToLive { get { throw null; } set { } }
2630
}
2731
public abstract partial class SyndicationFeedFormatter
2832
{
@@ -31,4 +35,12 @@ public abstract partial class SyndicationFeedFormatter
3135
}
3236
public delegate bool TryParseDateTimeCallback(System.ServiceModel.Syndication.XmlDateTimeData data, out System.DateTimeOffset dateTimeOffset);
3337
public delegate bool TryParseUriCallback(System.ServiceModel.Syndication.XmlUriData data, out System.Uri uri);
38+
public partial class SyndicationTextInput
39+
{
40+
public string Description;
41+
public System.ServiceModel.Syndication.SyndicationLink Link;
42+
public string Name;
43+
public string Title;
44+
public SyndicationTextInput() { }
45+
}
3446
}

src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20FeedFormatter.cs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,12 +1027,52 @@ private void WriteFeed(XmlWriter writer)
10271027
}
10281028

10291029
// Optional spec items
1030-
// docs
10311030
if (Feed.InternalDocumentation?.Uri != null)
10321031
{
10331032
writer.WriteElementString(Rss20Constants.DocumentationTag, Feed.InternalDocumentation.Uri.ToString());
10341033
}
10351034

1035+
if (Feed.InternalTimeToLive != null)
1036+
{
1037+
writer.WriteElementString(Rss20Constants.TimeToLiveTag, Feed.InternalTimeToLive.ToString());
1038+
}
1039+
1040+
if (Feed.InternalSkipHours?.Count > 0)
1041+
{
1042+
writer.WriteStartElement(Rss20Constants.SkipHoursTag);
1043+
1044+
foreach (int hour in Feed.InternalSkipHours)
1045+
{
1046+
writer.WriteElementString(Rss20Constants.HourTag, hour.ToString());
1047+
}
1048+
1049+
writer.WriteEndElement();
1050+
}
1051+
1052+
if (Feed.InternalSkipDays?.Count > 0)
1053+
{
1054+
writer.WriteStartElement(Rss20Constants.SkipDaysTag);
1055+
1056+
foreach (string day in Feed.InternalSkipDays)
1057+
{
1058+
writer.WriteElementString(Rss20Constants.DayTag, day);
1059+
}
1060+
1061+
writer.WriteEndElement();
1062+
}
1063+
1064+
if (Feed.InternalTextInput != null)
1065+
{
1066+
writer.WriteStartElement(Rss20Constants.TextInputTag);
1067+
1068+
writer.WriteElementString(Rss20Constants.DescriptionTag, Feed.InternalTextInput.Description);
1069+
writer.WriteElementString(Rss20Constants.TitleTag, Feed.InternalTextInput.Title);
1070+
writer.WriteElementString(Rss20Constants.LinkTag, Feed.InternalTextInput.Link.GetAbsoluteUri().ToString());
1071+
writer.WriteElementString(Rss20Constants.NameTag, Feed.InternalTextInput.Name);
1072+
1073+
writer.WriteEndElement();
1074+
}
1075+
10361076
if (_serializeExtensionsAsAtom)
10371077
{
10381078
_atomSerializer.WriteElement(writer, Atom10Constants.IdTag, this.Feed.Id);

0 commit comments

Comments
 (0)