Skip to content

Commit

Permalink
Merge pull request #406 from trsneed/internalise-ProductHeaderValue
Browse files Browse the repository at this point in the history
Internalize ProductHeaderValue
  • Loading branch information
haacked committed Feb 28, 2014
2 parents df10639 + 85ff7fc commit 9409429
Show file tree
Hide file tree
Showing 29 changed files with 66 additions and 29 deletions.
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/AssigneesClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/BlobClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using Octokit;
using Octokit.Tests.Integration;
using System.Threading.Tasks;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/BranchesClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
3 changes: 1 addition & 2 deletions Octokit.Tests.Integration/Clients/CommitStatusClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Net.Http.Headers;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
using Xunit;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/CommitsClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Octokit;
using Octokit.Tests.Integration;
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Octokit;
using Octokit.Tests.Integration;
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Xunit;

Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/FollowersClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Octokit;
Expand Down
3 changes: 1 addition & 2 deletions Octokit.Tests.Integration/Clients/GistsClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Net.Http.Headers;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
using Xunit;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/IssuesClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Globalization;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Octokit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Octokit;
Expand Down
4 changes: 0 additions & 4 deletions Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/MilestonesClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Net.Http.Headers;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/ReferencesClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Helpers;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/ReleasesClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/TreeClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/UsersClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Linq;
using System.Net;
using System.Net.Http.Headers;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Octokit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Octokit;
using Octokit.Reactive;
using System;
using System.Net.Http.Headers;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Octokit.Tests.Integration;
Expand Down
1 change: 0 additions & 1 deletion Octokit/GitHubClient.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using Octokit.Internal;

namespace Octokit
Expand Down
58 changes: 58 additions & 0 deletions Octokit/Http/ProductHeaderValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
namespace Octokit
{
public class ProductHeaderValue
{
ProductHeaderValue() { }

public ProductHeaderValue(string name)
{
_productHeaderValue = new System.Net.Http.Headers.ProductHeaderValue(name);
}

public ProductHeaderValue(string name, string value)
{
_productHeaderValue = new System.Net.Http.Headers.ProductHeaderValue(name, value);
}

System.Net.Http.Headers.ProductHeaderValue _productHeaderValue;

public string Name
{
get { return _productHeaderValue.Name; }
}

public string Version
{
get { return _productHeaderValue.Version; }
}

public override bool Equals(object obj)
{
return _productHeaderValue.Equals(obj);
}

public override int GetHashCode()
{
return _productHeaderValue.GetHashCode();
}

public override string ToString()
{
return _productHeaderValue.ToString();
}

public static ProductHeaderValue Parse(string input)
{
return new ProductHeaderValue { _productHeaderValue = System.Net.Http.Headers.ProductHeaderValue.Parse(input) };
}

public static bool TryParse(string input,
out ProductHeaderValue parsedValue)
{
System.Net.Http.Headers.ProductHeaderValue value;
var result = System.Net.Http.Headers.ProductHeaderValue.TryParse(input, out value);
parsedValue = result ? Parse(input) : null;
return result;
}
}
}
1 change: 1 addition & 0 deletions Octokit/Octokit-Mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
<Compile Include="Exceptions\RepositoryExistsException.cs" />
<Compile Include="Helpers\ApiErrorExtensions.cs" />
<Compile Include="Exceptions\PrivateRepositoryQuotaExceededException.cs" />
<Compile Include="Http\ProductHeaderValue.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
1 change: 1 addition & 0 deletions Octokit/Octokit-MonoAndroid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@
<Compile Include="Exceptions\RepositoryExistsException.cs" />
<Compile Include="Helpers\ApiErrorExtensions.cs" />
<Compile Include="Exceptions\PrivateRepositoryQuotaExceededException.cs" />
<Compile Include="Http\ProductHeaderValue.cs" />
<Compile Include="Models\Request\NewGist.cs" />
<Compile Include="Models\Request\GistUpdate.cs" />
<Compile Include="Models\Request\GistRequest.cs" />
Expand Down
1 change: 1 addition & 0 deletions Octokit/Octokit-Monotouch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@
<Compile Include="Exceptions\RepositoryExistsException.cs" />
<Compile Include="Helpers\ApiErrorExtensions.cs" />
<Compile Include="Exceptions\PrivateRepositoryQuotaExceededException.cs" />
<Compile Include="Http\ProductHeaderValue.cs" />
<Compile Include="Models\Request\GistUpdate.cs" />
<Compile Include="Models\Request\GistRequest.cs" />
<Compile Include="Models\Request\NewGist.cs" />
Expand Down
1 change: 1 addition & 0 deletions Octokit/Octokit-netcore45.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
<Compile Include="Exceptions\RepositoryExistsException.cs" />
<Compile Include="Helpers\ApiErrorExtensions.cs" />
<Compile Include="Exceptions\PrivateRepositoryQuotaExceededException.cs" />
<Compile Include="Http\ProductHeaderValue.cs" />
</ItemGroup>
<ItemGroup>
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
Expand Down
1 change: 1 addition & 0 deletions Octokit/Octokit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<Compile Include="Exceptions\PrivateRepositoryQuotaExceededException.cs" />
<Compile Include="Exceptions\RepositoryExistsException.cs" />
<Compile Include="Helpers\ApiErrorExtensions.cs" />
<Compile Include="Http\ProductHeaderValue.cs" />
<Compile Include="Models\Response\DeploymentStatus.cs" />
<Compile Include="Clients\DeploymentStatusClient.cs" />
<Compile Include="Clients\IDeploymentStatusClient.cs" />
Expand Down
1 change: 0 additions & 1 deletion clean-up-after-tests/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Octokit;
Expand Down

0 comments on commit 9409429

Please sign in to comment.