public Task ExportAsync(LFSBackupServiceOptions options) => Task.Run(async() => { var root = options.Folder; var pages = await _pageBackend.GetAllPagesAsync().ConfigureAwait(false); foreach (var page in pages) { // TODO Result var file = await _filesystem.CreateFileAsync(root, $"{page.Path.FullPath}{page.ContentType.FileExtension}").ConfigureAwait(false); await _filesystem.WriteTextAsync(file.Value, page.Content).ConfigureAwait(false); } // Feature Flag IsAssetsSyncEnabled if (_featureFlags.IsAssetsSyncEnabled && options.IsAssetsSyncEnabled) { var dataFolder = await _applicationData.GetDataFolderAsync().ConfigureAwait(false); var result = await _filesystem.GetAllFoldersAsync(dataFolder).ConfigureAwait(false); if (result.IsFailed) { return; } foreach (var folder in result.Value) { _filesystem.CopyAsync(folder, root); } } });
private async Task LoadPagesAsync() { var pages = await _pageBackend.GetAllPagesAsync(); foreach (var page in pages) { Pages.Add(page); } }