public static ArchiveExtractResult Unrar(RarArchive extractor, string outputFolder, System.EventHandler <ExtractProgress> progress_callback) { Dictionary <bool, List <SharpCompress.Common.IEntry> > myList = new Dictionary <bool, List <SharpCompress.Common.IEntry> >(); myList.Add(true, new List <SharpCompress.Common.IEntry>()); myList.Add(false, new List <SharpCompress.Common.IEntry>()); int total = extractor.Entries.Count; int extractedindex = 0; using (var entries = extractor.ExtractAllEntries()) while (entries.MoveToNextEntry()) { try { FileInfo fi = new FileInfo(Path.Combine(outputFolder, entries.Entry.Key)); FileSystem.CreateDirectory(fi.DirectoryName); using (FileStream fs = fi.Create()) { entries.WriteEntryTo(fs); fs.Flush(); } myList[true].Add(entries.Entry); } catch (System.Exception) { myList[false].Add(entries.Entry); } extractedindex++; if (progress_callback != null) { syncContext.Post(new System.Threading.SendOrPostCallback(delegate { progress_callback?.Invoke(extractor, new ExtractProgress(total, extractedindex)); }), null); } } return(new ArchiveExtractResult(myList)); }