private async Task <Manifest> GetLocalManifest() { return(await manifestName.Match(async name => { using (var stream = File.OpenRead(Path.Combine(applicationFolder, name))) using (var reader = new ManifestReader(stream)) return (await reader.ReadAsync()).GetValueOrThrow(); }, async() => { return await new ManifestCreator(applicationFolder).CreateAsync(channel.GetValueOrThrow(), new Version(0, 0, 0, 1)); })); }
private async Task <Result <Manifest, Exception> > GetRemoteManifest(Uri manifestUri) { var streamResult = await Helper.Try(async() => await uriLocator.Locate(manifestUri)); var manifestResult = await streamResult.BindAsync(async stream => { using (stream) using (var reader = new ManifestReader(stream)) return(await reader.ReadAsync()); }); return(manifestResult); }