aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common.Implementations/Devices
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2015-10-26 18:50:19 -0400
committerLuke <luke.pulverenti@gmail.com>2015-10-26 18:50:19 -0400
commit35778ebc02e5931142a1fe31a256b7488a07c5c2 (patch)
treeced0290be8820f5e507b51ca4c5165212b1879d1 /MediaBrowser.Common.Implementations/Devices
parentc0dc8d055bfd4d2f58591083beb9e9128357aad6 (diff)
parent8d77308593c3b16b733b0109323770d9dfe7e166 (diff)
Merge pull request #1222 from MediaBrowser/dev
3.0.5768.7
Diffstat (limited to 'MediaBrowser.Common.Implementations/Devices')
-rw-r--r--MediaBrowser.Common.Implementations/Devices/DeviceId.cs18
1 files changed, 13 insertions, 5 deletions
diff --git a/MediaBrowser.Common.Implementations/Devices/DeviceId.cs b/MediaBrowser.Common.Implementations/Devices/DeviceId.cs
index 2a1c8877d7..4cad3cd314 100644
--- a/MediaBrowser.Common.Implementations/Devices/DeviceId.cs
+++ b/MediaBrowser.Common.Implementations/Devices/DeviceId.cs
@@ -3,13 +3,16 @@ using MediaBrowser.Model.Logging;
using System;
using System.IO;
using System.Text;
+using CommonIO;
+using MediaBrowser.Common.IO;
namespace MediaBrowser.Common.Implementations.Devices
{
public class DeviceId
{
private readonly IApplicationPaths _appPaths;
- private readonly ILogger _logger;
+ private readonly ILogger _logger;
+ private readonly IFileSystem _fileSystem;
private readonly object _syncLock = new object();
@@ -24,7 +27,7 @@ namespace MediaBrowser.Common.Implementations.Devices
{
lock (_syncLock)
{
- var value = File.ReadAllText(CachePath, Encoding.UTF8);
+ var value = File.ReadAllText(CachePath, Encoding.UTF8);
Guid guid;
if (Guid.TryParse(value, out guid))
@@ -55,11 +58,11 @@ namespace MediaBrowser.Common.Implementations.Devices
{
var path = CachePath;
- Directory.CreateDirectory(Path.GetDirectoryName(path));
+ _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
lock (_syncLock)
{
- File.WriteAllText(path, id, Encoding.UTF8);
+ _fileSystem.WriteAllText(path, id, Encoding.UTF8);
}
}
catch (Exception ex)
@@ -88,10 +91,15 @@ namespace MediaBrowser.Common.Implementations.Devices
private string _id;
- public DeviceId(IApplicationPaths appPaths, ILogger logger)
+ public DeviceId(IApplicationPaths appPaths, ILogger logger, IFileSystem fileSystem)
{
+ if (fileSystem == null) {
+ throw new ArgumentNullException ("fileSystem");
+ }
+
_appPaths = appPaths;
_logger = logger;
+ _fileSystem = fileSystem;
}
public string Value