/// <summary> /// Asynchronously enumerates the arrays from file. /// </summary> /// <param name="file"> /// The file from which to read arrays. /// </param> /// <returns> /// An enumerable collection of tasks that when completed return an <see cref="IHeaderArray"/> from file. /// </returns> public override IEnumerable <Task <IHeaderArray> > ReadArraysAsync(FilePath file) { using (ZipArchive archive = ZipFile.Open(file, ZipArchiveMode.Read)) { foreach (ZipArchiveEntry entry in archive.Entries) { yield return(Task.Run(async() => HeaderArray.Deserialize(await new StreamReader(entry.Open()).ReadToEndAsync()))); } } }
/// <summary> /// Enumerates the <see cref="IHeaderArray"/> collection from file. /// </summary> /// <param name="file"> /// The file from which to read arrays. /// </param> /// <returns> /// A <see cref="IHeaderArray"/> collection from the file. /// </returns> public override IEnumerable <IHeaderArray> ReadArrays(FilePath file) { if (file is null) { throw new ArgumentNullException(nameof(file)); } using (ZipArchive archive = ZipFile.Open(file, ZipArchiveMode.Read)) { foreach (ZipArchiveEntry entry in archive.Entries) { yield return(HeaderArray.Deserialize(new StreamReader(entry.Open()).ReadToEnd())); } } }