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); }
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; }
public MetaFile(ICookBookFile f, System.Threading.CancellationToken token) { this.Initialization = InitializeAsync(f, token); }
public Recipe(ICookBookFile File, CancellationToken token) => this.Initialization = InitializeAsync(File, token);