Skip to content

Commit

Permalink
Updated the namespaces and added an HttpWebResponse extension
Browse files Browse the repository at this point in the history
  • Loading branch information
info authored and info committed Jan 30, 2017
1 parent 7baee04 commit 2026c9d
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 7 deletions.
1 change: 1 addition & 0 deletions WebLinksNet.Tests/WebLinkTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.WebLinks;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Expand Down
2 changes: 1 addition & 1 deletion WebLinksNet.Tests/WebLinksCollectionTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.WebLinks;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WebLinks;

namespace WebLinksNet.Tests
{
Expand Down
3 changes: 1 addition & 2 deletions WebLinksNet.Tests/WebLinksParserTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Net.WebLinks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WebLinks;
using WebLinksNet;

namespace WebLinksNet.Tests
{
Expand Down
26 changes: 26 additions & 0 deletions WebLinksNet/HttpWebResponseExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace System.Net.WebLinks
{
public static class HttpWebResponseExtension
{
/// <summary>
/// Returns a collection of web links from the given HttpWebResponse if they are present in the header. If not, null is returned.
/// </summary>
/// <param name="webResponse"></param>
public static WebLinksCollection GetWebLinks(this HttpWebResponse webResponse)
{
if (!webResponse.Headers.AllKeys.Contains("Links"))
{
return null;
}

return WebLinksCollection.Parse(webResponse.Headers["Links"]);
}
}
}
2 changes: 1 addition & 1 deletion WebLinksNet/WebLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace WebLinksNet
namespace System.Net.WebLinks
{
/// <summary>
/// A WebLink object representing the web link data
Expand Down
3 changes: 1 addition & 2 deletions WebLinksNet/WebLinksCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebLinksNet;

namespace WebLinks
namespace System.Net.WebLinks
{
/// <summary>
/// A collection of web links
Expand Down
1 change: 1 addition & 0 deletions WebLinksNet/WebLinksNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="HttpWebResponseExtension.cs" />
<Compile Include="WebLink.cs" />
<Compile Include="WebLinksCollection.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
2 changes: 1 addition & 1 deletion WebLinksNet/WebLinksParserException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace WebLinksNet
namespace System.Net.WebLinks
{
/// <summary>
/// The exception thrown when an error occured during parsing of WebLinks objects
Expand Down

0 comments on commit 2026c9d

Please sign in to comment.