lazy entries leads to strange behavior


this doesn't execute as expected because of the lazy entries.

var rar = NUnrar.Archive.RarArchive.Open(item);
            var entries = rar.Entries.Where(r => r.FilePath.EndsWith("*.avi") || r.FilePath.EndsWith("*.mpg")).ToArray();
            Console.Write(item + ":");
            foreach (var entry in entries)

the console.writeline doesn't output until after the "a" is output.

I don't see a way to turn lazy off.

file attachments


adamhathcock wrote Jun 15, 2011 at 4:34 AM

I have witnessed this before. I will try to have a fix shortly.

evarlast wrote Jun 15, 2011 at 6:08 PM

I think it was not the lazy, but was 2 other bugs leading to unexpected behavior.

I've attached a patch.

adamhathcock wrote Jun 16, 2011 at 7:50 AM

Thanks, patch applied.

adamhathcock wrote Jul 1, 2011 at 3:33 PM

Actually, I'm going to have to revert the change to RarArchiveEntry.cs since this is wrong logic in the normal case. Do you have information as to why that change for you is necessary?

evarlast wrote Jul 1, 2011 at 4:05 PM

Yes, it tries to read past the last archive. e.g. part01..part18 is my multipart archive, it will throw exception about part19 not being there. But there is no part19.

adamhathcock wrote Jul 2, 2011 at 8:23 AM

Ah geez. You know what I did? I ported your fix wrongly to SharpCompress and then backported it wrongly to here. I will do testing again but I think I made a dumb mistake.

Thanks again for your patch :)