private async ValueTask <IModuleMetadata> GetMetadataFromManifestResourceAsync(Assembly entryAssembly, string metadataFullName, CancellationToken cancellation) { using (var manifestStream = entryAssembly.GetManifestResourceStream(metadataFullName)) { return(await _metadataReader.ReadMetadataAsync(manifestStream, cancellation)); } }
private async Task <IModuleMetadata> LookupMetadataAsync(CancellationToken cancellation) { IModuleMetadata result; // TODO: Lookup metadata var filePath = Path.Combine(Directory.FullName, "module.json"); using (var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 4096, useAsync: true)) { result = await _metadataReader.ReadMetadataAsync(fileStream, cancellation); } return(result); }
private async Task DoWorkAsync(Database database) { IMetadataReader metadataReader = _shell.GetService <IMetadataReader>(); _shell.ShowStatusBarMessage(string.Empty); try { Progress <string> progress = new Progress <string>(ReportProgress); Stopwatch stopwatch = Stopwatch.StartNew(); await metadataReader.ReadMetadataAsync(database, progress); stopwatch.Stop(); _shell.ShowStatusBarMessage(stopwatch.ElapsedMilliseconds.ToString()); } catch (Exception error) { _ = MessageBox.Show($"{error.Message}", "ONE-C-SHARP", MessageBoxButton.OK, MessageBoxImage.Error); return; } }