예제 #1
0
 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));
     }));
 }
예제 #2
0
        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);
        }