mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-26 03:55:01 +01:00
update portable projects
This commit is contained in:
13
MediaBrowser.Model/Cryptography/ICryptoProvider.cs
Normal file
13
MediaBrowser.Model/Cryptography/ICryptoProvider.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Model.Cryptography
|
||||
{
|
||||
public interface ICryptoProvider
|
||||
{
|
||||
Guid GetMD5(string str);
|
||||
byte[] ComputeMD5(Stream str);
|
||||
byte[] ComputeMD5(byte[] bytes);
|
||||
byte[] ComputeSHA1(byte[] bytes);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Model.Cryptography
|
||||
{
|
||||
public interface ICryptographyProvider
|
||||
{
|
||||
Guid GetMD5(string str);
|
||||
byte[] GetMD5Bytes(string str);
|
||||
byte[] GetSHA1Bytes(byte[] bytes);
|
||||
byte[] GetMD5Bytes(Stream str);
|
||||
byte[] GetMD5Bytes(byte[] bytes);
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
namespace MediaBrowser.Model.IO
|
||||
{
|
||||
public interface IMemoryStreamProvider
|
||||
public interface IMemoryStreamFactory
|
||||
{
|
||||
MemoryStream CreateNew();
|
||||
MemoryStream CreateNew(int capacity);
|
||||
MemoryStream CreateNew(byte[] buffer);
|
||||
bool TryGetBuffer(MemoryStream stream, out byte[] buffer);
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@
|
||||
<Compile Include="Connect\PinExchangeResult.cs" />
|
||||
<Compile Include="Connect\PinStatusResult.cs" />
|
||||
<Compile Include="Connect\UserLinkType.cs" />
|
||||
<Compile Include="Cryptography\ICryptographyProvider.cs" />
|
||||
<Compile Include="Cryptography\ICryptoProvider.cs" />
|
||||
<Compile Include="Devices\DeviceOptions.cs" />
|
||||
<Compile Include="Devices\DeviceQuery.cs" />
|
||||
<Compile Include="Devices\LocalFileInfo.cs" />
|
||||
@@ -138,17 +138,19 @@
|
||||
<Compile Include="Dto\NameIdPair.cs" />
|
||||
<Compile Include="Dto\NameValuePair.cs" />
|
||||
<Compile Include="Net\IpEndPointInfo.cs" />
|
||||
<Compile Include="Net\ISocket.cs" />
|
||||
<Compile Include="Net\ISocketFactory.cs" />
|
||||
<Compile Include="Net\IUdpSocket.cs" />
|
||||
<Compile Include="Net\SocketReceiveResult.cs" />
|
||||
<Compile Include="Services\IHttpResult.cs" />
|
||||
<Compile Include="System\IEnvironmentInfo.cs" />
|
||||
<Compile Include="TextEncoding\IEncoding.cs" />
|
||||
<Compile Include="Text\ITextEncoding.cs" />
|
||||
<Compile Include="Extensions\LinqExtensions.cs" />
|
||||
<Compile Include="FileOrganization\SmartMatchInfo.cs" />
|
||||
<Compile Include="Health\IHealthMonitor.cs" />
|
||||
<Compile Include="IO\FileSystemMetadata.cs" />
|
||||
<Compile Include="IO\IFileSystem.cs" />
|
||||
<Compile Include="IO\IMemoryStreamProvider.cs" />
|
||||
<Compile Include="IO\IMemoryStreamFactory.cs" />
|
||||
<Compile Include="IO\IShortcutHandler.cs" />
|
||||
<Compile Include="IO\StreamDefaults.cs" />
|
||||
<Compile Include="Globalization\ILocalizationManager.cs" />
|
||||
|
||||
16
MediaBrowser.Model/Net/ISocket.cs
Normal file
16
MediaBrowser.Model/Net/ISocket.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
public interface ISocket : IDisposable
|
||||
{
|
||||
IpEndPointInfo LocalEndPoint { get; }
|
||||
IpEndPointInfo RemoteEndPoint { get; }
|
||||
void Close();
|
||||
void Shutdown(bool both);
|
||||
void Listen(int backlog);
|
||||
void Bind(IpEndPointInfo endpoint);
|
||||
|
||||
void StartAccept(Action<ISocket> onAccept, Func<bool> isClosed);
|
||||
}
|
||||
}
|
||||
@@ -27,5 +27,17 @@ namespace MediaBrowser.Model.Net
|
||||
/// <param name="localPort">The local port to bind to.</param>
|
||||
/// <returns>A <see cref="IUdpSocket"/> implementation.</returns>
|
||||
IUdpSocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort);
|
||||
}
|
||||
|
||||
ISocket CreateSocket(IpAddressFamily family, SocketType socketType, ProtocolType protocolType, bool dualMode);
|
||||
}
|
||||
|
||||
public enum SocketType
|
||||
{
|
||||
Stream
|
||||
}
|
||||
|
||||
public enum ProtocolType
|
||||
{
|
||||
Tcp
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,39 @@ namespace MediaBrowser.Model.Net
|
||||
{
|
||||
public class IpAddressInfo
|
||||
{
|
||||
public static IpAddressInfo Any = new IpAddressInfo("0.0.0.0", IpAddressFamily.InterNetwork);
|
||||
public static IpAddressInfo IPv6Any = new IpAddressInfo("00000000000000000000", IpAddressFamily.InterNetworkV6);
|
||||
public static IpAddressInfo Loopback = new IpAddressInfo("127.0.0.1", IpAddressFamily.InterNetwork);
|
||||
public static IpAddressInfo IPv6Loopback = new IpAddressInfo("IPv6Loopback", IpAddressFamily.InterNetworkV6);
|
||||
|
||||
public string Address { get; set; }
|
||||
public bool IsIpv6 { get; set; }
|
||||
public IpAddressFamily AddressFamily { get; set; }
|
||||
|
||||
public IpAddressInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IpAddressInfo(string address, IpAddressFamily addressFamily)
|
||||
{
|
||||
Address = address;
|
||||
AddressFamily = addressFamily;
|
||||
}
|
||||
|
||||
public bool Equals(IpAddressInfo address)
|
||||
{
|
||||
return string.Equals(address.Address, Address, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public override String ToString()
|
||||
{
|
||||
return Address;
|
||||
}
|
||||
}
|
||||
|
||||
public enum IpAddressFamily
|
||||
{
|
||||
InterNetwork,
|
||||
InterNetworkV6
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
@@ -8,11 +9,22 @@ namespace MediaBrowser.Model.Net
|
||||
|
||||
public int Port { get; set; }
|
||||
|
||||
public IpEndPointInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IpEndPointInfo(IpAddressInfo address, int port)
|
||||
{
|
||||
IpAddress = address;
|
||||
Port = port;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var ipAddresString = IpAddress == null ? string.Empty : IpAddress.ToString();
|
||||
|
||||
return ipAddresString + ":" + this.Port.ToString();
|
||||
return ipAddresString + ":" + Port.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
47
MediaBrowser.Model/Services/IHttpResult.cs
Normal file
47
MediaBrowser.Model/Services/IHttpResult.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
10
MediaBrowser.Model/Text/ITextEncoding.cs
Normal file
10
MediaBrowser.Model/Text/ITextEncoding.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Text;
|
||||
|
||||
namespace MediaBrowser.Model.Text
|
||||
{
|
||||
public interface ITextEncoding
|
||||
{
|
||||
Encoding GetASCIIEncoding();
|
||||
Encoding GetFileEncoding(string path);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.Text;
|
||||
|
||||
namespace MediaBrowser.Model.TextEncoding
|
||||
{
|
||||
public interface IEncoding
|
||||
{
|
||||
byte[] GetASCIIBytes(string text);
|
||||
string GetASCIIString(byte[] bytes, int startIndex, int length);
|
||||
|
||||
Encoding GetFileEncoding(string path);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user