internal static IEnumerable <RarArchiveVolume> GetParts(FileInfo fileInfo, RarOptions options) { var part = new FileInfoRarArchiveVolume(fileInfo, options); yield return(part); if (!part.ArchiveHeader.ArchiveHeaderFlags.HasFlag(ArchiveFlags.VOLUME)) { yield break; //if file isn't volume then there is no reason to look } ArchiveHeader ah = part.ArchiveHeader; fileInfo = GetNextFileInfo(ah, part.FileParts.FirstOrDefault() as FileInfoRarFilePart); //we use fileinfo because rar is dumb and looks at file names rather than archive info for another volume while (fileInfo != null) { part = new FileInfoRarArchiveVolume(fileInfo, options); fileInfo = GetNextFileInfo(ah, part.FileParts.FirstOrDefault() as FileInfoRarFilePart); if (!fileInfo.Exists) { yield break; } yield return(part); } }
internal static IEnumerable<RarArchiveVolume> GetParts(FileInfo fileInfo, RarOptions options) { var part = new FileInfoRarArchiveVolume(fileInfo, options); yield return part; if (!part.ArchiveHeader.ArchiveHeaderFlags.HasFlag(ArchiveFlags.VOLUME)) { yield break; //if file isn't volume then there is no reason to look } ArchiveHeader ah = part.ArchiveHeader; fileInfo = GetNextFileInfo(ah, part.FileParts.FirstOrDefault() as FileInfoRarFilePart); //we use fileinfo because rar is dumb and looks at file names rather than archive info for another volume while (fileInfo != null) { part = new FileInfoRarArchiveVolume(fileInfo, options); fileInfo = GetNextFileInfo(ah, part.FileParts.FirstOrDefault() as FileInfoRarFilePart); if (!fileInfo.Exists) yield break; yield return part; } }