From 2790f9648e3d02ca641ff0c04b31b5db5030f0c8 Mon Sep 17 00:00:00 2001 From: Hugh Bellamy Date: Tue, 5 Mar 2019 21:22:50 +0000 Subject: [PATCH] Cleanup some Syndication code (dotnet/corefx#35175) Commit migrated from https://github.com/dotnet/corefx/commit/327d8ed428b40491b499cad4d4114af4fa3f8f30 --- .../src/Resources/Strings.resx | 33 ---------------------- .../System/ServiceModel/Channels/UriGenerator.cs | 21 ++------------ .../ServiceModel/Syndication/SyndicationFeed.cs | 12 +++----- .../Syndication/SyndicationItemFormatter.cs | 5 ---- 4 files changed, 6 insertions(+), 65 deletions(-) diff --git a/src/libraries/System.ServiceModel.Syndication/src/Resources/Strings.resx b/src/libraries/System.ServiceModel.Syndication/src/Resources/Strings.resx index 883b733..6ac5b01 100644 --- a/src/libraries/System.ServiceModel.Syndication/src/Resources/Strings.resx +++ b/src/libraries/System.ServiceModel.Syndication/src/Resources/Strings.resx @@ -143,12 +143,6 @@ The name of the extension element must be specified. - - The feed's authors were not serialized as part of serializing the feed in RSS 2.0 format. - - - The feed's contributors were not serialized as part of serializing the feed in RSS 2.0 format. - The feed created a null category. @@ -161,30 +155,9 @@ The syndication feed formatter must be configured with a syndication feed. - - The feed being deserialized has non-contiguous sets of items in it. This is not supported by '{0}'. - - - The feed's id was not serialized as part of serializing the feed in RSS 2.0 format. - - - The feed's links were not serialized as part of serializing the feed in RSS 2.0 format. - The Type of object passed as parameter '{0}' is not derived from {1}. Ensure that the type of object passed is either of type {1} or derived from {1}. - - The item's authors were not serialized as part of serializing the feed in RSS 2.0 format. - - - The item's content was not serialized as part of serializing the feed in RSS 2.0 format. - - - The item's contributors were not serialized as part of serializing the feed in RSS 2.0 format. - - - The item's copyrights were not serialized as part of serializing the feed in RSS 2.0 format. - The item created a null category. @@ -194,12 +167,6 @@ The syndication item formatter must be configured with a syndication item. - - The item's last updated time was not serialized as part of serializing the feed in RSS 2.0 format. - - - The item's links were not serialized as part of serializing the feed in RSS 2.0 format. - The outer element name must be specified. diff --git a/src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Channels/UriGenerator.cs b/src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Channels/UriGenerator.cs index c801d5f..5c4541a 100644 --- a/src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Channels/UriGenerator.cs +++ b/src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Channels/UriGenerator.cs @@ -12,26 +12,9 @@ namespace System.ServiceModel.Channels private long _id; private readonly string _prefix; - public UriGenerator() : this("uuid") + public UriGenerator() { - } - - public UriGenerator(string scheme) : this(scheme, ";") - { - } - - public UriGenerator(string scheme, string delimiter) - { - if (scheme == null) - { - throw new ArgumentNullException(nameof(scheme)); - } - if (scheme.Length == 0) - { - throw new ArgumentException(SR.UriGeneratorSchemeMustNotBeEmpty, nameof(scheme)); - } - - _prefix = string.Concat(scheme, ":", Guid.NewGuid().ToString(), delimiter, "id="); + _prefix = string.Concat("uuid:", Guid.NewGuid().ToString(), ";id="); } public string Next() diff --git a/src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeed.cs b/src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeed.cs index 37b13ca..a4650d1 100644 --- a/src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeed.cs +++ b/src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeed.cs @@ -245,8 +245,7 @@ namespace System.ServiceModel.Syndication private SyndicationLink TryReadDocumentationFromExtension(SyndicationElementExtensionCollection elementExtensions) { SyndicationElementExtension documentationElement = elementExtensions - .Where(e => e.OuterName == Rss20Constants.DocumentationTag && e.OuterNamespace == Rss20Constants.Rss20Namespace) - .FirstOrDefault(); + .FirstOrDefault(e => e.OuterName == Rss20Constants.DocumentationTag && e.OuterNamespace == Rss20Constants.Rss20Namespace); if (documentationElement == null) return null; @@ -290,8 +289,7 @@ namespace System.ServiceModel.Syndication private void TryReadSkipHoursFromExtension(SyndicationElementExtensionCollection elementExtensions, Collection skipHours) { SyndicationElementExtension skipHoursElement = elementExtensions - .Where(e => e.OuterName == Rss20Constants.SkipHoursTag && e.OuterNamespace == Rss20Constants.Rss20Namespace) - .FirstOrDefault(); + .FirstOrDefault(e => e.OuterName == Rss20Constants.SkipHoursTag && e.OuterNamespace == Rss20Constants.Rss20Namespace); if (skipHoursElement == null) return; @@ -325,8 +323,7 @@ namespace System.ServiceModel.Syndication private void TryReadSkipDaysFromExtension(SyndicationElementExtensionCollection elementExtensions, Collection skipDays) { SyndicationElementExtension skipDaysElement = elementExtensions - .Where(e => e.OuterName == Rss20Constants.SkipDaysTag && e.OuterNamespace == Rss20Constants.Rss20Namespace) - .FirstOrDefault(); + .FirstOrDefault(e => e.OuterName == Rss20Constants.SkipDaysTag && e.OuterNamespace == Rss20Constants.Rss20Namespace); if (skipDaysElement == null) return; @@ -362,8 +359,7 @@ namespace System.ServiceModel.Syndication private SyndicationTextInput TryReadTextInputFromExtension(SyndicationElementExtensionCollection elementExtensions) { SyndicationElementExtension textInputElement = elementExtensions - .Where(e => e.OuterName == Rss20Constants.TextInputTag && e.OuterNamespace == Rss20Constants.Rss20Namespace) - .FirstOrDefault(); + .FirstOrDefault(e => e.OuterName == Rss20Constants.TextInputTag && e.OuterNamespace == Rss20Constants.Rss20Namespace); if (textInputElement == null) return null; diff --git a/src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItemFormatter.cs b/src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItemFormatter.cs index 7741477..776a4ef 100644 --- a/src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItemFormatter.cs +++ b/src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItemFormatter.cs @@ -39,11 +39,6 @@ namespace System.ServiceModel.Syndication _item = item ?? throw new ArgumentNullException(nameof(item)); } - internal static void CreateBufferIfRequiredAndWriteNode(ref XmlBuffer buffer, ref XmlDictionaryWriter extWriter, XmlDictionaryReader reader, int maxExtensionSize) - { - SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNode(ref buffer, ref extWriter, reader, maxExtensionSize); - } - internal static SyndicationItem CreateItemInstance(Type itemType) { if (itemType.Equals(typeof(SyndicationItem))) -- 2.7.4