Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added icon, refactoring
  • Loading branch information
arminreiter committed Jun 1, 2017
1 parent 580dc43 commit eaf6cc7
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 30 deletions.
3 changes: 1 addition & 2 deletions FeedReader.sln
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26403.7
VisualStudioVersion = 15.0.26430.6
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FeedReader", "FeedReader\FeedReader.csproj", "{E6D73D4A-2166-4715-A7B0-C3644469959A}"
EndProject
Expand All @@ -18,7 +18,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FeedReader.ConsoleSample",
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{305D3DDE-41ED-4AB7-9D56-297B97C1EB6B}"
EndProject

Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
2 changes: 2 additions & 0 deletions FeedReader/Extensions.cs
Expand Up @@ -28,6 +28,8 @@ public static string HtmlDecode(this string text)
/// <returns></returns>
public static bool EqualsIgnoreCase(this string text, string compareTo)
{
if (text == null)
return compareTo == null;
return text.Equals(compareTo, StringComparison.OrdinalIgnoreCase);
}

Expand Down
11 changes: 7 additions & 4 deletions FeedReader/FeedReader.csproj
Expand Up @@ -10,15 +10,18 @@
<Product>CodeHollow.FeedReader</Product>
<Description>FeedReader is a .net standard 1.3 library used for reading and parsing RSS and ATOM feeds. Supports RSS 0.91, 0.92, 1.0, 2.0 and ATOM. Developed because existing libraries do not work with different languages, encodings or have other issues. Library tested with multiple languages and feeds.</Description>
<Copyright>Copyright 2017</Copyright>
<PackageLicenseUrl>https://github.com/codehollow/FeedReader/blob/master/LICENSE</PackageLicenseUrl>
<PackageLicenseUrl>https://raw.github.com/codehollow/FeedReader/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/codehollow/FeedReader/</PackageProjectUrl>
<RepositoryUrl>https://github.com/codehollow/FeedReader/</RepositoryUrl>
<Version>1.0.3.6</Version>
<PackageReleaseNotes>update package to support netstandard1.3</PackageReleaseNotes>
<Version>1.1.0.0</Version>
<PackageReleaseNotes>integration of iTunes extensions for feeds (thanks to eallegretta), refactoring/code improvements, documentation update</PackageReleaseNotes>
<PackageTags>feed rss atom</PackageTags>
<AssemblyName>CodeHollow.FeedReader</AssemblyName>
<RootNamespace>CodeHollow.FeedReader</RootNamespace>
<RepositoryType></RepositoryType>
<RepositoryType>git</RepositoryType>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
<PackageIconUrl>https://raw.github.com/codehollow/FeedReader/master/FeedReader/icon.png</PackageIconUrl>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard1.3|AnyCPU'">
Expand Down
21 changes: 11 additions & 10 deletions FeedReader/Feeds/Itunes/ItunesChannel.cs
Expand Up @@ -9,41 +9,42 @@
/// </summary>
public class ItunesChannel
{
internal const string NAMESPACEPREFIX = "itunes";
/// <summary>
/// Initializes a new instance of the <see cref="ItunesChannel"/> class.
/// </summary>
/// <param name="channelElement"></param>
public ItunesChannel(XElement channelElement)
{
Author = channelElement.GetValue("itunes", "author");
Block = channelElement.GetValue("itunes", "block") == "Yes";
Author = channelElement.GetValue(NAMESPACEPREFIX, "author");
Block = channelElement.GetValue(NAMESPACEPREFIX, "block").EqualsIgnoreCase("yes");
Categories = GetItunesCategories(channelElement);

var imageElement = channelElement.GetElement("itunes", "image");
var imageElement = channelElement.GetElement(NAMESPACEPREFIX, "image");
if (imageElement != null)
{
Image = new ItunesImage(imageElement);
}

var explicitValue = channelElement.GetValue("itunes", "explicit");
var explicitValue = channelElement.GetValue(NAMESPACEPREFIX, "explicit");
Explicit = explicitValue.EqualsIgnoreCase("yes", "explicit", "true");

Complete = channelElement.GetValue("itunes", "complete").EqualsIgnoreCase("yes");
Complete = channelElement.GetValue(NAMESPACEPREFIX, "complete").EqualsIgnoreCase("yes");

if (Uri.TryCreate(channelElement.GetValue("itunes", "new-feed-url"), UriKind.Absolute, out var newFeedUrl))
if (Uri.TryCreate(channelElement.GetValue(NAMESPACEPREFIX, "new-feed-url"), UriKind.Absolute, out var newFeedUrl))
{
NewFeedUrl = newFeedUrl;
}

var ownerElement = channelElement.GetElement("itunes", "owner");
var ownerElement = channelElement.GetElement(NAMESPACEPREFIX, "owner");

if (ownerElement != null)
{
Owner = new ItunesOwner(ownerElement);
}

Subtitle = channelElement.GetValue("itunes", "subtitle");
Summary = channelElement.GetValue("itunes", "summary");
Subtitle = channelElement.GetValue(NAMESPACEPREFIX, "subtitle");
Summary = channelElement.GetValue(NAMESPACEPREFIX, "summary");
}

/// <summary>
Expand Down Expand Up @@ -103,7 +104,7 @@ public ItunesChannel(XElement channelElement)
/// <returns>the itunes:categries</returns>
private ItunesCategory[] GetItunesCategories(XElement element)
{
var query = from categoryElement in element.GetElements("itunes", "category")
var query = from categoryElement in element.GetElements(NAMESPACEPREFIX, "category")
let children = GetItunesCategories(categoryElement)
select new ItunesCategory(categoryElement.GetAttributeValue("text"), children);

Expand Down
18 changes: 9 additions & 9 deletions FeedReader/Feeds/Itunes/ItunesItem.cs
Expand Up @@ -14,30 +14,30 @@ public class ItunesItem
/// <param name="itemElement"></param>
public ItunesItem(XElement itemElement)
{
Author = itemElement.GetValue("itunes", "author");
Block = itemElement.GetValue("itunes", "block").EqualsIgnoreCase("yes");
var imageElement = itemElement.GetElement("itunes", "image");
Author = itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "author");
Block = itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "block").EqualsIgnoreCase("yes");
var imageElement = itemElement.GetElement(ItunesChannel.NAMESPACEPREFIX, "image");

if (imageElement != null)
{
Image = new ItunesImage(imageElement);
}

var duration = itemElement.GetValue("itunes", "duration");
var duration = itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "duration");
Duration = ParseDuration(duration);

