aboutsummaryrefslogtreecommitdiff
path: root/Emby.Common.Implementations
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-11-14 02:29:42 -0500
committerGitHub <noreply@github.com>2016-11-14 02:29:42 -0500
commit54d3c2eed767b6d030961f9a75216c447f94abef (patch)
tree1855731242b35ffbed16beb1c96de1e6442a797e /Emby.Common.Implementations
parente8379b865c301cb8ab65eb5b883c44abdbedcf79 (diff)
parent43c69713835afee3d27ced041e5f96ec36fa0ce3 (diff)
Merge pull request #2288 from MediaBrowser/dev
Dev
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.cs13
-rw-r--r--Emby.Common.Implementations/IO/WindowsFileSystem.cs13
-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
8 files changed, 60 insertions, 30 deletions
diff --git a/Emby.Common.Implementations/BaseApplicationHost.cs b/Emby.Common.Implementations/BaseApplicationHost.cs
index f0309511e0..1f194968c8 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 628d62bd48..8792778ba6 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 6a1b3ef74c..c040e39313 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 81ca8dcff2..83bb50f942 100644
--- a/Emby.Common.Implementations/IO/ManagedFileSystem.cs
+++ b/Emby.Common.Implementations/IO/ManagedFileSystem.cs
@@ -18,12 +18,13 @@ namespace Emby.Common.Implementations.IO
private readonly bool _supportsAsyncFileStreams;
private char[] _invalidFileNameChars;
private readonly List<IShortcutHandler> _shortcutHandlers = new List<IShortcutHandler>();
- protected bool EnableFileSystemRequestConcat = true;
+ private bool EnableFileSystemRequestConcat = true;
- public ManagedFileSystem(ILogger logger, bool supportsAsyncFileStreams, bool enableManagedInvalidFileNameChars)
+ public ManagedFileSystem(ILogger logger, bool supportsAsyncFileStreams, bool enableManagedInvalidFileNameChars, bool enableFileSystemRequestConcat)
{
Logger = logger;
_supportsAsyncFileStreams = supportsAsyncFileStreams;
+ EnableFileSystemRequestConcat = enableFileSystemRequestConcat;
SetInvalidFileNameChars(enableManagedInvalidFileNameChars);
}
@@ -56,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/IO/WindowsFileSystem.cs b/Emby.Common.Implementations/IO/WindowsFileSystem.cs
deleted file mode 100644
index 3eafeb2f76..0000000000
--- a/Emby.Common.Implementations/IO/WindowsFileSystem.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using MediaBrowser.Model.Logging;
-
-namespace Emby.Common.Implementations.IO
-{
- public class WindowsFileSystem : ManagedFileSystem
- {
- public WindowsFileSystem(ILogger logger)
- : base(logger, true, true)
- {
- EnableFileSystemRequestConcat = false;
- }
- }
-}
diff --git a/Emby.Common.Implementations/Net/NetSocket.cs b/Emby.Common.Implementations/Net/NetSocket.cs
index faa1a81e2d..62ca3d6ac1 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 fd65e9fbc8..bddb7a079a 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 922b0f3cc5..f261376834 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;
}