|
|
|
@ -23,7 +23,7 @@ namespace MediaBrowser.Server.Implementations.Devices
|
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
|
private readonly IFileSystem _fileSystem;
|
|
|
|
|
|
|
|
|
|
private List<DeviceInfo> _devices;
|
|
|
|
|
private Dictionary<string, DeviceInfo> _devices;
|
|
|
|
|
|
|
|
|
|
public DeviceRepository(IApplicationPaths appPaths, IJsonSerializer json, ILogger logger, IFileSystem fileSystem)
|
|
|
|
|
{
|
|
|
|
@ -51,7 +51,7 @@ namespace MediaBrowser.Server.Implementations.Devices
|
|
|
|
|
lock (_syncLock)
|
|
|
|
|
{
|
|
|
|
|
_json.SerializeToFile(device, path);
|
|
|
|
|
_devices = null;
|
|
|
|
|
_devices[device.Id] = device;
|
|
|
|
|
}
|
|
|
|
|
return Task.FromResult(true);
|
|
|
|
|
}
|
|
|
|
@ -95,9 +95,15 @@ namespace MediaBrowser.Server.Implementations.Devices
|
|
|
|
|
{
|
|
|
|
|
if (_devices == null)
|
|
|
|
|
{
|
|
|
|
|
_devices = LoadDevices().ToList();
|
|
|
|
|
_devices = new Dictionary<string, DeviceInfo>(StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
|
|
|
|
|
var devices = LoadDevices().ToList();
|
|
|
|
|
foreach (var device in devices)
|
|
|
|
|
{
|
|
|
|
|
_devices[device.Id] = device;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return _devices.ToList();
|
|
|
|
|
return _devices.Values.ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|