示例#1
0
        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);
        }
示例#2
0
        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;
        }