mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
Internalize ProductHeaderValue
What Haacked, PaulBetts, and Shiftkey suggested
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit;
|
||||
using Octokit.Tests.Integration;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Net.Http.Headers;
|
||||
using Octokit;
|
||||
using Octokit.Tests.Integration;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit;
|
||||
using Octokit.Tests.Integration;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit;
|
||||
using Octokit.Tests.Integration;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Octokit;
|
||||
using Octokit.Tests.Integration;
|
||||
using System;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Octokit;
|
||||
using Octokit.Tests.Integration;
|
||||
using System;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit;
|
||||
using Octokit.Tests.Integration;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit;
|
||||
using Octokit.Tests.Helpers;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit;
|
||||
using Octokit.Tests.Integration;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit;
|
||||
using Octokit.Tests.Integration;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit;
|
||||
using Octokit.Tests.Integration;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Net.Http.Headers;
|
||||
using Octokit.Internal;
|
||||
|
||||
namespace Octokit
|
||||
|
||||
70
Octokit/Http/ProductHeaderValue.cs
Normal file
70
Octokit/Http/ProductHeaderValue.cs
Normal 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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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">
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit;
|
||||
|
||||
Reference in New Issue
Block a user