ICSharpCode.SharpZipLib 및 DotNetZip을 다운로드했습니다. 나는 meg를 4 megs로 변화시키면서 한 번에 100 개가 넘는 파일들을 압축하고있다. ICSharpCode를 사용할 때 'ContextSwitchDeadlock'오류가 발생합니다. DotNetZip은 파일을 매번 종료하지 못합니다.수많은 파일을 압축하는 라이브러리 또는 도구가 있습니까?
또한, 나는 셰어 폴더에서 일하고 있어요
private bool zipall()
//ICSharpCode
{
int i = 0;
progressBarzipping.Minimum = 0;
progressBarzipping.Maximum = listBoxfiles.Items.Count;
ZipOutputStream zipOut = new ZipOutputStream(File.Create(textBoxDropPath.Text + "\\" + textBoxZipFileName.Text + ".zip"));
foreach (string fName in listBoxfiles.Items)
{
try
{
FileInfo fi = new FileInfo(fName);
ZipEntry entry = new ZipEntry(fi.Name);
FileStream sReader = File.OpenRead(fName);
byte[] buff = new byte[Convert.ToInt32(sReader.Length)];
sReader.Read(buff, 0, (int)sReader.Length);
entry.DateTime = fi.LastWriteTime;
entry.Size = sReader.Length;
sReader.Close();
zipOut.PutNextEntry(entry);
zipOut.Write(buff, 0, buff.Length);
}
catch
{
MessageBox.Show("Zip Failed");
zipOut.Finish();
zipOut.Close();
progressBarzipping.Value = 0;
return false;
}
i++;
progressBarzipping.Value = i;
}
zipOut.Finish();
zipOut.Close();
MessageBox.Show("Zip Complete");
progressBarzipping.Value = 0;
return true;
}
//Not sure but I think this was my DotNetZip approach
//using (ZipFile zip = new ZipFile())
// {
// foreach(string file in listboxFiles.Items)
// {
// zip.AddFile(file);
// }
// zip.Save(PathToNewZip);
// }
DotNetZip 용 코드와 예외 사항을 표시하면 도움을 드리겠습니다. 그것은 100,000 이상의 파일, 10 기가 바이트 또는 그 이상으로 잘 작동합니다. – Cheeso