Begin removing System.Net sources

This commit is contained in:
Claus Vium
2019-02-21 10:07:21 +01:00
parent 968e282c90
commit 4db31acff9
54 changed files with 264 additions and 7013 deletions

View File

@@ -1,10 +1,13 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Net;
using MediaBrowser.Model.Dto;
namespace MediaBrowser.Model.Services
{
// Remove this garbage class, it's just a bastard copy of NameValueCollection
public class QueryParamCollection : List<NameValuePair>
{
public QueryParamCollection()
@@ -20,6 +23,30 @@ namespace MediaBrowser.Model.Services
}
}
// TODO remove this shit
public QueryParamCollection(WebHeaderCollection webHeaderCollection)
{
foreach (var key in webHeaderCollection.AllKeys)
{
foreach (var value in webHeaderCollection.GetValues(key) ?? Array.Empty<string>())
{
Add(key, value);
}
}
}
// TODO remove this shit
public QueryParamCollection(NameValueCollection nameValueCollection)
{
foreach (var key in nameValueCollection.AllKeys)
{
foreach (var value in nameValueCollection.GetValues(key) ?? Array.Empty<string>())
{
Add(key, value);
}
}
}
private static StringComparison GetStringComparison()
{
return StringComparison.OrdinalIgnoreCase;
@@ -50,6 +77,10 @@ namespace MediaBrowser.Model.Services
/// </summary>
public virtual void Add(string key, string value)
{
if (string.Equals(key, "content-length", StringComparison.OrdinalIgnoreCase))
{
return;
}
Add(new NameValuePair(key, value));
}