Internalize ProductHeaderValue

What Haacked, PaulBetts, and Shiftkey suggested
This commit is contained in:
Tim Sneed
2014-02-28 06:33:44 -06:00
parent bf47373936
commit 3909498437
29 changed files with 78 additions and 29 deletions

View File

@@ -1,5 +1,4 @@
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;

View File

@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using Octokit;
using Octokit.Tests.Integration;
using System.Threading.Tasks;

View File

@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;

View File

@@ -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;

View File

@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;

View File

@@ -1,7 +1,6 @@
using Octokit;
using Octokit.Tests.Integration;
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Xunit;

View File

@@ -1,7 +1,6 @@
using Octokit;
using Octokit.Tests.Integration;
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Xunit;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Octokit;

View File

@@ -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;

View File

@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;

View File

@@ -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;

View File

@@ -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;

View File

@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Helpers;

View File

@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;

View File

@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;

View File

@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;

View File

@@ -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;

View File

@@ -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;

View File

@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using Octokit.Internal;
namespace Octokit

View File

@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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;
}
}
}

View File

@@ -297,6 +297,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>

View File

@@ -308,6 +308,7 @@
<Compile Include="Exceptions\RepositoryExistsException.cs" />
<Compile Include="Helpers\ApiErrorExtensions.cs" />
<Compile Include="Exceptions\PrivateRepositoryQuotaExceededException.cs" />
<Compile Include="Http\ProductHeaderValue.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
</Project>

View File

@@ -303,6 +303,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>

View File

@@ -295,6 +295,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">

View File

@@ -59,6 +59,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" />

View File

@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Octokit;