aboutsummaryrefslogtreecommitdiff
path: root/Emby.Common.Implementations
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Common.Implementations')
-rw-r--r--Emby.Common.Implementations/BaseApplicationHost.cs4
-rw-r--r--Emby.Common.Implementations/BaseApplicationPaths.cs10
-rw-r--r--Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs10
-rw-r--r--Emby.Common.Implementations/IO/ManagedFileSystem.cs8
-rw-r--r--Emby.Common.Implementations/Net/NetSocket.cs9
-rw-r--r--Emby.Common.Implementations/Net/SocketAcceptor.cs24
-rw-r--r--Emby.Common.Implementations/Net/SocketFactory.cs7
7 files changed, 57 insertions, 15 deletions
diff --git a/Emby.Common.Implementations/BaseApplicationHost.cs b/Emby.Common.Implementations/BaseApplicationHost.cs
index f0309511e..1f194968c 100644
--- a/Emby.Common.Implementations/BaseApplicationHost.cs
+++ b/Emby.Common.Implementations/BaseApplicationHost.cs
@@ -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);
diff --git a/Emby.Common.Implementations/BaseApplicationPaths.cs b/Emby.Common.Implementations/BaseApplicationPaths.cs
index 628d62bd4..8792778ba 100644
--- a/Emby.Common.Implementations/BaseApplicationPaths.cs
+++ b/Emby.Common.Implementations/BaseApplicationPaths.cs
@@ -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
diff --git a/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs b/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs
index 6a1b3ef74..c040e3931 100644
--- a/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs
+++ b/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs
@@ -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;
+ }
}
}
diff --git a/Emby.Common.Implementations/IO/ManagedFileSystem.cs b/Emby.Common.Implementations/IO/ManagedFileSystem.cs
index 1f0aa55fa..83bb50f94 100644
--- a/Emby.Common.Implementations/IO/ManagedFileSystem.cs
+++ b/Emby.Common.Implementations/IO/ManagedFileSystem.cs
@@ -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);
diff --git a/Emby.Common.Implementations/Net/NetSocket.cs b/Emby.Common.Implementations/Net/NetSocket.cs
index faa1a81e2..62ca3d6ac 100644
--- a/Emby.Common.Implementations/Net/NetSocket.cs
+++ b/Emby.Common.Implementations/Net/NetSocket.cs
@@ -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;
}
diff --git a/Emby.Common.Implementations/Net/SocketAcceptor.cs b/Emby.Common.Implementations/Net/SocketAcceptor.cs
index fd65e9fbc..bddb7a079 100644
--- a/Emby.Common.Implementations/Net/SocketAcceptor.cs
+++ b/Emby.Common.Implementations/Net/SocketAcceptor.cs
@@ -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);
}
}
}
diff --git a/Emby.Common.Implementations/Net/SocketFactory.cs b/Emby.Common.Implementations/Net/SocketFactory.cs
index 922b0f3cc..f26137683 100644
--- a/Emby.Common.Implementations/Net/SocketFactory.cs
+++ b/Emby.Common.Implementations/Net/SocketFactory.cs
@@ -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;
}