Cleanup in QueryParamCollection

pull/1010/head
Claus Vium 6 years ago
parent 333bd2107a
commit 91afaaf8fe

@ -849,7 +849,7 @@ namespace Emby.Dlna.PlayTo
if (index == -1) return request;
var query = url.Substring(index + 1);
var values = QueryHelpers.ParseQuery(query);
Dictionary<string, StringValues> values = QueryHelpers.ParseQuery(query);
request.DeviceProfileId = values["DeviceProfileId"].ToString();
request.DeviceId = values["DeviceId"].ToString();

@ -16,7 +16,7 @@ namespace MediaBrowser.Model.Services
}
public QueryParamCollection(IDictionary<string, string> headers)
public QueryParamCollection(IHeaderDictionary headers)
{
foreach (var pair in headers)
{
@ -24,38 +24,6 @@ namespace MediaBrowser.Model.Services
}
}
public QueryParamCollection(Microsoft.AspNetCore.Http.IHeaderDictionary headers)
{
foreach (var pair in headers)
{
Add(pair.Key, pair.Value);
}
}
// 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);
}
}
}
public QueryParamCollection(IQueryCollection queryCollection)
{
foreach (var pair in queryCollection)
@ -74,21 +42,6 @@ namespace MediaBrowser.Model.Services
return StringComparer.OrdinalIgnoreCase;
}
public string GetKey(int index)
{
return this[index].Name;
}
public string Get(int index)
{
return this[index].Value;
}
public virtual string[] GetValues(int index)
{
return new[] { Get(index) };
}
/// <summary>
/// Adds a new query parameter.
/// </summary>
@ -129,16 +82,6 @@ namespace MediaBrowser.Model.Services
Add(key, value);
}
/// <summary>
/// Removes all parameters of the given name.
/// </summary>
/// <returns>The number of parameters that were removed</returns>
/// <exception cref="ArgumentNullException"><paramref name="name" /> is null.</exception>
public virtual int Remove(string name)
{
return RemoveAll(p => p.Name == name);
}
public string Get(string name)
{
var stringComparison = GetStringComparison();

Loading…
Cancel
Save