Merge pull request #2274 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-11-05 15:36:32 -04:00 committed by GitHub
commit 36c01cfc76
107 changed files with 734 additions and 717 deletions

View File

@ -29,6 +29,7 @@ using MediaBrowser.Common.Extensions;
using Emby.Common.Implementations.Cryptography; using Emby.Common.Implementations.Cryptography;
using Emby.Common.Implementations.Diagnostics; using Emby.Common.Implementations.Diagnostics;
using Emby.Common.Implementations.Net; using Emby.Common.Implementations.Net;
using Emby.Common.Implementations.EnvironmentInfo;
using Emby.Common.Implementations.Threading; using Emby.Common.Implementations.Threading;
using MediaBrowser.Common; using MediaBrowser.Common;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
@ -171,6 +172,8 @@ namespace Emby.Common.Implementations
protected ICryptographyProvider CryptographyProvider = new CryptographyProvider(); protected ICryptographyProvider CryptographyProvider = new CryptographyProvider();
protected IEnvironmentInfo EnvironmentInfo = new Emby.Common.Implementations.EnvironmentInfo.EnvironmentInfo();
private DeviceId _deviceId; private DeviceId _deviceId;
public string SystemId public string SystemId
{ {
@ -187,16 +190,7 @@ namespace Emby.Common.Implementations
public virtual string OperatingSystemDisplayName public virtual string OperatingSystemDisplayName
{ {
get get { return EnvironmentInfo.OperatingSystemName; }
{
#if NET46
return Environment.OSVersion.VersionString;
#endif
#if NETSTANDARD1_6
return System.Runtime.InteropServices.RuntimeInformation.OSDescription;
#endif
return "Operating System";
}
} }
public IMemoryStreamProvider MemoryStreamProvider { get; set; } public IMemoryStreamProvider MemoryStreamProvider { get; set; }
@ -216,7 +210,7 @@ namespace Emby.Common.Implementations
// hack alert, until common can target .net core // hack alert, until common can target .net core
BaseExtensions.CryptographyProvider = CryptographyProvider; BaseExtensions.CryptographyProvider = CryptographyProvider;
XmlSerializer = new XmlSerializer(fileSystem, logManager.GetLogger("XmlSerializer")); XmlSerializer = new MyXmlSerializer(fileSystem, logManager.GetLogger("XmlSerializer"));
FailedAssemblies = new List<string>(); FailedAssemblies = new List<string>();
ApplicationPaths = applicationPaths; ApplicationPaths = applicationPaths;
@ -534,6 +528,7 @@ return null;
RegisterSingleInstance(Logger); RegisterSingleInstance(Logger);
RegisterSingleInstance(TaskManager); RegisterSingleInstance(TaskManager);
RegisterSingleInstance(EnvironmentInfo);
RegisterSingleInstance(FileSystemManager); RegisterSingleInstance(FileSystemManager);

View File

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using MediaBrowser.Model.System;
namespace Emby.Common.Implementations.EnvironmentInfo
{
public class EnvironmentInfo : IEnvironmentInfo
{
public MediaBrowser.Model.System.OperatingSystem OperatingSystem
{
get
{
#if NET46
switch (Environment.OSVersion.Platform)
{
case PlatformID.MacOSX:
return MediaBrowser.Model.System.OperatingSystem.OSX;
case PlatformID.Win32NT:
return MediaBrowser.Model.System.OperatingSystem.Windows;
case PlatformID.Unix:
return MediaBrowser.Model.System.OperatingSystem.Linux;
}
#elif NETSTANDARD1_6
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return OperatingSystem.OSX;
}
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return OperatingSystem.Windows;
}
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return OperatingSystem.Linux;
}
#endif
return MediaBrowser.Model.System.OperatingSystem.Windows;
}
}
public string OperatingSystemName
{
get
{
#if NET46
return Environment.OSVersion.Platform.ToString();
#elif NETSTANDARD1_6
return System.Runtime.InteropServices.RuntimeInformation.OSDescription;
#endif
return "Operating System";
}
}
public string OperatingSystemVersion
{
get
{
#if NET46
return Environment.OSVersion.Version.ToString() + " " + Environment.OSVersion.ServicePack.ToString();
#elif NETSTANDARD1_6
return System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription;
#endif
return "1.0";
}
}
}
}

View File

