Beispiel #1
0
        private async Task InitializeAsync(ICookBookFile File, CancellationToken token)
        {
            this.File = File;
            token.ThrowIfCancellationRequested();

            string metaContent = null;

            using (StreamReader sr = new StreamReader(File.Content))
            {
                metaContent = await sr.ReadToEndAsync().ConfigureAwait(false);
            }
            token.ThrowIfCancellationRequested();

            await ParseFile(metaContent, token);
        }
Beispiel #2
0
        private async Task InitializeAsync(ICookBookFile File, CancellationToken token)
        {
            if (!File.Content.CanSeek)
            {
                throw new Exception("");
            }
            string recipeFile = null;

            using (StreamReader sr = new StreamReader(File.Content))
            {
                recipeFile = await sr.ReadToEndAsync().ConfigureAwait(false);
            }
            if (recipeFile == null)
            {
                throw new IOException("File content was null:" + File.FullName);
            }
            token.ThrowIfCancellationRequested();

            await ParseFile(recipeFile);
        }
 public Knowledge(ICookBookFile f, System.Threading.CancellationToken token)
 {
     this.f = f;
 }
Beispiel #4
0
 public MetaFile(ICookBookFile f, System.Threading.CancellationToken token)
 {
     this.Initialization = InitializeAsync(f, token);
 }
Beispiel #5
0
 public Recipe(ICookBookFile File, CancellationToken token) => this.Initialization = InitializeAsync(File, token);