c# - Extracting files using SevenZip -
im getting exception in can 1 me?
exception:unable cast com object of type 'system.__comobject' interface type 'sevenzip.iinarchive'. operation failed because queryinterface call on com component interface iid '{23170f69-40c1-278a-0000-000600600000}' failed due following error: no such interface supported (exception hresult: 0x80004002 (e_nointerface))
code:
private void unzip(string ziptoextract, string unzipdirectoryl) // extract zip/lot file in same directory { #region extraction test - extractfiles using (var tmp = new sevenzipextractor(ziptoextract)) { if (this.progressbar1.invokerequired) { progressbar1.invoke(new action(delegate() { progressbar1.maximum = tmp.archivefiledata.count; progressbar1.value = 0; })); } else { progressbar1.maximum = tmp.archivefiledata.count; progressbar1.value = 0; } (int = 0; < tmp.archivefiledata.count; i++) { tmp.extractfiles(unzipdirectoryl, tmp.archivefiledata[i].index); int tempval = 0,tot=0; if (this.progressbar1.invokerequired) { progressbar1.invoke(new action(delegate() { progressbar1.value++; tempval = progressbar1.value; progressbar1.refresh(); tot = progressbar1.maximum; })); } else { progressbar1.value++; //pseudo-code progressbar1.refresh(); tempval = progressbar1.value; tot = progressbar1.maximum; } //progressbar1.value += 1; //progressbar1.refresh(); if (this.label3.invokerequired) { label3.invoke(new action(delegate() { label3.text = ((tempval * 100) / (tot)).tostring(); label3.refresh(); })); } else { label3.text = ((tempval * 100) / (tmp.archivefiledata.count)).tostring(); label3.refresh(); } if (!tmp.archivefiledata[i].isdirectory) { fileinfo f = new fileinfo(unzipdirectoryl + "\\" + tmp.archivefiledata[i].filename); if (f.length == 0) { status("error :zero byte file observed: \\" + tmp.archivefiledata[i].filename, color.red); } } } // extract more 1 file @ time or when know files extract, // use //tmp.extractfiles(@"d:\temp\result", 1, 3, 5); } #endregion }
i got own solution : change gives me perfect out put why?
int temp= tmp.archivefiledata.count; if (this.progressbar1.invokerequired) { progressbar1.invoke(new action(delegate() { progressbar1.maximum = temp; progressbar1.value = 0; })); }
it me out of exception:
int temp= tmp.archivefiledata.count; if (this.progressbar1.invokerequired) { progressbar1.invoke(new action(delegate() { progressbar1.maximum = temp; progressbar1.value = 0; })); }
Comments
Post a Comment