update .net core startup

This commit is contained in:
Luke Pulverenti
2016-11-13 16:04:21 -05:00
parent 3c55747cd6
commit 0e9cd51f9c
38 changed files with 355 additions and 325 deletions

View File

@@ -326,7 +326,7 @@ namespace Emby.Common.Implementations
builder.AppendLine(string.Format("Processor count: {0}", Environment.ProcessorCount));
builder.AppendLine(string.Format("Program data path: {0}", appPaths.ProgramDataPath));
builder.AppendLine(string.Format("Application Path: {0}", appPaths.ApplicationPath));
builder.AppendLine(string.Format("Application directory: {0}", appPaths.ProgramSystemPath));
return builder;
}
@@ -548,7 +548,7 @@ return null;
TimerFactory = new TimerFactory();
RegisterSingleInstance(TimerFactory);
SocketFactory = new SocketFactory(null);
SocketFactory = new SocketFactory(LogManager.GetLogger("SocketFactory"));
RegisterSingleInstance(SocketFactory);
RegisterSingleInstance(CryptographyProvider);

View File

@@ -12,22 +12,18 @@ namespace Emby.Common.Implementations
/// <summary>
/// Initializes a new instance of the <see cref="BaseApplicationPaths"/> class.
/// </summary>
protected BaseApplicationPaths(string programDataPath, string applicationPath)
protected BaseApplicationPaths(string programDataPath, string appFolderPath)
{
ProgramDataPath = programDataPath;
ApplicationPath = applicationPath;
ProgramSystemPath = appFolderPath;
}
public string ApplicationPath { get; private set; }
public string ProgramDataPath { get; private set; }
/// <summary>
/// Gets the path to the system folder
/// </summary>
public string ProgramSystemPath
{
get { return Path.GetDirectoryName(ApplicationPath); }
}
public string ProgramSystemPath { get; private set; }
/// <summary>
/// The _data directory

View File

@@ -95,5 +95,15 @@ namespace Emby.Common.Implementations.EnvironmentInfo
return MediaBrowser.Model.System.Architecture.X64;
}
}
public string GetEnvironmentVariable(string name)
{
return Environment.GetEnvironmentVariable(name);
}
public virtual string GetUserId()
{
return null;
}
}
}

View File

@@ -57,6 +57,14 @@ namespace Emby.Common.Implementations.IO
}
}
public char PathSeparator
{
get
{
return Path.DirectorySeparatorChar;
}
}
public string GetFullPath(string path)
{
return Path.GetFullPath(path);

View File

@@ -15,6 +15,15 @@ namespace Emby.Common.Implementations.Net
public NetSocket(Socket socket, ILogger logger)
{
if (socket == null)
{
throw new ArgumentNullException("socket");
}
if (logger == null)
{
throw new ArgumentNullException("logger");
}
Socket = socket;
_logger = logger;
}

View File

@@ -14,6 +14,23 @@ namespace Emby.Common.Implementations.Net
public SocketAcceptor(ILogger logger, Socket originalSocket, Action<ISocket> onAccept, Func<bool> isClosed)
{
if (logger == null)
{
throw new ArgumentNullException("logger");
}
if (originalSocket == null)
{
throw new ArgumentNullException("originalSocket");
}
if (onAccept == null)
{
throw new ArgumentNullException("onAccept");
}
if (isClosed == null)
{
throw new ArgumentNullException("isClosed");
}
_logger = logger;
_originalSocket = originalSocket;
_isClosed = isClosed;
@@ -101,11 +118,8 @@ namespace Emby.Common.Implementations.Net
_onAccept(new NetSocket(acceptSocket, _logger));
}
if (_originalSocket != null)
{
// Accept the next connection request
StartAccept(e, ref acceptSocket);
}
// Accept the next connection request
StartAccept(e, ref acceptSocket);
}
}
}

View File

@@ -23,10 +23,15 @@ namespace Emby.Common.Implementations.Net
/// </summary>
private IPAddress _LocalIP;
private ILogger _logger;
private readonly ILogger _logger;
public SocketFactory(ILogger logger)
{
if (logger == null)
{
throw new ArgumentNullException("logger");
}
_logger = logger;
_LocalIP = IPAddress.Any;
}