From 91afaaf8fe43035bb4832da44b6d6741d2815fb5 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Wed, 27 Feb 2019 12:45:06 +0100 Subject: [PATCH] Cleanup in QueryParamCollection --- Emby.Dlna/PlayTo/PlayToController.cs | 2 +- .../Services/QueryParamCollection.cs | 59 +------------------ 2 files changed, 2 insertions(+), 59 deletions(-) diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs index be6810d0e..2da8bb860 100644 --- a/Emby.Dlna/PlayTo/PlayToController.cs +++ b/Emby.Dlna/PlayTo/PlayToController.cs @@ -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 values = QueryHelpers.ParseQuery(query); request.DeviceProfileId = values["DeviceProfileId"].ToString(); request.DeviceId = values["DeviceId"].ToString(); diff --git a/MediaBrowser.Model/Services/QueryParamCollection.cs b/MediaBrowser.Model/Services/QueryParamCollection.cs index 09806ed9c..9f23b2420 100644 --- a/MediaBrowser.Model/Services/QueryParamCollection.cs +++ b/MediaBrowser.Model/Services/QueryParamCollection.cs @@ -16,7 +16,7 @@ namespace MediaBrowser.Model.Services } - public QueryParamCollection(IDictionary 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()) - { - 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()) - { - 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) }; - } - /// /// Adds a new query parameter. /// @@ -129,16 +82,6 @@ namespace MediaBrowser.Model.Services Add(key, value); } - /// - /// Removes all parameters of the given name. - /// - /// The number of parameters that were removed - /// is null. - public virtual int Remove(string name) - { - return RemoveAll(p => p.Name == name); - } - public string Get(string name) { var stringComparison = GetStringComparison();