@ -37,22 +37,44 @@ namespace Emby.Common.Implementations.Net
#region ISocketFactory Members #region ISocketFactory Members
/// <summary> /// <summary>
/// Creates a new UDP socket that is a member of the SSDP multicast local admin group and binds it to the specified local port. /// Creates a new UDP socket and binds it to the specified local port.
/// </summary> /// </summary>
/// <param name="localPort">An integer specifying the local port to bind the socket to.</param> /// <param name="localPort">An integer specifying the local port to bind the socket to.</param>
/// <returns>An implementation of the <see cref="IUdpSocket"/> interface used by RSSDP components to perform socket operations.</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "The purpose of this method is to create and returns a disposable result, it is up to the caller to dispose it when they are done with it.")]
public IUdpSocket CreateUdpSocket(int localPort) public IUdpSocket CreateUdpSocket(int localPort)
{ {
if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", "localPort"); if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", "localPort");
var retVal = new Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp); var retVal = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
try
{
retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
return new UdpSocket(retVal, localPort, _LocalIP);
}
catch
{
if (retVal != null)
retVal.Dispose();
throw;
}
}
/// <summary>
/// Creates a new UDP socket that is a member of the SSDP multicast local admin group and binds it to the specified local port.
/// </summary>
/// <param name="localPort">An integer specifying the local port to bind the socket to.</param>
/// <returns>An implementation of the <see cref="IUdpSocket"/> interface used by RSSDP components to perform socket operations.</returns>
public IUdpSocket CreateSsdpUdpSocket(int localPort)
{
if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", "localPort");
var retVal = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
try try
{ {
retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 4); retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 4);
retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.255.255.250"), _LocalIP)); retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.255.255.250"), _LocalIP));
return new UdpSocket(retVal, localPort, _LocalIP.ToString()); return new UdpSocket(retVal, localPort, _LocalIP);
} }
catch catch
{ {
@ -70,7 +92,6 @@ namespace Emby.Common.Implementations.Net
/// <param name="multicastTimeToLive">The multicast time to live value for the socket.</param> /// <param name="multicastTimeToLive">The multicast time to live value for the socket.</param>
/// <param name="localPort">The number of the local port to bind to.</param> /// <param name="localPort">The number of the local port to bind to.</param>
/// <returns></returns> /// <returns></returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "ip"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "The purpose of this method is to create and returns a disposable result, it is up to the caller to dispose it when they are done with it.")]
public IUdpSocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort) public IUdpSocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort)
{ {
if (ipAddress == null) throw new ArgumentNullException("ipAddress"); if (ipAddress == null) throw new ArgumentNullException("ipAddress");
@ -97,7 +118,7 @@ namespace Emby.Common.Implementations.Net
retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse(ipAddress), _LocalIP)); retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse(ipAddress), _LocalIP));
retVal.MulticastLoopback = true; retVal.MulticastLoopback = true;
return new UdpSocket(retVal, localPort, _LocalIP.ToString()); return new UdpSocket(retVal, localPort, _LocalIP);
} }
catch catch
{ {

View File

@ -17,26 +17,20 @@ namespace Emby.Common.Implementations.Net
#region Fields #region Fields
private System.Net.Sockets.Socket _Socket; private Socket _Socket;
private int _LocalPort; private int _LocalPort;
#endregion #endregion
#region Constructors #region Constructors
public UdpSocket(System.Net.Sockets.Socket socket, int localPort, string ipAddress) public UdpSocket(Socket socket, int localPort, IPAddress ip)
{ {
if (socket == null) throw new ArgumentNullException("socket"); if (socket == null) throw new ArgumentNullException("socket");
_Socket = socket; _Socket = socket;
_LocalPort = localPort; _LocalPort = localPort;
IPAddress ip = null;
if (String.IsNullOrEmpty(ipAddress))
ip = IPAddress.Any;
else
ip = IPAddress.Parse(ipAddress);
_Socket.Bind(new IPEndPoint(ip, _LocalPort)); _Socket.Bind(new IPEndPoint(ip, _LocalPort));
if (_LocalPort == 0) if (_LocalPort == 0)
_LocalPort = (_Socket.LocalEndPoint as IPEndPoint).Port; _LocalPort = (_Socket.LocalEndPoint as IPEndPoint).Port;
@ -46,18 +40,18 @@ namespace Emby.Common.Implementations.Net
#region IUdpSocket Members #region IUdpSocket Members
public Task<ReceivedUdpData> ReceiveAsync() public Task<SocketReceiveResult> ReceiveAsync()
{ {
ThrowIfDisposed(); ThrowIfDisposed();
var tcs = new TaskCompletionSource<ReceivedUdpData>(); var tcs = new TaskCompletionSource<SocketReceiveResult>();
System.Net.EndPoint receivedFromEndPoint = new IPEndPoint(IPAddress.Any, 0); EndPoint receivedFromEndPoint = new IPEndPoint(IPAddress.Any, 0);
var state = new AsyncReceiveState(_Socket, receivedFromEndPoint); var state = new AsyncReceiveState(_Socket, receivedFromEndPoint);
state.TaskCompletionSource = tcs; state.TaskCompletionSource = tcs;
#if NETSTANDARD1_6 #if NETSTANDARD1_6
_Socket.ReceiveFromAsync(new System.ArraySegment<Byte>(state.Buffer), System.Net.Sockets.SocketFlags.None, state.EndPoint) _Socket.ReceiveFromAsync(new ArraySegment<Byte>(state.Buffer),SocketFlags.None, state.EndPoint)
.ContinueWith((task, asyncState) => .ContinueWith((task, asyncState) =>
{ {
if (task.Status != TaskStatus.Faulted) if (task.Status != TaskStatus.Faulted)
@ -68,28 +62,36 @@ namespace Emby.Common.Implementations.Net
} }
}, state); }, state);
#else #else
_Socket.BeginReceiveFrom(state.Buffer, 0, state.Buffer.Length, System.Net.Sockets.SocketFlags.None, ref state.EndPoint, new AsyncCallback(this.ProcessResponse), state); _Socket.BeginReceiveFrom(state.Buffer, 0, state.Buffer.Length, SocketFlags.None, ref state.EndPoint, new AsyncCallback(this.ProcessResponse), state);
#endif #endif
return tcs.Task; return tcs.Task;
} }
public Task SendTo(byte[] messageData, IpEndPointInfo endPoint) public Task SendAsync(byte[] buffer, int size, IpEndPointInfo endPoint)
{ {
ThrowIfDisposed(); ThrowIfDisposed();
if (messageData == null) throw new ArgumentNullException("messageData"); if (buffer == null) throw new ArgumentNullException("messageData");
if (endPoint == null) throw new ArgumentNullException("endPoint"); if (endPoint == null) throw new ArgumentNullException("endPoint");
#if NETSTANDARD1_6 #if NETSTANDARD1_6
_Socket.SendTo(messageData, new System.Net.IPEndPoint(IPAddress.Parse(endPoint.IpAddress.ToString()), endPoint.Port));
if (size != buffer.Length)
{
byte[] copy = new byte[size];
Buffer.BlockCopy(buffer, 0, copy, 0, size);
buffer = copy;
}
_Socket.SendTo(buffer, new IPEndPoint(IPAddress.Parse(endPoint.IpAddress.ToString()), endPoint.Port));
return Task.FromResult(true); return Task.FromResult(true);
#else #else
var taskSource = new TaskCompletionSource<bool>(); var taskSource = new TaskCompletionSource<bool>();
try try
{ {
_Socket.BeginSendTo(messageData, 0, messageData.Length, SocketFlags.None, new System.Net.IPEndPoint(IPAddress.Parse(endPoint.IpAddress.ToString()), endPoint.Port), result => _Socket.BeginSendTo(buffer, 0, size, SocketFlags.None, new System.Net.IPEndPoint(IPAddress.Parse(endPoint.IpAddress.ToString()), endPoint.Port), result =>
{ {
try try
{ {
@ -100,29 +102,10 @@ namespace Emby.Common.Implementations.Net
{ {
taskSource.TrySetException(ex); taskSource.TrySetException(ex);
} }
catch (ObjectDisposedException ex)
{
taskSource.TrySetException(ex);
}
catch (InvalidOperationException ex)
{
taskSource.TrySetException(ex);
}
catch (SecurityException ex)
{
taskSource.TrySetException(ex);
}
}, null); }, null);
} }
catch (SocketException ex) catch (Exception ex)
{
taskSource.TrySetException(ex);
}
catch (ObjectDisposedException ex)
{
taskSource.TrySetException(ex);
}
catch (SecurityException ex)
{ {
taskSource.TrySetException(ex); taskSource.TrySetException(ex);
} }
@ -151,7 +134,6 @@ namespace Emby.Common.Implementations.Net
#region Private Methods #region Private Methods
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Exceptions via task methods should be reported by task completion source, so this should be ok.")]
private static void ProcessResponse(AsyncReceiveState state, Func<int> receiveData) private static void ProcessResponse(AsyncReceiveState state, Func<int> receiveData)
{ {
try try
@ -160,11 +142,11 @@ namespace Emby.Common.Implementations.Net
var ipEndPoint = state.EndPoint as IPEndPoint; var ipEndPoint = state.EndPoint as IPEndPoint;
state.TaskCompletionSource.SetResult( state.TaskCompletionSource.SetResult(
new ReceivedUdpData() new SocketReceiveResult()
{ {
Buffer = state.Buffer, Buffer = state.Buffer,
ReceivedBytes = bytesRead, ReceivedBytes = bytesRead,
ReceivedFrom = ToIpEndPointInfo(ipEndPoint) RemoteEndPoint = ToIpEndPointInfo(ipEndPoint)
} }
); );
} }
@ -204,7 +186,6 @@ namespace Emby.Common.Implementations.Net
}; };
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Exceptions via task methods should be reported by task completion source, so this should be ok.")]
private void ProcessResponse(IAsyncResult asyncResult) private void ProcessResponse(IAsyncResult asyncResult)
{ {
#if NET46 #if NET46
@ -215,11 +196,11 @@ namespace Emby.Common.Implementations.Net
var ipEndPoint = state.EndPoint as IPEndPoint; var ipEndPoint = state.EndPoint as IPEndPoint;
state.TaskCompletionSource.SetResult( state.TaskCompletionSource.SetResult(
new ReceivedUdpData() new SocketReceiveResult
{ {
Buffer = state.Buffer, Buffer = state.Buffer,
ReceivedBytes = bytesRead, ReceivedBytes = bytesRead,
ReceivedFrom = ToIpEndPointInfo(ipEndPoint) RemoteEndPoint = ToIpEndPointInfo(ipEndPoint)
} }
); );
} }
@ -247,7 +228,7 @@ namespace Emby.Common.Implementations.Net
private class AsyncReceiveState private class AsyncReceiveState
{ {
public AsyncReceiveState(System.Net.Sockets.Socket socket, EndPoint endPoint) public AsyncReceiveState(Socket socket, EndPoint endPoint)
{ {
this.Socket = socket; this.Socket = socket;
this.EndPoint = endPoint; this.EndPoint = endPoint;
@ -256,9 +237,9 @@ namespace Emby.Common.Implementations.Net
public EndPoint EndPoint; public EndPoint EndPoint;
public byte[] Buffer = new byte[8192]; public byte[] Buffer = new byte[8192];
public System.Net.Sockets.Socket Socket { get; private set; } public Socket Socket { get; private set; }
public TaskCompletionSource<ReceivedUdpData> TaskCompletionSource { get; set; } public TaskCompletionSource<SocketReceiveResult> TaskCompletionSource { get; set; }
} }

View File

@ -8,6 +8,7 @@ using System.Net.NetworkInformation;
using System.Net.Sockets; using System.Net.Sockets;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Net;
namespace Emby.Common.Implementations.Networking namespace Emby.Common.Implementations.Networking
{ {
@ -21,7 +22,7 @@ namespace Emby.Common.Implementations.Networking
Logger = logger; Logger = logger;
} }
private List<IPAddress> _localIpAddresses; private List<IPAddress> _localIpAddresses;
private readonly object _localIpAddressSyncLock = new object(); private readonly object _localIpAddressSyncLock = new object();
/// <summary> /// <summary>
@ -50,24 +51,24 @@ namespace Emby.Common.Implementations.Networking
return _localIpAddresses; return _localIpAddresses;
} }
private IEnumerable<IPAddress> GetLocalIpAddressesInternal() private IEnumerable<IPAddress> GetLocalIpAddressesInternal()
{ {
var list = GetIPsDefault() var list = GetIPsDefault()
.ToList(); .ToList();
if (list.Count == 0) if (list.Count == 0)
{ {
list.AddRange(GetLocalIpAddressesFallback().Result); list.AddRange(GetLocalIpAddressesFallback().Result);
} }
return list.Where(FilterIpAddress).DistinctBy(i => i.ToString()); return list.Where(FilterIpAddress).DistinctBy(i => i.ToString());
} }
private bool FilterIpAddress(IPAddress address) private bool FilterIpAddress(IPAddress address)
{ {
var addressString = address.ToString (); var addressString = address.ToString();
if (addressString.StartsWith("169.", StringComparison.OrdinalIgnoreCase)) if (addressString.StartsWith("169.", StringComparison.OrdinalIgnoreCase))
{ {
return false; return false;
} }
@ -155,12 +156,12 @@ namespace Emby.Common.Implementations.Networking
{ {
var prefix = addressString.Substring(0, lengthMatch); var prefix = addressString.Substring(0, lengthMatch);
if (GetLocalIpAddresses().Any(i => i.ToString().StartsWith(prefix, StringComparison.OrdinalIgnoreCase))) if (GetLocalIpAddresses().Any(i => i.ToString().StartsWith(prefix, StringComparison.OrdinalIgnoreCase)))
{ {
return true; return true;
} }
} }
} }
else if (resolveHost) else if (resolveHost)
{ {
Uri uri; Uri uri;
@ -199,45 +200,50 @@ namespace Emby.Common.Implementations.Networking
return Dns.GetHostAddressesAsync(hostName); return Dns.GetHostAddressesAsync(hostName);
} }
private List<IPAddress> GetIPsDefault() private List<IPAddress> GetIPsDefault()
{ {
NetworkInterface[] interfaces; NetworkInterface[] interfaces;
try try
{ {
interfaces = NetworkInterface.GetAllNetworkInterfaces(); var validStatuses = new[] { OperationalStatus.Up, OperationalStatus.Unknown };
}
catch (Exception ex)
{
Logger.ErrorException("Error in GetAllNetworkInterfaces", ex);
return new List<IPAddress>();
}
return interfaces.SelectMany(network => { interfaces = NetworkInterface.GetAllNetworkInterfaces()
.Where(i => validStatuses.Contains(i.OperationalStatus))
.ToArray();
}
catch (Exception ex)
{
Logger.ErrorException("Error in GetAllNetworkInterfaces", ex);
return new List<IPAddress>();
}
try return interfaces.SelectMany(network =>
{ {
try
{
Logger.Debug("Querying interface: {0}. Type: {1}. Status: {2}", network.Name, network.NetworkInterfaceType, network.OperationalStatus); Logger.Debug("Querying interface: {0}. Type: {1}. Status: {2}", network.Name, network.NetworkInterfaceType, network.OperationalStatus);
var properties = network.GetIPProperties(); var properties = network.GetIPProperties();
return properties.UnicastAddresses return properties.UnicastAddresses
.Where(i => i.IsDnsEligible) .Where(i => i.IsDnsEligible)
.Select(i => i.Address) .Select(i => i.Address)
.Where(i => i.AddressFamily == AddressFamily.InterNetwork) .Where(i => i.AddressFamily == AddressFamily.InterNetwork)
.ToList(); .ToList();
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.ErrorException("Error querying network interface", ex); Logger.ErrorException("Error querying network interface", ex);
return new List<IPAddress>(); return new List<IPAddress>();
} }
}).DistinctBy(i => i.ToString()) }).DistinctBy(i => i.ToString())
.ToList(); .ToList();
} }
private async Task<IEnumerable<IPAddress>> GetLocalIpAddressesFallback() private async Task<IEnumerable<IPAddress>> GetLocalIpAddressesFallback()
{ {
var host = await Dns.GetHostEntryAsync(Dns.GetHostName()).ConfigureAwait(false); var host = await Dns.GetHostEntryAsync(Dns.GetHostName()).ConfigureAwait(false);
@ -309,7 +315,7 @@ namespace Emby.Common.Implementations.Networking
string[] values = endpointstring.Split(new char[] { ':' }); string[] values = endpointstring.Split(new char[] { ':' });
IPAddress ipaddy; IPAddress ipaddy;
int port = -1; int port = -1;
//check if we have an IPv6 or ports //check if we have an IPv6 or ports
if (values.Length <= 2) // ipv4 or hostname if (values.Length <= 2) // ipv4 or hostname
{ {
@ -382,5 +388,35 @@ namespace Emby.Common.Implementations.Networking
return hosts[0]; return hosts[0];
} }
public IpAddressInfo ParseIpAddress(string ipAddress)
{
IpAddressInfo info;
if (TryParseIpAddress(ipAddress, out info))
{
return info;
}
throw new ArgumentException("Invalid ip address: " + ipAddress);
}
public bool TryParseIpAddress(string ipAddress, out IpAddressInfo ipAddressInfo)
{
IPAddress address;
if (IPAddress.TryParse(ipAddress, out address))
{
ipAddressInfo = new IpAddressInfo
{
Address = address.ToString(),
IsIpv6 = address.AddressFamily == AddressFamily.InterNetworkV6
};
return true;
}
ipAddressInfo = null;
return false;
}
} }
} }

View File

@ -4,6 +4,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
using System.Xml.Serialization;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
@ -13,12 +14,12 @@ namespace Emby.Common.Implementations.Serialization
/// <summary> /// <summary>
/// Provides a wrapper around third party xml serialization. /// Provides a wrapper around third party xml serialization.
/// </summary> /// </summary>
public class XmlSerializer : IXmlSerializer public class MyXmlSerializer : IXmlSerializer
{ {
private readonly IFileSystem _fileSystem; private readonly IFileSystem _fileSystem;
private readonly ILogger _logger; private readonly ILogger _logger;
public XmlSerializer(IFileSystem fileSystem, ILogger logger) public MyXmlSerializer(IFileSystem fileSystem, ILogger logger)
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
_logger = logger; _logger = logger;
@ -26,18 +27,18 @@ namespace Emby.Common.Implementations.Serialization
// Need to cache these // Need to cache these
// http://dotnetcodebox.blogspot.com/2013/01/xmlserializer-class-may-result-in.html // http://dotnetcodebox.blogspot.com/2013/01/xmlserializer-class-may-result-in.html
private readonly Dictionary<string, System.Xml.Serialization.XmlSerializer> _serializers = private readonly Dictionary<string, XmlSerializer> _serializers =
new Dictionary<string, System.Xml.Serialization.XmlSerializer>(); new Dictionary<string, XmlSerializer>();
private System.Xml.Serialization.XmlSerializer GetSerializer(Type type) private XmlSerializer GetSerializer(Type type)
{ {
var key = type.FullName; var key = type.FullName;
lock (_serializers) lock (_serializers)
{ {
System.Xml.Serialization.XmlSerializer serializer; XmlSerializer serializer;
if (!_serializers.TryGetValue(key, out serializer)) if (!_serializers.TryGetValue(key, out serializer))
{ {
serializer = new System.Xml.Serialization.XmlSerializer(type); serializer = new XmlSerializer(type);
_serializers[key] = serializer; _serializers[key] = serializer;
} }
return serializer; return serializer;
@ -80,7 +81,7 @@ namespace Emby.Common.Implementations.Serialization
#if NET46 #if NET46
using (var writer = new XmlTextWriter(stream, null)) using (var writer = new XmlTextWriter(stream, null))
{ {
writer.Formatting = System.Xml.Formatting.Indented; writer.Formatting = Formatting.Indented;
SerializeToWriter(obj, writer); SerializeToWriter(obj, writer);
} }
#else #else

View File

@ -12,15 +12,14 @@
"System.IO": "4.0.0.0", "System.IO": "4.0.0.0",
"System.Net": "4.0.0.0", "System.Net": "4.0.0.0",
"System.Net.Http": "4.0.0.0", "System.Net.Http": "4.0.0.0",
"System.Net.Http.WebRequest": "4.0.0.0",
"System.Net.Primitives": "4.0.0.0", "System.Net.Primitives": "4.0.0.0",
"System.Net.Http.WebRequest": "4.0.0.0",
"System.Runtime": "4.0.0.0", "System.Runtime": "4.0.0.0",
"System.Runtime.Extensions": "4.0.0.0", "System.Runtime.Extensions": "4.0.0.0",
"System.Text.Encoding": "4.0.0.0", "System.Text.Encoding": "4.0.0.0",
"System.Threading": "4.0.0.0", "System.Threading": "4.0.0.0",
"System.Threading.Tasks": "4.0.0.0", "System.Threading.Tasks": "4.0.0.0",
"System.Xml": "4.0.0.0", "System.Xml.ReaderWriter": "4.0.0"
"System.Xml.Serialization": "4.0.0.0"
}, },
"dependencies": { "dependencies": {
"SimpleInjector": "3.2.4", "SimpleInjector": "3.2.4",
@ -30,7 +29,8 @@
}, },
"MediaBrowser.Common": { "MediaBrowser.Common": {
"target": "project" "target": "project"
} } }
}
}, },
"netstandard1.6": { "netstandard1.6": {
"imports": "dnxcore50", "imports": "dnxcore50",
@ -40,6 +40,7 @@
"System.Diagnostics.Process": "4.1.0", "System.Diagnostics.Process": "4.1.0",
"System.Threading.Timer": "4.0.1", "System.Threading.Timer": "4.0.1",
"System.Net.Requests": "4.0.11", "System.Net.Requests": "4.0.11",
"System.Xml.ReaderWriter": "4.0.11",
"System.Xml.XmlSerializer": "4.0.11", "System.Xml.XmlSerializer": "4.0.11",
"System.Net.Http": "4.1.0", "System.Net.Http": "4.1.0",
"System.Net.Primitives": "4.0.11", "System.Net.Primitives": "4.0.11",

View File

@ -104,6 +104,8 @@ namespace Emby.Dlna.Didl
writer.WriteStartElement(string.Empty, "item", NS_DIDL); writer.WriteStartElement(string.Empty, "item", NS_DIDL);
AddGeneralProperties(item, null, context, writer, filter);
writer.WriteAttributeString("restricted", "1"); writer.WriteAttributeString("restricted", "1");
writer.WriteAttributeString("id", clientId); writer.WriteAttributeString("id", clientId);
@ -122,8 +124,6 @@ namespace Emby.Dlna.Didl
//AddBookmarkInfo(item, user, element); //AddBookmarkInfo(item, user, element);
AddGeneralProperties(item, null, context, writer, filter);
// refID? // refID?
// storeAttribute(itemNode, object, ClassProperties.REF_ID, false); // storeAttribute(itemNode, object, ClassProperties.REF_ID, false);
@ -501,6 +501,8 @@ namespace Emby.Dlna.Didl
{ {
writer.WriteStartElement(string.Empty, "container", NS_DIDL); writer.WriteStartElement(string.Empty, "container", NS_DIDL);
AddGeneralProperties(folder, stubType, context, writer, filter);
writer.WriteAttributeString("restricted", "0"); writer.WriteAttributeString("restricted", "0");
writer.WriteAttributeString("searchable", "1"); writer.WriteAttributeString("searchable", "1");
writer.WriteAttributeString("childCount", childCount.ToString(_usCulture)); writer.WriteAttributeString("childCount", childCount.ToString(_usCulture));
@ -534,8 +536,6 @@ namespace Emby.Dlna.Didl
} }
} }
AddCommonFields(folder, stubType, null, writer, filter);
AddCover(folder, context, stubType, writer); AddCover(folder, context, stubType, writer);
writer.WriteEndElement(); writer.WriteEndElement();

View File

@ -20,6 +20,7 @@ using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Net; using MediaBrowser.Model.Net;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Threading; using MediaBrowser.Model.Threading;
using Rssdp; using Rssdp;
using Rssdp.Infrastructure; using Rssdp.Infrastructure;
@ -52,7 +53,7 @@ namespace Emby.Dlna.Main
private readonly ITimerFactory _timerFactory; private readonly ITimerFactory _timerFactory;
private readonly ISocketFactory _socketFactory; private readonly ISocketFactory _socketFactory;
private readonly IEnvironmentInfo _environmentInfo;
public DlnaEntryPoint(IServerConfigurationManager config, public DlnaEntryPoint(IServerConfigurationManager config,
ILogManager logManager, ILogManager logManager,
@ -66,7 +67,7 @@ namespace Emby.Dlna.Main
IUserDataManager userDataManager, IUserDataManager userDataManager,
ILocalizationManager localization, ILocalizationManager localization,
IMediaSourceManager mediaSourceManager, IMediaSourceManager mediaSourceManager,
IDeviceDiscovery deviceDiscovery, IMediaEncoder mediaEncoder, ISocketFactory socketFactory, ITimerFactory timerFactory) IDeviceDiscovery deviceDiscovery, IMediaEncoder mediaEncoder, ISocketFactory socketFactory, ITimerFactory timerFactory, IEnvironmentInfo environmentInfo)
{ {
_config = config; _config = config;
_appHost = appHost; _appHost = appHost;
@ -83,6 +84,7 @@ namespace Emby.Dlna.Main
_mediaEncoder = mediaEncoder; _mediaEncoder = mediaEncoder;
_socketFactory = socketFactory; _socketFactory = socketFactory;
_timerFactory = timerFactory; _timerFactory = timerFactory;
_environmentInfo = environmentInfo;
_logger = logManager.GetLogger("Dlna"); _logger = logManager.GetLogger("Dlna");
} }
@ -169,7 +171,7 @@ namespace Emby.Dlna.Main
private void StartPublishing() private void StartPublishing()
{ {
SsdpDevicePublisherBase.LogFunction = LogMessage; SsdpDevicePublisherBase.LogFunction = LogMessage;
_Publisher = new SsdpDevicePublisher(_socketFactory, _timerFactory, "Windows", "10"); _Publisher = new SsdpDevicePublisher(_socketFactory, _timerFactory, _environmentInfo.OperatingSystemName, _environmentInfo.OperatingSystemVersion);
} }
private void StartDeviceDiscovery() private void StartDeviceDiscovery()
@ -238,6 +240,8 @@ namespace Emby.Dlna.Main
var addresses = (await _appHost.GetLocalIpAddresses().ConfigureAwait(false)).ToList(); var addresses = (await _appHost.GetLocalIpAddresses().ConfigureAwait(false)).ToList();
var udn = CreateUuid(_appHost.SystemId);
foreach (var address in addresses) foreach (var address in addresses)
{ {
//if (IPAddress.IsLoopback(address)) //if (IPAddress.IsLoopback(address))
@ -248,8 +252,6 @@ namespace Emby.Dlna.Main
var addressString = address.ToString(); var addressString = address.ToString();
var udn = CreateUuid(addressString);
var fullService = "urn:schemas-upnp-org:device:MediaServer:1"; var fullService = "urn:schemas-upnp-org:device:MediaServer:1";
_logger.Info("Registering publisher for {0} on {1}", fullService, addressString); _logger.Info("Registering publisher for {0} on {1}", fullService, addressString);
@ -297,7 +299,12 @@ namespace Emby.Dlna.Main
private string CreateUuid(string text) private string CreateUuid(string text)
{ {
return text.GetMD5().ToString("N"); Guid guid;
if (!Guid.TryParse(text, out guid))
{
guid = text.GetMD5();
}
return guid.ToString("N");
} }
private void SetProperies(SsdpDevice device, string fullDeviceType) private void SetProperies(SsdpDevice device, string fullDeviceType)

View File

@ -228,7 +228,7 @@ namespace Emby.Dlna.Service
var headers = string.Join(", ", request.Headers.Select(i => string.Format("{0}={1}", i.Key, i.Value)).ToArray()); var headers = string.Join(", ", request.Headers.Select(i => string.Format("{0}={1}", i.Key, i.Value)).ToArray());
builder.AppendFormat("Headers: {0}", headers); builder.AppendFormat("Headers: {0}", headers);
builder.AppendLine(); builder.AppendLine();
builder.Append(request.InputXml); //builder.Append(request.InputXml);
Logger.LogMultiline("Control request", LogSeverity.Debug, builder); Logger.LogMultiline("Control request", LogSeverity.Debug, builder);
} }

View File

@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace MediaBrowser.Server.Implementations.Connect namespace Emby.Server.Implementations.Connect
{ {
public class ConnectData public class ConnectData
{ {

View File

@ -7,16 +7,12 @@ using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Net; using MediaBrowser.Model.Net;
using System; using System;
using System.IO; using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Threading; using MediaBrowser.Model.Threading;
namespace MediaBrowser.Server.Implementations.Connect namespace Emby.Server.Implementations.Connect
{ {
public class ConnectEntryPoint : IServerEntryPoint public class ConnectEntryPoint : IServerEntryPoint
{ {
@ -59,7 +55,7 @@ namespace MediaBrowser.Server.Implementations.Connect
private async void TimerCallback(object state) private async void TimerCallback(object state)
{ {
IPAddress validIpAddress = null; IpAddressInfo validIpAddress = null;
foreach (var ipLookupUrl in _ipLookups) foreach (var ipLookupUrl in _ipLookups)
{ {
@ -68,7 +64,7 @@ namespace MediaBrowser.Server.Implementations.Connect
validIpAddress = await GetIpAddress(ipLookupUrl).ConfigureAwait(false); validIpAddress = await GetIpAddress(ipLookupUrl).ConfigureAwait(false);
// Try to find the ipv4 address, if present // Try to find the ipv4 address, if present
if (validIpAddress.AddressFamily == AddressFamily.InterNetwork) if (!validIpAddress.IsIpv6)
{ {
break; break;
} }
@ -83,7 +79,7 @@ namespace MediaBrowser.Server.Implementations.Connect
} }
// If this produced an ipv6 address, try again // If this produced an ipv6 address, try again
if (validIpAddress != null && validIpAddress.AddressFamily == AddressFamily.InterNetworkV6) if (validIpAddress != null && validIpAddress.IsIpv6)
{ {
foreach (var ipLookupUrl in _ipLookups) foreach (var ipLookupUrl in _ipLookups)
{ {
@ -92,7 +88,7 @@ namespace MediaBrowser.Server.Implementations.Connect
var newAddress = await GetIpAddress(ipLookupUrl, true).ConfigureAwait(false); var newAddress = await GetIpAddress(ipLookupUrl, true).ConfigureAwait(false);
// Try to find the ipv4 address, if present // Try to find the ipv4 address, if present
if (newAddress.AddressFamily == AddressFamily.InterNetwork) if (!newAddress.IsIpv6)
{ {
validIpAddress = newAddress; validIpAddress = newAddress;
break; break;
@ -115,7 +111,7 @@ namespace MediaBrowser.Server.Implementations.Connect
} }
} }
private async Task<IPAddress> GetIpAddress(string lookupUrl, bool preferIpv4 = false) private async Task<IpAddressInfo> GetIpAddress(string lookupUrl, bool preferIpv4 = false)
{ {
// Sometimes whatismyipaddress might fail, but it won't do us any good having users raise alarms over it. // Sometimes whatismyipaddress might fail, but it won't do us any good having users raise alarms over it.
var logErrors = false; var logErrors = false;
@ -140,7 +136,7 @@ namespace MediaBrowser.Server.Implementations.Connect
{ {
var addressString = await reader.ReadToEndAsync().ConfigureAwait(false); var addressString = await reader.ReadToEndAsync().ConfigureAwait(false);
return IPAddress.Parse(addressString); return _networkManager.ParseIpAddress(addressString);
} }
} }
} }
@ -150,7 +146,7 @@ namespace MediaBrowser.Server.Implementations.Connect
get { return Path.Combine(_appPaths.DataPath, "wan.txt"); } get { return Path.Combine(_appPaths.DataPath, "wan.txt"); }
} }
private void CacheAddress(IPAddress address) private void CacheAddress(IpAddressInfo address)
{ {
var path = CacheFilePath; var path = CacheFilePath;
@ -174,9 +170,9 @@ namespace MediaBrowser.Server.Implementations.Connect
try try
{ {
var endpoint = _fileSystem.ReadAllText(path, Encoding.UTF8); var endpoint = _fileSystem.ReadAllText(path, Encoding.UTF8);
IPAddress ipAddress; IpAddressInfo ipAddress;
if (IPAddress.TryParse(endpoint, out ipAddress)) if (_networkManager.TryParseIpAddress(endpoint, out ipAddress))
{ {
((ConnectManager)_connectManager).OnWanAddressResolved(ipAddress); ((ConnectManager)_connectManager).OnWanAddressResolved(ipAddress);
} }

View File

@ -19,16 +19,13 @@ using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Sockets;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
namespace MediaBrowser.Server.Implementations.Connect namespace Emby.Server.Implementations.Connect
{ {
public class ConnectManager : IConnectManager public class ConnectManager : IConnectManager
{ {
@ -57,7 +54,7 @@ namespace MediaBrowser.Server.Implementations.Connect
get { return _data.AccessKey; } get { return _data.AccessKey; }
} }
private IPAddress DiscoveredWanIpAddress { get; set; } private IpAddressInfo DiscoveredWanIpAddress { get; set; }
public string WanIpAddress public string WanIpAddress
{ {
@ -77,7 +74,7 @@ namespace MediaBrowser.Server.Implementations.Connect
if (string.IsNullOrWhiteSpace(address) && DiscoveredWanIpAddress != null) if (string.IsNullOrWhiteSpace(address) && DiscoveredWanIpAddress != null)
{ {
if (DiscoveredWanIpAddress.AddressFamily == AddressFamily.InterNetworkV6) if (DiscoveredWanIpAddress.IsIpv6)
{ {
address = "[" + DiscoveredWanIpAddress + "]"; address = "[" + DiscoveredWanIpAddress + "]";
} }
@ -148,7 +145,7 @@ namespace MediaBrowser.Server.Implementations.Connect
_config.ConfigurationUpdated += _config_ConfigurationUpdated; _config.ConfigurationUpdated += _config_ConfigurationUpdated;
} }
internal void OnWanAddressResolved(IPAddress address) internal void OnWanAddressResolved(IpAddressInfo address)
{ {
DiscoveredWanIpAddress = address; DiscoveredWanIpAddress = address;

View File

@ -1,7 +1,7 @@
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Connect; using MediaBrowser.Model.Connect;
namespace MediaBrowser.Server.Implementations.Connect namespace Emby.Server.Implementations.Connect
{ {
public class ServerRegistrationResponse public class ServerRegistrationResponse
{ {

View File

@ -1,6 +1,6 @@
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace MediaBrowser.Server.Implementations.Connect namespace Emby.Server.Implementations.Connect
{ {
public static class Validator public static class Validator
{ {

View File

@ -43,6 +43,11 @@
<Compile Include="Channels\RefreshChannelsScheduledTask.cs" /> <Compile Include="Channels\RefreshChannelsScheduledTask.cs" />
<Compile Include="Collections\CollectionImageProvider.cs" /> <Compile Include="Collections\CollectionImageProvider.cs" />
<Compile Include="Collections\CollectionManager.cs" /> <Compile Include="Collections\CollectionManager.cs" />
<Compile Include="Connect\ConnectData.cs" />
<Compile Include="Connect\ConnectEntryPoint.cs" />
<Compile Include="Connect\ConnectManager.cs" />
<Compile Include="Connect\Responses.cs" />
<Compile Include="Connect\Validator.cs" />
<Compile Include="Devices\DeviceManager.cs" /> <Compile Include="Devices\DeviceManager.cs" />
<Compile Include="Dto\DtoService.cs" /> <Compile Include="Dto\DtoService.cs" />
<Compile Include="EntryPoints\AutomaticRestartEntryPoint.cs" /> <Compile Include="EntryPoints\AutomaticRestartEntryPoint.cs" />
@ -51,6 +56,7 @@
<Compile Include="EntryPoints\RecordingNotifier.cs" /> <Compile Include="EntryPoints\RecordingNotifier.cs" />
<Compile Include="EntryPoints\RefreshUsersMetadata.cs" /> <Compile Include="EntryPoints\RefreshUsersMetadata.cs" />
<Compile Include="EntryPoints\ServerEventNotifier.cs" /> <Compile Include="EntryPoints\ServerEventNotifier.cs" />
<Compile Include="EntryPoints\UdpServerEntryPoint.cs" />
<Compile Include="EntryPoints\UsageEntryPoint.cs" /> <Compile Include="EntryPoints\UsageEntryPoint.cs" />
<Compile Include="EntryPoints\UsageReporter.cs" /> <Compile Include="EntryPoints\UsageReporter.cs" />
<Compile Include="EntryPoints\UserDataChangeNotifier.cs" /> <Compile Include="EntryPoints\UserDataChangeNotifier.cs" />
@ -61,13 +67,17 @@
<Compile Include="FileOrganization\NameUtils.cs" /> <Compile Include="FileOrganization\NameUtils.cs" />
<Compile Include="FileOrganization\OrganizerScheduledTask.cs" /> <Compile Include="FileOrganization\OrganizerScheduledTask.cs" />
<Compile Include="FileOrganization\TvFolderOrganizer.cs" /> <Compile Include="FileOrganization\TvFolderOrganizer.cs" />
<Compile Include="HttpServer\GetSwaggerResource.cs" />
<Compile Include="HttpServer\SocketSharp\HttpUtility.cs" />
<Compile Include="HttpServer\IHttpListener.cs" /> <Compile Include="HttpServer\IHttpListener.cs" />
<Compile Include="HttpServer\Security\AuthorizationContext.cs" /> <Compile Include="HttpServer\Security\AuthorizationContext.cs" />
<Compile Include="HttpServer\Security\AuthService.cs" /> <Compile Include="HttpServer\Security\AuthService.cs" />
<Compile Include="HttpServer\Security\SessionContext.cs" /> <Compile Include="HttpServer\Security\SessionContext.cs" />
<Compile Include="HttpServer\StreamWriter.cs" /> <Compile Include="HttpServer\StreamWriter.cs" />
<Compile Include="HttpServer\SwaggerService.cs" />
<Compile Include="Images\BaseDynamicImageProvider.cs" /> <Compile Include="Images\BaseDynamicImageProvider.cs" />
<Compile Include="Intros\DefaultIntroProvider.cs" /> <Compile Include="Intros\DefaultIntroProvider.cs" />
<Compile Include="IO\FileRefresher.cs" />
<Compile Include="IO\ThrottledStream.cs" /> <Compile Include="IO\ThrottledStream.cs" />
<Compile Include="Library\CoreResolutionIgnoreRule.cs" /> <Compile Include="Library\CoreResolutionIgnoreRule.cs" />
<Compile Include="Library\LibraryManager.cs" /> <Compile Include="Library\LibraryManager.cs" />
@ -137,6 +147,7 @@
<Compile Include="LiveTv\TunerHosts\M3UTunerHost.cs" /> <Compile Include="LiveTv\TunerHosts\M3UTunerHost.cs" />
<Compile Include="LiveTv\TunerHosts\MulticastStream.cs" /> <Compile Include="LiveTv\TunerHosts\MulticastStream.cs" />
<Compile Include="LiveTv\TunerHosts\QueueStream.cs" /> <Compile Include="LiveTv\TunerHosts\QueueStream.cs" />
<Compile Include="Localization\LocalizationManager.cs" />
<Compile Include="Logging\PatternsLogger.cs" /> <Compile Include="Logging\PatternsLogger.cs" />
<Compile Include="MediaEncoder\EncodingManager.cs" /> <Compile Include="MediaEncoder\EncodingManager.cs" />
<Compile Include="News\NewsEntryPoint.cs" /> <Compile Include="News\NewsEntryPoint.cs" />
@ -159,6 +170,7 @@
<Compile Include="ScheduledTasks\RefreshIntrosTask.cs" /> <Compile Include="ScheduledTasks\RefreshIntrosTask.cs" />
<Compile Include="ScheduledTasks\RefreshMediaLibraryTask.cs" /> <Compile Include="ScheduledTasks\RefreshMediaLibraryTask.cs" />
<Compile Include="ScheduledTasks\SystemUpdateTask.cs" /> <Compile Include="ScheduledTasks\SystemUpdateTask.cs" />
<Compile Include="Security\EncryptionManager.cs" />
<Compile Include="Security\MBLicenseFile.cs" /> <Compile Include="Security\MBLicenseFile.cs" />
<Compile Include="Security\PluginSecurityManager.cs" /> <Compile Include="Security\PluginSecurityManager.cs" />
<Compile Include="Security\RegRecord.cs" /> <Compile Include="Security\RegRecord.cs" />
@ -217,11 +229,14 @@
<Compile Include="Sync\TargetDataProvider.cs" /> <Compile Include="Sync\TargetDataProvider.cs" />
<Compile Include="TV\SeriesPostScanTask.cs" /> <Compile Include="TV\SeriesPostScanTask.cs" />
<Compile Include="TV\TVSeriesManager.cs" /> <Compile Include="TV\TVSeriesManager.cs" />
<Compile Include="Udp\UdpServer.cs" />
<Compile Include="Updates\InstallationManager.cs" /> <Compile Include="Updates\InstallationManager.cs" />
<Compile Include="UserViews\CollectionFolderImageProvider.cs" /> <Compile Include="UserViews\CollectionFolderImageProvider.cs" />
<Compile Include="UserViews\DynamicImageProvider.cs" /> <Compile Include="UserViews\DynamicImageProvider.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<EmbeddedResource Include="Localization\iso6392.txt" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj"> <ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
<Project>{9142eefa-7570-41e1-bfcc-468bb571af2f}</Project> <Project>{9142eefa-7570-41e1-bfcc-468bb571af2f}</Project>
@ -257,8 +272,246 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="..\thirdparty\servicestack\swagger-ui\fonts\droid-sans-v6-latin-700.svg">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.svg</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\fonts\droid-sans-v6-latin-regular.svg">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.svg</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\images\explorer_icons.png">
<Link>swagger-ui\images\explorer_icons.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\images\logo_small.png">
<Link>swagger-ui\images\logo_small.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\images\pet_store_api.png">
<Link>swagger-ui\images\pet_store_api.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\images\throbber.gif">
<Link>swagger-ui\images\throbber.gif</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\images\wordnik_api.png">
<Link>swagger-ui\images\wordnik_api.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\index.html">
<Link>swagger-ui\index.html</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\lib\backbone-min.js">
<Link>swagger-ui\lib\backbone-min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\lib\handlebars-2.0.0.js">
<Link>swagger-ui\lib\handlebars-2.0.0.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\lib\highlight.7.3.pack.js">
<Link>swagger-ui\lib\highlight.7.3.pack.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\lib\jquery-1.8.0.min.js">
<Link>swagger-ui\lib\jquery-1.8.0.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\lib\jquery.ba-bbq.min.js">
<Link>swagger-ui\lib\jquery.ba-bbq.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\lib\jquery.slideto.min.js">
<Link>swagger-ui\lib\jquery.slideto.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\lib\jquery.wiggle.min.js">
<Link>swagger-ui\lib\jquery.wiggle.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\lib\marked.js">
<Link>swagger-ui\lib\marked.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\lib\shred.bundle.js">
<Link>swagger-ui\lib\shred.bundle.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\lib\shred\content.js">
<Link>swagger-ui\lib\shred\content.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\lib\swagger-client.js">
<Link>swagger-ui\lib\swagger-client.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\lib\swagger-oauth.js">
<Link>swagger-ui\lib\swagger-oauth.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\lib\underscore-min.js">
<Link>swagger-ui\lib\underscore-min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\o2c.html">
<Link>swagger-ui\o2c.html</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\patch.js">
<Link>swagger-ui\patch.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\swagger-ui.js">
<Link>swagger-ui\swagger-ui.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\swagger-ui.min.js">
<Link>swagger-ui\swagger-ui.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<EmbeddedResource Include="Localization\Core\ar.json" />
<EmbeddedResource Include="Localization\Core\bg-BG.json" />
<EmbeddedResource Include="Localization\Core\ca.json" />
<EmbeddedResource Include="Localization\Core\core.json" />
<EmbeddedResource Include="Localization\Core\cs.json" />
<EmbeddedResource Include="Localization\Core\da.json" />
<EmbeddedResource Include="Localization\Core\de.json" />
<EmbeddedResource Include="Localization\Core\el.json" />
<EmbeddedResource Include="Localization\Core\en-GB.json" />
<EmbeddedResource Include="Localization\Core\en-US.json" />
<EmbeddedResource Include="Localization\Core\es-AR.json" />
<EmbeddedResource Include="Localization\Core\es-MX.json" />
<EmbeddedResource Include="Localization\Core\es.json" />
<EmbeddedResource Include="Localization\Core\fi.json" />
<EmbeddedResource Include="Localization\Core\fr-CA.json" />
<EmbeddedResource Include="Localization\Core\fr.json" />
<EmbeddedResource Include="Localization\Core\gsw.json" />
<EmbeddedResource Include="Localization\Core\he.json" />
<EmbeddedResource Include="Localization\Core\hr.json" />
<EmbeddedResource Include="Localization\Core\hu.json" />
<EmbeddedResource Include="Localization\Core\id.json" />
<EmbeddedResource Include="Localization\Core\it.json" />
<EmbeddedResource Include="Localization\Core\kk.json" />
<EmbeddedResource Include="Localization\Core\ko.json" />
<EmbeddedResource Include="Localization\Core\ms.json" />
<EmbeddedResource Include="Localization\Core\nb.json" />
<EmbeddedResource Include="Localization\Core\nl.json" />
<EmbeddedResource Include="Localization\Core\pl.json" />
<EmbeddedResource Include="Localization\Core\pt-BR.json" />
<EmbeddedResource Include="Localization\Core\pt-PT.json" />
<EmbeddedResource Include="Localization\Core\ro.json" />
<EmbeddedResource Include="Localization\Core\ru.json" />
<EmbeddedResource Include="Localization\Core\sl-SI.json" />
<EmbeddedResource Include="Localization\Core\sv.json" />
<EmbeddedResource Include="Localization\Core\tr.json" />
<EmbeddedResource Include="Localization\Core\uk.json" />
<EmbeddedResource Include="Localization\Core\vi.json" />
<EmbeddedResource Include="Localization\Core\zh-CN.json" />
<EmbeddedResource Include="Localization\Core\zh-HK.json" />
<EmbeddedResource Include="Localization\Core\zh-TW.json" />
<EmbeddedResource Include="Localization\countries.json" />
<Content Include="..\thirdparty\servicestack\swagger-ui\fonts\droid-sans-v6-latin-700.eot">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.eot</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\fonts\droid-sans-v6-latin-700.ttf">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.ttf</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\fonts\droid-sans-v6-latin-700.woff">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.woff</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\fonts\droid-sans-v6-latin-700.woff2">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.woff2</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\fonts\droid-sans-v6-latin-regular.eot">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.eot</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\fonts\droid-sans-v6-latin-regular.ttf">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.ttf</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\fonts\droid-sans-v6-latin-regular.woff">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.woff</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\fonts\droid-sans-v6-latin-regular.woff2">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.woff2</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\au.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\be.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\br.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\ca.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\co.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\de.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\dk.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\fr.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\gb.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\ie.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\jp.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\kz.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\mx.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\nl.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\nz.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\ru.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Ratings\us.txt" />
</ItemGroup>
<ItemGroup>
<Content Include="..\thirdparty\servicestack\swagger-ui\css\reset.css">
<Link>swagger-ui\css\reset.css</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\css\screen.css">
<Link>swagger-ui\css\screen.css</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\thirdparty\servicestack\swagger-ui\css\typography.css">
<Link>swagger-ui\css\typography.css</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -1,12 +1,12 @@
using System; using System;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller; using MediaBrowser.Controller;
using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using MediaBrowser.Server.Implementations.Udp; using Emby.Server.Implementations.Udp;
using MediaBrowser.Model.Net;
namespace MediaBrowser.Server.Implementations.EntryPoints namespace Emby.Server.Implementations.EntryPoints
{ {
/// <summary> /// <summary>
/// Class UdpServerEntryPoint /// Class UdpServerEntryPoint
@ -23,10 +23,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
/// The _logger /// The _logger
/// </summary> /// </summary>
private readonly ILogger _logger; private readonly ILogger _logger;
/// <summary> private readonly ISocketFactory _socketFactory;
/// The _network manager
/// </summary>
private readonly INetworkManager _networkManager;
private readonly IServerApplicationHost _appHost; private readonly IServerApplicationHost _appHost;
private readonly IJsonSerializer _json; private readonly IJsonSerializer _json;
@ -35,16 +32,12 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="UdpServerEntryPoint" /> class. /// Initializes a new instance of the <see cref="UdpServerEntryPoint" /> class.
/// </summary> /// </summary>
/// <param name="logger">The logger.</param> public UdpServerEntryPoint(ILogger logger, IServerApplicationHost appHost, IJsonSerializer json, ISocketFactory socketFactory)
/// <param name="networkManager">The network manager.</param>
/// <param name="appHost">The application host.</param>
/// <param name="json">The json.</param>
public UdpServerEntryPoint(ILogger logger, INetworkManager networkManager, IServerApplicationHost appHost, IJsonSerializer json)
{ {
_logger = logger; _logger = logger;
_networkManager = networkManager;
_appHost = appHost; _appHost = appHost;
_json = json; _json = json;
_socketFactory = socketFactory;
} }
/// <summary> /// <summary>
@ -52,7 +45,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
/// </summary> /// </summary>
public void Run() public void Run()
{ {
var udpServer = new UdpServer(_logger, _networkManager, _appHost, _json); var udpServer = new UdpServer(_logger, _appHost, _json, _socketFactory);
try try
{ {

View File

@ -1,6 +1,6 @@
using ServiceStack; using MediaBrowser.Model.Services;
namespace MediaBrowser.Server.Implementations.HttpServer namespace Emby.Server.Implementations.HttpServer
{ {
/// <summary> /// <summary>
/// Class GetDashboardResource /// Class GetDashboardResource

View File

@ -1,33 +1,13 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text; using System.Text;
using MediaBrowser.Model.Services; using MediaBrowser.Model.Services;
namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp namespace Emby.Server.Implementations.HttpServer.SocketSharp
{ {
public static class MyHttpUtility public static class MyHttpUtility
{ {
sealed class HttpQSCollection : NameValueCollection
{
public override string ToString()
{
int count = Count;
if (count == 0)
return "";
StringBuilder sb = new StringBuilder();
string[] keys = AllKeys;
for (int i = 0; i < count; i++)
{
sb.AppendFormat("{0}={1}&", keys[i], this[keys[i]]);
}
if (sb.Length > 0)
sb.Length--;
return sb.ToString();
}
}
// Must be sorted // Must be sorted
static readonly long[] entities = new long[] { static readonly long[] entities = new long[] {
(long)'A' << 56 | (long)'E' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24, (long)'A' << 56 | (long)'E' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24,
@ -607,7 +587,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
byte[] buf = bytes.ToArray(); byte[] buf = bytes.ToArray();
bytes = null; bytes = null;
return e.GetString(buf); return e.GetString(buf, 0, buf.Length);
} }

View File

@ -1,17 +1,20 @@
using MediaBrowser.Controller; using MediaBrowser.Controller;
using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Net;
using System.IO; using System.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Services; using MediaBrowser.Model.Services;
namespace MediaBrowser.Server.Implementations.HttpServer namespace Emby.Server.Implementations.HttpServer
{ {
public class SwaggerService : IHasResultFactory, IService public class SwaggerService : IHasResultFactory, IService
{ {
private readonly IServerApplicationPaths _appPaths; private readonly IServerApplicationPaths _appPaths;
private readonly IFileSystem _fileSystem;
public SwaggerService(IServerApplicationPaths appPaths) public SwaggerService(IServerApplicationPaths appPaths, IFileSystem fileSystem)
{ {
_appPaths = appPaths; _appPaths = appPaths;
_fileSystem = fileSystem;
} }
/// <summary> /// <summary>
@ -23,7 +26,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
{ {
var swaggerDirectory = Path.Combine(_appPaths.ApplicationResourcesPath, "swagger-ui"); var swaggerDirectory = Path.Combine(_appPaths.ApplicationResourcesPath, "swagger-ui");
var requestedFile = Path.Combine(swaggerDirectory, request.ResourceName.Replace('/', Path.DirectorySeparatorChar)); var requestedFile = Path.Combine(swaggerDirectory, request.ResourceName.Replace('/', _fileSystem.DirectorySeparatorChar));
return ResultFactory.GetStaticFileResult(Request, requestedFile).Result; return ResultFactory.GetStaticFileResult(Request, requestedFile).Result;
} }

View File

@ -13,10 +13,11 @@ using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks; using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Threading; using MediaBrowser.Model.Threading;
namespace MediaBrowser.Server.Implementations.IO namespace Emby.Server.Implementations.IO
{ {
public class FileRefresher : IDisposable public class FileRefresher : IDisposable
{ {
@ -32,8 +33,9 @@ namespace MediaBrowser.Server.Implementations.IO
public string Path { get; private set; } public string Path { get; private set; }
public event EventHandler<EventArgs> Completed; public event EventHandler<EventArgs> Completed;
private readonly IEnvironmentInfo _environmentInfo;
public FileRefresher(string path, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, ITaskManager taskManager, ILogger logger, ITimerFactory timerFactory) public FileRefresher(string path, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, ITaskManager taskManager, ILogger logger, ITimerFactory timerFactory, IEnvironmentInfo environmentInfo)
{ {
logger.Debug("New file refresher created for {0}", path); logger.Debug("New file refresher created for {0}", path);
Path = path; Path = path;
@ -44,6 +46,7 @@ namespace MediaBrowser.Server.Implementations.IO
TaskManager = taskManager; TaskManager = taskManager;
Logger = logger; Logger = logger;
_timerFactory = timerFactory; _timerFactory = timerFactory;
_environmentInfo = environmentInfo;
AddPath(path); AddPath(path);
} }
@ -226,7 +229,7 @@ namespace MediaBrowser.Server.Implementations.IO
private bool IsFileLocked(string path) private bool IsFileLocked(string path)
{ {
if (Environment.OSVersion.Platform != PlatformID.Win32NT) if (_environmentInfo.OperatingSystem != OperatingSystem.Windows)
{ {
// Causing lockups on linux // Causing lockups on linux
return false; return false;

View File

@ -56,7 +56,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{ {
var format = _liveTvOptions.RecordingEncodingFormat; var format = _liveTvOptions.RecordingEncodingFormat;
if (string.Equals(format, "mkv", StringComparison.OrdinalIgnoreCase) || string.Equals(_liveTvOptions.RecordedVideoCodec, "copy", StringComparison.OrdinalIgnoreCase)) if (string.Equals(format, "mkv", StringComparison.OrdinalIgnoreCase))
{ {
return "mkv"; return "mkv";
} }

View File

@ -33,7 +33,7 @@ namespace Emby.Server.Implementations.LiveTv
Protocol = mediaSource.Protocol, Protocol = mediaSource.Protocol,
MediaType = isAudio ? DlnaProfileType.Audio : DlnaProfileType.Video, MediaType = isAudio ? DlnaProfileType.Audio : DlnaProfileType.Video,
ExtractChapters = false, ExtractChapters = false,
AnalyzeDurationSections = 2 AnalyzeDurationSections = 3
}, cancellationToken).ConfigureAwait(false); }, cancellationToken).ConfigureAwait(false);

View File

@ -9,14 +9,11 @@ using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Reflection;
namespace MediaBrowser.Server.Implementations.Localization namespace Emby.Server.Implementations.Localization
{ {
/// <summary> /// <summary>
/// Class LocalizationManager /// Class LocalizationManager
@ -39,6 +36,8 @@ namespace MediaBrowser.Server.Implementations.Localization
private readonly IFileSystem _fileSystem; private readonly IFileSystem _fileSystem;
private readonly IJsonSerializer _jsonSerializer; private readonly IJsonSerializer _jsonSerializer;
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IAssemblyInfo _assemblyInfo;
private readonly ITextLocalizer _textLocalizer;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="LocalizationManager" /> class. /// Initializes a new instance of the <see cref="LocalizationManager" /> class.
@ -46,12 +45,14 @@ namespace MediaBrowser.Server.Implementations.Localization
/// <param name="configurationManager">The configuration manager.</param> /// <param name="configurationManager">The configuration manager.</param>
/// <param name="fileSystem">The file system.</param> /// <param name="fileSystem">The file system.</param>
/// <param name="jsonSerializer">The json serializer.</param> /// <param name="jsonSerializer">The json serializer.</param>
public LocalizationManager(IServerConfigurationManager configurationManager, IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger) public LocalizationManager(IServerConfigurationManager configurationManager, IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, IAssemblyInfo assemblyInfo, ITextLocalizer textLocalizer)
{ {
_configurationManager = configurationManager; _configurationManager = configurationManager;
_fileSystem = fileSystem; _fileSystem = fileSystem;
_jsonSerializer = jsonSerializer; _jsonSerializer = jsonSerializer;
_logger = logger; _logger = logger;
_assemblyInfo = assemblyInfo;
_textLocalizer = textLocalizer;
ExtractAll(); ExtractAll();
} }
@ -65,20 +66,20 @@ namespace MediaBrowser.Server.Implementations.Localization
_fileSystem.CreateDirectory(localizationPath); _fileSystem.CreateDirectory(localizationPath);
var existingFiles = Directory.EnumerateFiles(localizationPath, "ratings-*.txt", SearchOption.TopDirectoryOnly) var existingFiles = GetRatingsFiles(localizationPath)
.Select(Path.GetFileName) .Select(Path.GetFileName)
.ToList(); .ToList();
// Extract from the assembly // Extract from the assembly
foreach (var resource in type.Assembly foreach (var resource in _assemblyInfo
.GetManifestResourceNames() .GetManifestResourceNames(type)
.Where(i => i.StartsWith(resourcePath))) .Where(i => i.StartsWith(resourcePath)))
{ {
var filename = "ratings-" + resource.Substring(resourcePath.Length); var filename = "ratings-" + resource.Substring(resourcePath.Length);
if (!existingFiles.Contains(filename)) if (!existingFiles.Contains(filename))
{ {
using (var stream = type.Assembly.GetManifestResourceStream(resource)) using (var stream = _assemblyInfo.GetManifestResourceStream(type, resource))
{ {
var target = Path.Combine(localizationPath, filename); var target = Path.Combine(localizationPath, filename);
_logger.Info("Extracting ratings to {0}", target); _logger.Info("Extracting ratings to {0}", target);
@ -90,13 +91,21 @@ namespace MediaBrowser.Server.Implementations.Localization
} }
} }
} }
foreach (var file in Directory.EnumerateFiles(localizationPath, "ratings-*.txt", SearchOption.TopDirectoryOnly)) foreach (var file in GetRatingsFiles(localizationPath))
{ {
LoadRatings(file); LoadRatings(file);
} }
} }
private List<string> GetRatingsFiles(string directory)
{
return _fileSystem.GetFilePaths(directory, false)
.Where(i => string.Equals(Path.GetExtension(i), ".txt", StringComparison.OrdinalIgnoreCase))
.Where(i => Path.GetFileName(i).StartsWith("ratings-", StringComparison.OrdinalIgnoreCase))
.ToList();
}
/// <summary> /// <summary>
/// Gets the localization path. /// Gets the localization path.
/// </summary> /// </summary>
@ -111,16 +120,12 @@ namespace MediaBrowser.Server.Implementations.Localization
public string RemoveDiacritics(string text) public string RemoveDiacritics(string text)
{ {
return String.Concat( return _textLocalizer.RemoveDiacritics(text);
text.Normalize(NormalizationForm.FormD)
.Where(ch => CharUnicodeInfo.GetUnicodeCategory(ch) !=
UnicodeCategory.NonSpacingMark)
).Normalize(NormalizationForm.FormC);
} }
public string NormalizeFormKD(string text) public string NormalizeFormKD(string text)
{ {
return text.Normalize(NormalizationForm.FormKD); return _textLocalizer.NormalizeFormKD(text);
} }
/// <summary> /// <summary>
@ -134,7 +139,7 @@ namespace MediaBrowser.Server.Implementations.Localization
var list = new List<CultureDto>(); var list = new List<CultureDto>();
using (var stream = type.Assembly.GetManifestResourceStream(path)) using (var stream = _assemblyInfo.GetManifestResourceStream(type, path))
{ {
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
@ -176,7 +181,7 @@ namespace MediaBrowser.Server.Implementations.Localization
var type = GetType(); var type = GetType();
var path = type.Namespace + ".countries.json"; var path = type.Namespace + ".countries.json";
using (var stream = type.Assembly.GetManifestResourceStream(path)) using (var stream = _assemblyInfo.GetManifestResourceStream(type, path))
{ {
return _jsonSerializer.DeserializeFromStream<List<CountryInfo>>(stream); return _jsonSerializer.DeserializeFromStream<List<CountryInfo>>(stream);
} }
@ -234,7 +239,7 @@ namespace MediaBrowser.Server.Implementations.Localization
/// <returns>Dictionary{System.StringParentalRating}.</returns> /// <returns>Dictionary{System.StringParentalRating}.</returns>
private void LoadRatings(string file) private void LoadRatings(string file)
{ {
var dict = File.ReadAllLines(file).Select(i => var dict = _fileSystem.ReadAllLines(file).Select(i =>
{ {
if (!string.IsNullOrWhiteSpace(i)) if (!string.IsNullOrWhiteSpace(i))
{ {
@ -337,18 +342,17 @@ namespace MediaBrowser.Server.Implementations.Localization
{ {
var dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); var dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
var assembly = GetType().Assembly;
var namespaceName = GetType().Namespace + "." + prefix; var namespaceName = GetType().Namespace + "." + prefix;
CopyInto(dictionary, namespaceName + "." + baseFilename, assembly); CopyInto(dictionary, namespaceName + "." + baseFilename);
CopyInto(dictionary, namespaceName + "." + GetResourceFilename(culture), assembly); CopyInto(dictionary, namespaceName + "." + GetResourceFilename(culture));
return dictionary; return dictionary;
} }
private void CopyInto(IDictionary<string, string> dictionary, string resourcePath, Assembly assembly) private void CopyInto(IDictionary<string, string> dictionary, string resourcePath)
{ {
using (var stream = assembly.GetManifestResourceStream(resourcePath)) using (var stream = _assemblyInfo.GetManifestResourceStream(GetType(), resourcePath))
{ {
if (stream != null) if (stream != null)
{ {
@ -419,4 +423,11 @@ namespace MediaBrowser.Server.Implementations.Localization
}.OrderBy(i => i.Name); }.OrderBy(i => i.Name);
} }
} }
public interface ITextLocalizer
{
string RemoveDiacritics(string text);
string NormalizeFormKD(string text);
}
} }

View File

@ -2,7 +2,7 @@
using System; using System;
using System.Text; using System.Text;
namespace MediaBrowser.Server.Implementations.Security namespace Emby.Server.Implementations.Security
{ {
public class EncryptionManager : IEncryptionManager public class EncryptionManager : IEncryptionManager
{ {
@ -45,7 +45,7 @@ namespace MediaBrowser.Server.Implementations.Security
// Yes, this isn't good, but ProtectedData in mono is throwing exceptions, so use this for now // Yes, this isn't good, but ProtectedData in mono is throwing exceptions, so use this for now
var bytes = Convert.FromBase64String(value); var bytes = Convert.FromBase64String(value);
return Encoding.UTF8.GetString(bytes); return Encoding.UTF8.GetString(bytes, 0, bytes.Length);
} }
} }
} }

View File

@ -124,9 +124,17 @@ namespace Emby.Server.Implementations.Security
//the rest of the lines should be pairs of features and timestamps //the rest of the lines should be pairs of features and timestamps
for (var i = 2; i < contents.Length; i = i + 2) for (var i = 2; i < contents.Length; i = i + 2)
{ {
var feat = Guid.Parse(contents[i]); var line = contents[i];
if (string.IsNullOrWhiteSpace(line))
{
continue;
}
SetUpdateRecord(feat, new DateTime(Convert.ToInt64(contents[i + 1]))); Guid feat;
if (Guid.TryParse(line, out feat))
{
SetUpdateRecord(feat, new DateTime(Convert.ToInt64(contents[i + 1])));
}
} }
} }
} }

View File

@ -1,18 +1,16 @@
using MediaBrowser.Common.Net; using MediaBrowser.Controller;
using MediaBrowser.Controller;
using MediaBrowser.Model.ApiClient; using MediaBrowser.Model.ApiClient;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Emby.Common.Implementations.Networking; using MediaBrowser.Model.Events;
using MediaBrowser.Model.Net;
namespace MediaBrowser.Server.Implementations.Udp namespace Emby.Server.Implementations.Udp
{ {
/// <summary> /// <summary>
/// Provides a Udp Server /// Provides a Udp Server
@ -24,14 +22,9 @@ namespace MediaBrowser.Server.Implementations.Udp
/// </summary> /// </summary>
private readonly ILogger _logger; private readonly ILogger _logger;
/// <summary>
/// The _network manager
/// </summary>
private readonly INetworkManager _networkManager;
private bool _isDisposed; private bool _isDisposed;
private readonly List<Tuple<string, bool, Func<string, string, Encoding, Task>>> _responders = new List<Tuple<string, bool, Func<string, string, Encoding, Task>>>(); private readonly List<Tuple<string, bool, Func<string, IpEndPointInfo, Encoding, Task>>> _responders = new List<Tuple<string, bool, Func<string, IpEndPointInfo, Encoding, Task>>>();
private readonly IServerApplicationHost _appHost; private readonly IServerApplicationHost _appHost;
private readonly IJsonSerializer _json; private readonly IJsonSerializer _json;
@ -39,46 +32,43 @@ namespace MediaBrowser.Server.Implementations.Udp
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="UdpServer" /> class. /// Initializes a new instance of the <see cref="UdpServer" /> class.
/// </summary> /// </summary>
/// <param name="logger">The logger.</param> public UdpServer(ILogger logger, IServerApplicationHost appHost, IJsonSerializer json, ISocketFactory socketFactory)
/// <param name="networkManager">The network manager.</param>
/// <param name="appHost">The application host.</param>
/// <param name="json">The json.</param>
public UdpServer(ILogger logger, INetworkManager networkManager, IServerApplicationHost appHost, IJsonSerializer json)
{ {
_logger = logger; _logger = logger;
_networkManager = networkManager;
_appHost = appHost; _appHost = appHost;
_json = json; _json = json;
_socketFactory = socketFactory;
AddMessageResponder("who is EmbyServer?", true, RespondToV2Message); AddMessageResponder("who is EmbyServer?", true, RespondToV2Message);
AddMessageResponder("who is MediaBrowserServer_v2?", false, RespondToV2Message); AddMessageResponder("who is MediaBrowserServer_v2?", false, RespondToV2Message);
} }
private void AddMessageResponder(string message, bool isSubstring, Func<string, string, Encoding, Task> responder) private void AddMessageResponder(string message, bool isSubstring, Func<string, IpEndPointInfo, Encoding, Task> responder)
{ {
_responders.Add(new Tuple<string, bool, Func<string, string, Encoding, Task>>(message, isSubstring, responder)); _responders.Add(new Tuple<string, bool, Func<string, IpEndPointInfo, Encoding, Task>>(message, isSubstring, responder));
} }
/// <summary> /// <summary>
/// Raises the <see cref="E:MessageReceived" /> event. /// Raises the <see cref="E:MessageReceived" /> event.
/// </summary> /// </summary>
/// <param name="e">The <see cref="UdpMessageReceivedEventArgs"/> instance containing the event data.</param> private async void OnMessageReceived(GenericEventArgs<SocketReceiveResult> e)
private async void OnMessageReceived(UdpMessageReceivedEventArgs e)
{ {
var message = e.Argument;
var encoding = Encoding.UTF8; var encoding = Encoding.UTF8;
var responder = GetResponder(e.Bytes, encoding); var responder = GetResponder(message.Buffer, message.ReceivedBytes, encoding);
if (responder == null) if (responder == null)
{ {
encoding = Encoding.Unicode; encoding = Encoding.Unicode;
responder = GetResponder(e.Bytes, encoding); responder = GetResponder(message.Buffer, message.ReceivedBytes, encoding);
} }
if (responder != null) if (responder != null)
{ {
try try
{ {
await responder.Item2.Item3(responder.Item1, e.RemoteEndPoint, encoding).ConfigureAwait(false); await responder.Item2.Item3(responder.Item1, message.RemoteEndPoint, encoding).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -87,9 +77,9 @@ namespace MediaBrowser.Server.Implementations.Udp
} }
} }
private Tuple<string, Tuple<string, bool, Func<string, string, Encoding, Task>>> GetResponder(byte[] bytes, Encoding encoding) private Tuple<string, Tuple<string, bool, Func<string, IpEndPointInfo, Encoding, Task>>> GetResponder(byte[] buffer, int bytesReceived, Encoding encoding)
{ {
var text = encoding.GetString(bytes); var text = encoding.GetString(buffer, 0, bytesReceived);
var responder = _responders.FirstOrDefault(i => var responder = _responders.FirstOrDefault(i =>
{ {
if (i.Item2) if (i.Item2)
@ -103,10 +93,10 @@ namespace MediaBrowser.Server.Implementations.Udp
{ {
return null; return null;
} }
return new Tuple<string, Tuple<string, bool, Func<string, string, Encoding, Task>>>(text, responder); return new Tuple<string, Tuple<string, bool, Func<string, IpEndPointInfo, Encoding, Task>>>(text, responder);
} }
private async Task RespondToV2Message(string messageText, string endpoint, Encoding encoding) private async Task RespondToV2Message(string messageText, IpEndPointInfo endpoint, Encoding encoding)
{ {
var parts = messageText.Split('|'); var parts = messageText.Split('|');
@ -122,7 +112,7 @@ namespace MediaBrowser.Server.Implementations.Udp
}; };
await SendAsync(encoding.GetBytes(_json.SerializeToString(response)), endpoint).ConfigureAwait(false); await SendAsync(encoding.GetBytes(_json.SerializeToString(response)), endpoint).ConfigureAwait(false);
if (parts.Length > 1) if (parts.Length > 1)
{ {
_appHost.EnableLoopback(parts[1]); _appHost.EnableLoopback(parts[1]);
@ -137,7 +127,8 @@ namespace MediaBrowser.Server.Implementations.Udp
/// <summary> /// <summary>
/// The _udp client /// The _udp client
/// </summary> /// </summary>
private UdpClient _udpClient; private IUdpSocket _udpClient;
private readonly ISocketFactory _socketFactory;
/// <summary> /// <summary>
/// Starts the specified port. /// Starts the specified port.
@ -145,9 +136,7 @@ namespace MediaBrowser.Server.Implementations.Udp
/// <param name="port">The port.</param> /// <param name="port">The port.</param>
public void Start(int port) public void Start(int port)
{ {
_udpClient = new UdpClient(new IPEndPoint(IPAddress.Any, port)); _udpClient = _socketFactory.CreateUdpSocket(port);
_udpClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
Task.Run(() => StartListening()); Task.Run(() => StartListening());
} }
@ -158,56 +147,36 @@ namespace MediaBrowser.Server.Implementations.Udp
{ {
try try
{ {
var result = await GetResult().ConfigureAwait(false); var result = await _udpClient.ReceiveAsync().ConfigureAwait(false);
OnMessageReceived(result); OnMessageReceived(result);
} }
catch (ObjectDisposedException) catch (ObjectDisposedException)
{ {
break;
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.ErrorException("Error in StartListening", ex); _logger.ErrorException("Error receiving udp message", ex);
} }
} }
} }
private Task<UdpReceiveResult> GetResult()
{
try
{
return _udpClient.ReceiveAsync();
}
catch (ObjectDisposedException)
{
return Task.FromResult(new UdpReceiveResult(new byte[] { }, new IPEndPoint(IPAddress.Any, 0)));
}
catch (Exception ex)
{
_logger.ErrorException("Error receiving udp message", ex);
return Task.FromResult(new UdpReceiveResult(new byte[] { }, new IPEndPoint(IPAddress.Any, 0)));
}
}
/// <summary> /// <summary>
/// Called when [message received]. /// Called when [message received].
/// </summary> /// </summary>
/// <param name="message">The message.</param> /// <param name="message">The message.</param>
private void OnMessageReceived(UdpReceiveResult message) private void OnMessageReceived(SocketReceiveResult message)
{ {
if (message.RemoteEndPoint.Port == 0) if (message.RemoteEndPoint.Port == 0)
{ {
return; return;
} }
var bytes = message.Buffer;
try try
{ {
OnMessageReceived(new UdpMessageReceivedEventArgs OnMessageReceived(new GenericEventArgs<SocketReceiveResult>
{ {
Bytes = bytes, Argument = message
RemoteEndPoint = message.RemoteEndPoint.ToString()
}); });
} }
catch (Exception ex) catch (Exception ex)
@ -234,7 +203,7 @@ namespace MediaBrowser.Server.Implementations.Udp
if (_udpClient != null) if (_udpClient != null)
{ {
_udpClient.Close(); _udpClient.Dispose();
} }
} }
@ -250,71 +219,21 @@ namespace MediaBrowser.Server.Implementations.Udp
} }
} }
/// <summary> public async Task SendAsync(byte[] bytes, IpEndPointInfo remoteEndPoint)
/// Sends the async.
/// </summary>
/// <param name="data">The data.</param>
/// <param name="ipAddress">The ip address.</param>
/// <param name="port">The port.</param>
/// <returns>Task{System.Int32}.</returns>
/// <exception cref="System.ArgumentNullException">data</exception>
public Task SendAsync(string data, string ipAddress, int port)
{
return SendAsync(Encoding.UTF8.GetBytes(data), ipAddress, port);
}
/// <summary>
/// Sends the async.
/// </summary>
/// <param name="bytes">The bytes.</param>
/// <param name="ipAddress">The ip address.</param>
/// <param name="port">The port.</param>
/// <returns>Task{System.Int32}.</returns>
/// <exception cref="System.ArgumentNullException">bytes</exception>
public Task SendAsync(byte[] bytes, string ipAddress, int port)
{ {
if (bytes == null) if (bytes == null)
{ {
throw new ArgumentNullException("bytes"); throw new ArgumentNullException("bytes");
} }
if (string.IsNullOrEmpty(ipAddress)) if (remoteEndPoint == null)
{
throw new ArgumentNullException("ipAddress");
}
return _udpClient.SendAsync(bytes, bytes.Length, ipAddress, port);
}
/// <summary>
/// Sends the async.
/// </summary>
/// <param name="bytes">The bytes.</param>
/// <param name="remoteEndPoint">The remote end point.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException">
/// bytes
/// or
/// remoteEndPoint
/// </exception>
public async Task SendAsync(byte[] bytes, string remoteEndPoint)
{
if (bytes == null)
{
throw new ArgumentNullException("bytes");
}
if (string.IsNullOrEmpty(remoteEndPoint))
{ {
throw new ArgumentNullException("remoteEndPoint"); throw new ArgumentNullException("remoteEndPoint");
} }
try try
{ {
// Need to do this until Common will compile with this method await _udpClient.SendAsync(bytes, bytes.Length, remoteEndPoint).ConfigureAwait(false);
var nativeNetworkManager = (BaseNetworkManager) _networkManager;
await _udpClient.SendAsync(bytes, bytes.Length, nativeNetworkManager.Parse(remoteEndPoint)).ConfigureAwait(false);
_logger.Info("Udp message sent to {0}", remoteEndPoint); _logger.Info("Udp message sent to {0}", remoteEndPoint);
} }

View File

@ -322,7 +322,7 @@ namespace MediaBrowser.Api.UserLibrary
var item = i.Item2[0]; var item = i.Item2[0];
var childCount = 0; var childCount = 0;
if (i.Item1 != null && i.Item2.Count > 0) if (i.Item1 != null && i.Item2.Count > 1)
{ {
item = i.Item1; item = i.Item1;
childCount = i.Item2.Count; childCount = i.Item2.Count;

View File

@ -46,6 +46,10 @@ namespace MediaBrowser.Common.Net
/// <returns><c>true</c> if [is in local network] [the specified endpoint]; otherwise, <c>false</c>.</returns> /// <returns><c>true</c> if [is in local network] [the specified endpoint]; otherwise, <c>false</c>.</returns>
bool IsInLocalNetwork(string endpoint); bool IsInLocalNetwork(string endpoint);
IpAddressInfo ParseIpAddress(string ipAddress);
bool TryParseIpAddress(string ipAddress, out IpAddressInfo ipAddressInfo);
/// <summary> /// <summary>
/// Generates a self signed certificate at the locatation specified by <paramref name="certificatePath"/>. /// Generates a self signed certificate at the locatation specified by <paramref name="certificatePath"/>.
/// </summary> /// </summary>

View File

@ -140,7 +140,8 @@
<Compile Include="Net\IpEndPointInfo.cs" /> <Compile Include="Net\IpEndPointInfo.cs" />
<Compile Include="Net\ISocketFactory.cs" /> <Compile Include="Net\ISocketFactory.cs" />
<Compile Include="Net\IUdpSocket.cs" /> <Compile Include="Net\IUdpSocket.cs" />
<Compile Include="Net\ReceivedUdpData.cs" /> <Compile Include="Net\SocketReceiveResult.cs" />
<Compile Include="System\IEnvironmentInfo.cs" />
<Compile Include="TextEncoding\IEncoding.cs" /> <Compile Include="TextEncoding\IEncoding.cs" />
<Compile Include="Extensions\LinqExtensions.cs" /> <Compile Include="Extensions\LinqExtensions.cs" />
<Compile Include="FileOrganization\SmartMatchInfo.cs" /> <Compile Include="FileOrganization\SmartMatchInfo.cs" />

View File

@ -14,13 +14,18 @@ namespace MediaBrowser.Model.Net
/// <returns>A <see cref="IUdpSocket"/> implementation.</returns> /// <returns>A <see cref="IUdpSocket"/> implementation.</returns>
IUdpSocket CreateUdpSocket(int localPort); IUdpSocket CreateUdpSocket(int localPort);
/// <summary> /// <summary>
/// Createa a new multicast socket using the specified multicast IP address, multicast time to live and local port. /// Createa a new unicast socket using the specified local port number.
/// </summary> /// </summary>
/// <param name="ipAddress">The multicast IP address to bind to.</param> IUdpSocket CreateSsdpUdpSocket(int localPort);
/// <param name="multicastTimeToLive">The multicast time to live value. Actually a maximum number of network hops for UDP packets.</param>
/// <param name="localPort">The local port to bind to.</param> /// <summary>
/// <returns>A <see cref="IUdpSocket"/> implementation.</returns> /// Createa a new multicast socket using the specified multicast IP address, multicast time to live and local port.
IUdpSocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort); /// </summary>
/// <param name="ipAddress">The multicast IP address to bind to.</param>
/// <param name="multicastTimeToLive">The multicast time to live value. Actually a maximum number of network hops for UDP packets.</param>
/// <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);
} }
} }

View File

@ -15,13 +15,11 @@ namespace MediaBrowser.Model.Net
/// Waits for and returns the next UDP message sent to this socket (uni or multicast). /// Waits for and returns the next UDP message sent to this socket (uni or multicast).
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task<ReceivedUdpData> ReceiveAsync(); Task<SocketReceiveResult> ReceiveAsync();
/// <summary> /// <summary>
/// Sends a UDP message to a particular end point (uni or multicast). /// Sends a UDP message to a particular end point (uni or multicast).
/// </summary> /// </summary>
/// <param name="messageData">The data to send.</param> Task SendAsync(byte[] buffer, int bytes, IpEndPointInfo endPoint);
/// <param name="endPoint">The <see cref="IpEndPointInfo"/> providing the address and port to send to.</param>
Task SendTo(byte[] messageData, IpEndPointInfo endPoint);
} }
} }

View File

@ -4,7 +4,7 @@ namespace MediaBrowser.Model.Net
/// <summary> /// <summary>
/// Used by the sockets wrapper to hold raw data received from a UDP socket. /// Used by the sockets wrapper to hold raw data received from a UDP socket.
/// </summary> /// </summary>
public sealed class ReceivedUdpData public sealed class SocketReceiveResult
{ {
/// <summary> /// <summary>
/// The buffer to place received data into. /// The buffer to place received data into.
@ -19,6 +19,6 @@ namespace MediaBrowser.Model.Net
/// <summary> /// <summary>
/// The <see cref="IpEndPointInfo"/> the data was received from. /// The <see cref="IpEndPointInfo"/> the data was received from.
/// </summary> /// </summary>
public IpEndPointInfo ReceivedFrom { get; set; } public IpEndPointInfo RemoteEndPoint { get; set; }
} }
} }

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MediaBrowser.Model.System
{
public interface IEnvironmentInfo
{
MediaBrowser.Model.System.OperatingSystem OperatingSystem { get; }
string OperatingSystemName { get; }
string OperatingSystemVersion { get; }
}
public enum OperatingSystem
{
Windows,
Linux,
OSX
}
}

View File

@ -248,7 +248,6 @@ Global
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Debug|x86.ActiveCfg = Debug|Any CPU {4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Debug|x86.ActiveCfg = Debug|Any CPU
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Debug|x86.Build.0 = Debug|Any CPU {4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Debug|x86.Build.0 = Debug|Any CPU
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU {4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Release Mono|x86.ActiveCfg = Release|Any CPU {4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Release Mono|x86.ActiveCfg = Release|Any CPU
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Release Mono|x86.Build.0 = Release|Any CPU {4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Release Mono|x86.Build.0 = Release|Any CPU
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Release|Any CPU.ActiveCfg = Release|Any CPU {4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@ -18,6 +18,7 @@ using System.Reflection;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Emby.Server.Implementations.HttpServer; using Emby.Server.Implementations.HttpServer;
using Emby.Server.Implementations.HttpServer.SocketSharp;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
using MediaBrowser.Common.Security; using MediaBrowser.Common.Security;
using MediaBrowser.Controller; using MediaBrowser.Controller;

View File

@ -1,13 +1,13 @@
using System.Collections.Specialized; using System.Collections.Specialized;
using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Server.Implementations.Logging;
using SocketHttpListener.Net; using SocketHttpListener.Net;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Emby.Server.Implementations.HttpServer; using Emby.Server.Implementations.HttpServer;
using Emby.Server.Implementations.Logging;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Services; using MediaBrowser.Model.Services;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.IO; using System.IO;
using System.Text; using System.Text;
using Emby.Server.Implementations.HttpServer.SocketSharp;
using Funq; using Funq;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;

View File

@ -10,13 +10,14 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Emby.Server.Implementations.IO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Controller; using MediaBrowser.Controller;
using MediaBrowser.Controller.IO; using MediaBrowser.Controller.IO;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks; using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Threading; using MediaBrowser.Model.Threading;
using Microsoft.Win32;
namespace MediaBrowser.Server.Implementations.IO namespace MediaBrowser.Server.Implementations.IO
{ {
@ -138,11 +139,12 @@ namespace MediaBrowser.Server.Implementations.IO
private readonly IFileSystem _fileSystem; private readonly IFileSystem _fileSystem;
private readonly ITimerFactory _timerFactory; private readonly ITimerFactory _timerFactory;
private readonly IEnvironmentInfo _environmentInfo;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="LibraryMonitor" /> class. /// Initializes a new instance of the <see cref="LibraryMonitor" /> class.
/// </summary> /// </summary>
public LibraryMonitor(ILogManager logManager, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ITimerFactory timerFactory) public LibraryMonitor(ILogManager logManager, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ITimerFactory timerFactory, ISystemEvents systemEvents, IEnvironmentInfo environmentInfo)
{ {
if (taskManager == null) if (taskManager == null)
{ {
@ -155,16 +157,12 @@ namespace MediaBrowser.Server.Implementations.IO
ConfigurationManager = configurationManager; ConfigurationManager = configurationManager;
_fileSystem = fileSystem; _fileSystem = fileSystem;
_timerFactory = timerFactory; _timerFactory = timerFactory;
_environmentInfo = environmentInfo;
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; systemEvents.Resume += _systemEvents_Resume;
} }
/// <summary> private void _systemEvents_Resume(object sender, EventArgs e)
/// Handles the PowerModeChanged event of the SystemEvents control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="PowerModeChangedEventArgs"/> instance containing the event data.</param>
void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
{ {
Restart(); Restart();
} }
@ -529,7 +527,7 @@ namespace MediaBrowser.Server.Implementations.IO
} }
} }
var newRefresher = new FileRefresher(path, _fileSystem, ConfigurationManager, LibraryManager, TaskManager, Logger, _timerFactory); var newRefresher = new FileRefresher(path, _fileSystem, ConfigurationManager, LibraryManager, TaskManager, Logger, _timerFactory, _environmentInfo);
newRefresher.Completed += NewRefresher_Completed; newRefresher.Completed += NewRefresher_Completed;
_activeRefreshers.Add(newRefresher); _activeRefreshers.Add(newRefresher);
} }

View File

@ -1,63 +0,0 @@
using Patterns.Logging;
using System;
namespace MediaBrowser.Server.Implementations.Logging
{
public class PatternsLogger : ILogger
{
private readonly Model.Logging.ILogger _logger;
public PatternsLogger()
: this(new Model.Logging.NullLogger())
{
}
public PatternsLogger(Model.Logging.ILogger logger)
{
_logger = logger;
}
public void Debug(string message, params object[] paramList)
{
_logger.Debug(message, paramList);
}
public void Error(string message, params object[] paramList)
{
_logger.Error(message, paramList);
}
public void ErrorException(string message, Exception exception, params object[] paramList)
{
_logger.ErrorException(message, exception, paramList);
}
public void Fatal(string message, params object[] paramList)
{
_logger.Fatal(message, paramList);
}
public void FatalException(string message, Exception exception, params object[] paramList)
{
_logger.FatalException(message, exception, paramList);
}
public void Info(string message, params object[] paramList)
{
_logger.Info(message, paramList);
}
public void Warn(string message, params object[] paramList)
{
_logger.Warn(message, paramList);
}
public void Log(LogSeverity severity, string message, params object[] paramList)
{
}
public void LogMultiline(string message, LogSeverity severity, System.Text.StringBuilder additionalContent)
{
}
}
}

View File

@ -113,17 +113,10 @@
<Compile Include="Archiving\ZipClient.cs" /> <Compile Include="Archiving\ZipClient.cs" />
<Compile Include="Collections\CollectionsDynamicFolder.cs" /> <Compile Include="Collections\CollectionsDynamicFolder.cs" />
<Compile Include="Configuration\ServerConfigurationManager.cs" /> <Compile Include="Configuration\ServerConfigurationManager.cs" />
<Compile Include="Connect\ConnectData.cs" />
<Compile Include="Connect\ConnectEntryPoint.cs" />
<Compile Include="Connect\ConnectManager.cs" />
<Compile Include="Connect\Responses.cs" />
<Compile Include="Connect\Validator.cs" />
<Compile Include="Devices\DeviceRepository.cs" /> <Compile Include="Devices\DeviceRepository.cs" />
<Compile Include="Devices\CameraUploadsFolder.cs" /> <Compile Include="Devices\CameraUploadsFolder.cs" />
<Compile Include="EntryPoints\ExternalPortForwarding.cs" /> <Compile Include="EntryPoints\ExternalPortForwarding.cs" />
<Compile Include="EntryPoints\UdpServerEntryPoint.cs" />
<Compile Include="HttpServer\ContainerAdapter.cs" /> <Compile Include="HttpServer\ContainerAdapter.cs" />
<Compile Include="HttpServer\GetSwaggerResource.cs" />
<Compile Include="HttpServer\HttpListenerHost.cs" /> <Compile Include="HttpServer\HttpListenerHost.cs" />
<Compile Include="HttpServer\HttpResultFactory.cs" /> <Compile Include="HttpServer\HttpResultFactory.cs" />
<Compile Include="HttpServer\LoggerUtils.cs" /> <Compile Include="HttpServer\LoggerUtils.cs" />
@ -132,15 +125,12 @@
<Compile Include="HttpServer\ServerFactory.cs" /> <Compile Include="HttpServer\ServerFactory.cs" />
<Compile Include="HttpServer\ServerLogFactory.cs" /> <Compile Include="HttpServer\ServerLogFactory.cs" />
<Compile Include="HttpServer\ServerLogger.cs" /> <Compile Include="HttpServer\ServerLogger.cs" />
<Compile Include="HttpServer\SocketSharp\HttpUtility.cs" />
<Compile Include="HttpServer\SocketSharp\SharpWebSocket.cs" /> <Compile Include="HttpServer\SocketSharp\SharpWebSocket.cs" />
<Compile Include="HttpServer\SwaggerService.cs" />
<Compile Include="HttpServer\SocketSharp\Extensions.cs" /> <Compile Include="HttpServer\SocketSharp\Extensions.cs" />
<Compile Include="HttpServer\SocketSharp\RequestMono.cs" /> <Compile Include="HttpServer\SocketSharp\RequestMono.cs" />
<Compile Include="HttpServer\SocketSharp\WebSocketSharpListener.cs" /> <Compile Include="HttpServer\SocketSharp\WebSocketSharpListener.cs" />
<Compile Include="HttpServer\SocketSharp\WebSocketSharpRequest.cs" /> <Compile Include="HttpServer\SocketSharp\WebSocketSharpRequest.cs" />
<Compile Include="HttpServer\SocketSharp\WebSocketSharpResponse.cs" /> <Compile Include="HttpServer\SocketSharp\WebSocketSharpResponse.cs" />
<Compile Include="IO\FileRefresher.cs" />
<Compile Include="IO\LibraryMonitor.cs" /> <Compile Include="IO\LibraryMonitor.cs" />
<Compile Include="IO\MemoryStreamProvider.cs" /> <Compile Include="IO\MemoryStreamProvider.cs" />
<Compile Include="LiveTv\TunerHosts\SatIp\ChannelScan.cs" /> <Compile Include="LiveTv\TunerHosts\SatIp\ChannelScan.cs" />
@ -165,8 +155,6 @@
<Compile Include="LiveTv\TunerHosts\SatIp\SatIpHost.cs" /> <Compile Include="LiveTv\TunerHosts\SatIp\SatIpHost.cs" />
<Compile Include="LiveTv\TunerHosts\SatIp\TransmissionMode.cs" /> <Compile Include="LiveTv\TunerHosts\SatIp\TransmissionMode.cs" />
<Compile Include="LiveTv\TunerHosts\SatIp\Utils.cs" /> <Compile Include="LiveTv\TunerHosts\SatIp\Utils.cs" />
<Compile Include="Localization\LocalizationManager.cs" />
<Compile Include="Logging\PatternsLogger.cs" />
<Compile Include="Persistence\BaseSqliteRepository.cs" /> <Compile Include="Persistence\BaseSqliteRepository.cs" />
<Compile Include="Persistence\DataExtensions.cs" /> <Compile Include="Persistence\DataExtensions.cs" />
<Compile Include="Persistence\IDbConnector.cs" /> <Compile Include="Persistence\IDbConnector.cs" />
@ -180,15 +168,12 @@
<Compile Include="Playlists\ManualPlaylistsFolder.cs" /> <Compile Include="Playlists\ManualPlaylistsFolder.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Security\AuthenticationRepository.cs" /> <Compile Include="Security\AuthenticationRepository.cs" />
<Compile Include="Security\EncryptionManager.cs" />
<Compile Include="ServerApplicationPaths.cs" /> <Compile Include="ServerApplicationPaths.cs" />
<Compile Include="Persistence\SqliteDisplayPreferencesRepository.cs" /> <Compile Include="Persistence\SqliteDisplayPreferencesRepository.cs" />
<Compile Include="Persistence\SqliteItemRepository.cs" /> <Compile Include="Persistence\SqliteItemRepository.cs" />
<Compile Include="Persistence\SqliteUserDataRepository.cs" /> <Compile Include="Persistence\SqliteUserDataRepository.cs" />
<Compile Include="Persistence\SqliteUserRepository.cs" /> <Compile Include="Persistence\SqliteUserRepository.cs" />
<Compile Include="Sync\SyncRepository.cs" /> <Compile Include="Sync\SyncRepository.cs" />
<Compile Include="Udp\UdpMessageReceivedEventArgs.cs" />
<Compile Include="Udp\UdpServer.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Emby.Server.Implementations\Emby.Server.Implementations.csproj"> <ProjectReference Include="..\Emby.Server.Implementations\Emby.Server.Implementations.csproj">
@ -213,162 +198,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\backbone-min.js">
<Link>swagger-ui\lib\backbone-min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\handlebars-2.0.0.js">
<Link>swagger-ui\lib\handlebars-2.0.0.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\highlight.7.3.pack.js">
<Link>swagger-ui\lib\highlight.7.3.pack.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery-1.8.0.min.js">
<Link>swagger-ui\lib\jquery-1.8.0.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery.ba-bbq.min.js">
<Link>swagger-ui\lib\jquery.ba-bbq.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery.slideto.min.js">
<Link>swagger-ui\lib\jquery.slideto.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery.wiggle.min.js">
<Link>swagger-ui\lib\jquery.wiggle.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\marked.js">
<Link>swagger-ui\lib\marked.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\shred.bundle.js">
<Link>swagger-ui\lib\shred.bundle.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\swagger-client.js">
<Link>swagger-ui\lib\swagger-client.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\swagger-oauth.js">
<Link>swagger-ui\lib\swagger-oauth.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\underscore-min.js">
<Link>swagger-ui\lib\underscore-min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\o2c.html">
<Link>swagger-ui\o2c.html</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\patch.js">
<Link>swagger-ui\patch.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\swagger-ui.js">
<Link>swagger-ui\swagger-ui.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\swagger-ui.min.js">
<Link>swagger-ui\swagger-ui.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-700.eot">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.eot</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-700.ttf">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.ttf</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-700.woff">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.woff</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-700.woff2">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.woff2</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-regular.eot">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.eot</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-regular.ttf">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.ttf</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-regular.woff">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.woff</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-regular.woff2">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.woff2</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<EmbeddedResource Include="Localization\Ratings\us.txt" />
<EmbeddedResource Include="Localization\Ratings\ru.txt" />
<EmbeddedResource Include="Localization\Ratings\nz.txt" />
<EmbeddedResource Include="Localization\Ratings\nl.txt" />
<EmbeddedResource Include="Localization\Ratings\mx.txt" />
<EmbeddedResource Include="Localization\Ratings\kz.txt" />
<EmbeddedResource Include="Localization\Ratings\jp.txt" />
<EmbeddedResource Include="Localization\Ratings\ie.txt" />
<EmbeddedResource Include="Localization\Ratings\gb.txt" />
<EmbeddedResource Include="Localization\Ratings\fr.txt" />
<EmbeddedResource Include="Localization\Ratings\dk.txt" />
<EmbeddedResource Include="Localization\Ratings\de.txt" />
<EmbeddedResource Include="Localization\Ratings\co.txt" />
<EmbeddedResource Include="Localization\Ratings\ca.txt" />
<EmbeddedResource Include="Localization\Ratings\br.txt" />
<EmbeddedResource Include="Localization\Ratings\be.txt" />
<EmbeddedResource Include="Localization\Ratings\au.txt" />
<EmbeddedResource Include="Localization\iso6392.txt" />
<None Include="app.config" /> <None Include="app.config" />
<EmbeddedResource Include="Localization\Core\ar.json" />
<EmbeddedResource Include="Localization\Core\bg-BG.json" />
<EmbeddedResource Include="Localization\Core\ca.json" />
<EmbeddedResource Include="Localization\Core\core.json" />
<EmbeddedResource Include="Localization\Core\cs.json" />
<EmbeddedResource Include="Localization\Core\da.json" />
<EmbeddedResource Include="Localization\Core\de.json" />
<EmbeddedResource Include="Localization\Core\el.json" />
<EmbeddedResource Include="Localization\Core\en-GB.json" />
<EmbeddedResource Include="Localization\Core\en-US.json" />
<EmbeddedResource Include="Localization\Core\es-AR.json" />
<EmbeddedResource Include="Localization\Core\es-MX.json" />
<EmbeddedResource Include="Localization\Core\es.json" />
<EmbeddedResource Include="Localization\Core\fi.json" />
<EmbeddedResource Include="Localization\Core\fr-CA.json" />
<EmbeddedResource Include="Localization\Core\fr.json" />
<EmbeddedResource Include="Localization\Core\gsw.json" />
<EmbeddedResource Include="Localization\Core\he.json" />
<EmbeddedResource Include="Localization\Core\hr.json" />
<EmbeddedResource Include="Localization\Core\hu.json" />
<EmbeddedResource Include="Localization\Core\id.json" />
<EmbeddedResource Include="Localization\Core\it.json" />
<EmbeddedResource Include="Localization\Core\kk.json" />
<EmbeddedResource Include="Localization\Core\ko.json" />
<EmbeddedResource Include="Localization\Core\ms.json" />
<EmbeddedResource Include="Localization\Core\nb.json" />
<EmbeddedResource Include="Localization\Core\nl.json" />
<EmbeddedResource Include="Localization\Core\pl.json" />
<EmbeddedResource Include="Localization\Core\pt-BR.json" />
<EmbeddedResource Include="Localization\Core\pt-PT.json" />
<EmbeddedResource Include="Localization\Core\ro.json" />
<EmbeddedResource Include="Localization\Core\ru.json" />
<EmbeddedResource Include="Localization\Core\sl-SI.json" />
<EmbeddedResource Include="Localization\Core\sv.json" />
<EmbeddedResource Include="Localization\Core\tr.json" />
<EmbeddedResource Include="Localization\Core\uk.json" />
<EmbeddedResource Include="Localization\Core\vi.json" />
<EmbeddedResource Include="Localization\Core\zh-CN.json" />
<EmbeddedResource Include="Localization\Core\zh-HK.json" />
<EmbeddedResource Include="Localization\Core\zh-TW.json" />
<EmbeddedResource Include="Localization\countries.json" />
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0030.ini" /> <None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0030.ini" />
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0049.ini" /> <None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0049.ini" />
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0070.ini" /> <None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0070.ini" />
@ -540,56 +370,6 @@
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3594.ini" /> <None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3594.ini" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\css\reset.css">
<Link>swagger-ui\css\reset.css</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\css\screen.css">
<Link>swagger-ui\css\screen.css</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\css\typography.css">
<Link>swagger-ui\css\typography.css</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-700.svg">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.svg</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-regular.svg">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.svg</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\images\explorer_icons.png">
<Link>swagger-ui\images\explorer_icons.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\images\logo_small.png">
<Link>swagger-ui\images\logo_small.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\images\pet_store_api.png">
<Link>swagger-ui\images\pet_store_api.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\images\throbber.gif">
<Link>swagger-ui\images\throbber.gif</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\images\wordnik_api.png">
<Link>swagger-ui\images\wordnik_api.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\index.html">
<Link>swagger-ui\index.html</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\shred\content.js">
<Link>swagger-ui\lib\shred\content.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup /> <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

Some files were not shown because too many files have changed in this diff Show More