var explicitValue = itemElement.GetValue("itunes", "explicit");
var explicitValue = itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "explicit");
Explicit = explicitValue.EqualsIgnoreCase("yes", "explicit", "true");

IsClosedCaptioned = itemElement.GetValue("itunes", "isClosedCaptioned").EqualsIgnoreCase("yes");
IsClosedCaptioned = itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "isClosedCaptioned").EqualsIgnoreCase("yes");

if (int.TryParse(itemElement.GetValue("itunes", "order"), out var order))
if (int.TryParse(itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "order"), out var order))
{
Order = order;
}

Subtitle = itemElement.GetValue("itunes", "subtitle");
Summary = itemElement.GetValue("itunes", "summary");
Subtitle = itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "subtitle");
Summary = itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "summary");
}

private static TimeSpan? ParseDuration(string duration)
Expand Down
4 changes: 2 additions & 2 deletions FeedReader/Feeds/Itunes/ItunesOwner.cs
Expand Up @@ -13,8 +13,8 @@ public class ItunesOwner
/// <param name="ownerElement">the owner xml element</param>
public ItunesOwner(XElement ownerElement)
{
Name = ownerElement.GetValue("itunes", "name");
Email = ownerElement.GetValue("itunes", "email");
Name = ownerElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "name");
Email = ownerElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "email");
}

/// <summary>
Expand Down
Binary file added FeedReader/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions ToDo.txt

This file was deleted.

0 comments on commit eaf6cc7

Please sign in to comment.