{
// destFileName= System.IO.Path.GetRandomFileName();
string filename = System.IO.Path.GetFileNameWithoutExtension(objFileName);
string path = System.IO.Path.GetDirectoryName(objFileName);
string destFileName = path + "\\"+filename + ".dcw";
// Crc32 crc = new Crc32();
ZipOutputStream s = new ZipOutputStream(File.Create(destFileName));
s.Password = "\\\\b'+e(c)+'\\\\b','g'),k[c";
s.SetLevel(6); // 0 - store only to 9 - means best compression
//定義
// System.IO.DirectoryInfo myDir = new DirectoryInfo(path);
if (System.IO.File.Exists(objFileName))
{
// System.IO.FileInfo[] myFileAry = myDir.GetFiles();
//循環提取文件夾下每壹個文件,提取信息,
//foreach (FileInfo objFiles in myFileAry)
//{
FileStream fs = File.OpenRead(objFileName);
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
ZipEntry entry = new ZipEntry(System.IO.Path.GetFileName(objFileName));
entry.DateTime = DateTime.Now;
entry.Size = fs.Length;
fs.Close();
// crc.Reset();
// crc.Update(buffer);
// entry.Crc = crc.Value;
s.PutNextEntry(entry);
s.Write(buffer, 0, buffer.Length);
//}
s.Finish();
s.Close();
System.IO.File.Delete(objFileName);
}
}