From d4d10f6e433cc472c5aafe6af53a101bba36bf79 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 12 May 2014 18:30:32 -0400 Subject: add new subtitle preferences --- MediaBrowser.Model/Web/QueryStringDictionary.cs | 257 ------------------------ 1 file changed, 257 deletions(-) delete mode 100644 MediaBrowser.Model/Web/QueryStringDictionary.cs (limited to 'MediaBrowser.Model/Web/QueryStringDictionary.cs') diff --git a/MediaBrowser.Model/Web/QueryStringDictionary.cs b/MediaBrowser.Model/Web/QueryStringDictionary.cs deleted file mode 100644 index b011d4d9c..000000000 --- a/MediaBrowser.Model/Web/QueryStringDictionary.cs +++ /dev/null @@ -1,257 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; - -namespace MediaBrowser.Model.Web -{ - /// - /// Class QueryStringDictionary - /// - public class QueryStringDictionary : Dictionary - { - /// - /// Initializes a new instance of the class. - /// - public QueryStringDictionary() - : base(StringComparer.OrdinalIgnoreCase) - { - } - - /// - /// Adds the specified name. - /// - /// The name. - /// The value. - public void Add(string name, int value) - { - Add(name, value.ToString(CultureInfo.InvariantCulture)); - } - - /// - /// Adds the specified name. - /// - /// The name. - /// The value. - public void Add(string name, long value) - { - Add(name, value.ToString(CultureInfo.InvariantCulture)); - } - - /// - /// Adds the specified name. - /// - /// The name. - /// The value. - public void Add(string name, double value) - { - Add(name, value.ToString(CultureInfo.InvariantCulture)); - } - - /// - /// Adds if not null or empty. - /// - /// The name. - /// The value. - public void AddIfNotNullOrEmpty(string name, string value) - { - if (!string.IsNullOrEmpty(value)) - { - Add(name, value); - } - } - - /// - /// Adds if not null. - /// - /// The name. - /// The value. - public void AddIfNotNull(string name, int? value) - { - if (value.HasValue) - { - Add(name, value.Value); - } - } - - /// - /// Adds if not null. - /// - /// The name. - /// The value. - public void AddIfNotNull(string name, double? value) - { - if (value.HasValue) - { - Add(name, value.Value); - } - } - - /// - /// Adds if not null. - /// - /// The name. - /// The value. - public void AddIfNotNull(string name, long? value) - { - if (value.HasValue) - { - Add(name, value.Value); - } - } - - /// - /// Adds the specified name. - /// - /// The name. - /// if set to true [value]. - public void Add(string name, bool value) - { - Add(name, value.ToString()); - } - - /// - /// Adds if not null. - /// - /// The name. - /// if set to true [value]. - public void AddIfNotNull(string name, bool? value) - { - if (value.HasValue) - { - Add(name, value.Value); - } - } - - /// - /// Adds the specified name. - /// - /// The name. - /// The value. - /// value - public void Add(string name, IEnumerable value) - { - if (value == null) - { - throw new ArgumentNullException("value"); - } - - Add(name, string.Join(",", value.Select(v => v.ToString(CultureInfo.InvariantCulture)).ToArray())); - } - - /// - /// Adds if not null. - /// - /// The name. - /// The value. - public void AddIfNotNull(string name, IEnumerable value) - { - if (value != null) - { - Add(name, value); - } - } - - /// - /// Adds the specified name. - /// - /// The name. - /// The value. - /// value - public void Add(string name, IEnumerable value) - { - if (value == null) - { - throw new ArgumentNullException("value"); - } - - string paramValue = string.Join(",", value.ToArray()); - - Add(name, paramValue); - } - - /// - /// Adds if not null. - /// - /// The name. - /// The value. - public void AddIfNotNull(string name, IEnumerable value) - { - if (value != null) - { - Add(name, value); - } - } - - /// - /// Adds the specified name. - /// - /// The name. - /// The value. - /// The delimiter. - /// value - public void Add(string name, IEnumerable value, string delimiter) - { - if (value == null) - { - throw new ArgumentNullException("value"); - } - - string paramValue = string.Join(delimiter, value.ToArray()); - - Add(name, paramValue); - } - - /// - /// Adds if not null. - /// - /// The name. - /// The value. - /// The delimiter. - public void AddIfNotNull(string name, IEnumerable value, string delimiter) - { - if (value != null) - { - Add(name, value, delimiter); - } - } - - /// - /// Gets the query string. - /// - /// System.String. - public string GetQueryString() - { - string[] queryParams = this.Select(i => string.Format("{0}={1}", i.Key, GetEncodedValue(i.Value))).ToArray(); - - return string.Join("&", queryParams); - } - - /// - /// Gets the encoded value. - /// - /// The value. - /// System.String. - private string GetEncodedValue(string value) - { - return value; - } - - /// - /// Gets the URL. - /// - /// The prefix. - /// System.String. - public string GetUrl(string prefix) - { - string query = GetQueryString(); - - if (string.IsNullOrEmpty(query)) - { - return prefix; - } - - return prefix + "?" + query; - } - } -} -- cgit v1.2.3