public Task SaveDevice(DeviceInfo device) { var path = Path.Combine(GetDevicePath(device.Id), "device.json"); Directory.CreateDirectory(Path.GetDirectoryName(path)); lock (_syncLock) { _json.SerializeToFile(device, path); _devices = null; } return Task.FromResult(true); }
private string GetUploadPath(DeviceInfo device) { if (!string.IsNullOrWhiteSpace(device.CameraUploadPath)) { return device.CameraUploadPath; } var config = _config.GetUploadOptions(); if (!string.IsNullOrWhiteSpace(config.CameraUploadPath)) { return config.CameraUploadPath; } var path = DefaultCameraUploadsPath; if (config.EnableCameraUploadSubfolders) { path = Path.Combine(path, _fileSystem.GetValidFilename(device.Name)); } return path; }