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
+70
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;
}
}
}