aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Services/QueryParamCollection.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-11-08 13:44:23 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-11-08 13:44:23 -0500
commita8b340cbb29dbcf7fd5d101e640d66470c6d32bf (patch)
treea626c151e9ccb8809dd6d667fb9146fe4bb3ffea /MediaBrowser.Model/Services/QueryParamCollection.cs
parent05a5ce58a9293f6669960c735911e9455c5d8188 (diff)
update portable projects
Diffstat (limited to 'MediaBrowser.Model/Services/QueryParamCollection.cs')
-rw-r--r--MediaBrowser.Model/Services/QueryParamCollection.cs31
1 files changed, 25 insertions, 6 deletions
diff --git a/MediaBrowser.Model/Services/QueryParamCollection.cs b/MediaBrowser.Model/Services/QueryParamCollection.cs
index 1ab3f0bfb..dfea62821 100644
--- a/MediaBrowser.Model/Services/QueryParamCollection.cs
+++ b/MediaBrowser.Model/Services/QueryParamCollection.cs
@@ -9,7 +9,7 @@ namespace MediaBrowser.Model.Services
{
public QueryParamCollection()
{
-
+
}
public QueryParamCollection(IDictionary<string, string> headers)
@@ -30,15 +30,30 @@ 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>
- public void Add(string key, string value)
+ public virtual void Add(string key, string value)
{
Add(new NameValuePair(key, value));
}
- public void Set(string key, string value)
+ public virtual void Set(string key, string value)
{
if (string.IsNullOrWhiteSpace(value))
{
@@ -81,17 +96,21 @@ namespace MediaBrowser.Model.Services
/// </summary>
/// <returns>The number of parameters that were removed</returns>
/// <exception cref="ArgumentNullException"><paramref name="name" /> is null.</exception>
- public int Remove(string name)
+ public virtual int Remove(string name)
{
return RemoveAll(p => p.Name == name);
}
public string Get(string name)
{
- return GetValues(name).FirstOrDefault();
+ var stringComparison = GetStringComparison();
+
+ return this.Where(p => string.Equals(p.Name, name, stringComparison))
+ .Select(p => p.Value)
+ .FirstOrDefault();
}
- public string[] GetValues(string name)
+ public virtual string[] GetValues(string name)
{
var stringComparison = GetStringComparison();