update portable projects

This commit is contained in:
Luke Pulverenti
2016-11-08 13:44:23 -05:00
parent 05a5ce58a9
commit a8b340cbb2
84 changed files with 1055 additions and 921 deletions

View File

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MediaBrowser.Model.Services
{
public interface IHasRequestFilter
@@ -22,11 +17,5 @@ namespace MediaBrowser.Model.Services
/// <param name="res">The http response wrapper</param>
/// <param name="requestDto">The request DTO</param>
void RequestFilter(IRequest req, IResponse res, object requestDto);
/// <summary>
/// A new shallow copy of this filter is used on every request.
/// </summary>
/// <returns></returns>
IHasRequestFilter Copy();
}
}

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace MediaBrowser.Model.Services
{
public interface IHttpResult : IHasHeaders
{
/// <summary>
/// The HTTP Response Status
/// </summary>
int Status { get; set; }
/// <summary>
/// The HTTP Response Status Code
/// </summary>
HttpStatusCode StatusCode { get; set; }
/// <summary>
/// The HTTP Status Description
/// </summary>
string StatusDescription { get; set; }
/// <summary>
/// The HTTP Response ContentType
/// </summary>
string ContentType { get; set; }
/// <summary>
/// Additional HTTP Cookies
/// </summary>
List<Cookie> Cookies { get; }
/// <summary>
/// Response DTO
/// </summary>
object Response { get; set; }
/// <summary>
/// Holds the request call context
/// </summary>
IRequest RequestContext { get; set; }
}
}

View File

@@ -60,16 +60,6 @@ namespace MediaBrowser.Model.Services
QueryParamCollection QueryString { get; }
QueryParamCollection FormData { get; }
/// <summary>
/// Buffer the Request InputStream so it can be re-read
/// </summary>
bool UseBufferedStream { get; set; }
/// <summary>
/// The entire string contents of Request.InputStream
/// </summary>
/// <returns></returns>
string GetRawBody();
string RawUrl { get; }

View File

@@ -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();