C# 使用chilkat库进行压缩/解压缩时出现一些问题
我正在使用chilkat库压缩一些文件并将它们移动到另一个路径。这在大多数情况下都可以正常工作,但有时会在我的exe所在的路径中生成一个tmp文件。3个月后,我突然检查了一下,这些文件占用了2GB的硬盘空间。以下是我的代码:C# 使用chilkat库进行压缩/解压缩时出现一些问题,c#,zip,chilkat,C#,Zip,Chilkat,我正在使用chilkat库压缩一些文件并将它们移动到另一个路径。这在大多数情况下都可以正常工作,但有时会在我的exe所在的路径中生成一个tmp文件。3个月后,我突然检查了一下,这些文件占用了2GB的硬盘空间。以下是我的代码: public static bool MoveShopTRRFiles() { //string fullfilepath; Zip zip = new Zip(); bool unlocked =
public static bool MoveShopTRRFiles() {
//string fullfilepath;
Zip zip = new Zip();
bool unlocked = zip.UnlockComponent("abc");
if (!unlocked) {
//MessageBox.Show(zip.LastErrorText);
//return;
return false;
}
if (Directory.Exists(_TRRPath)) {
foreach (string filename in Directory.GetFiles(_TRRPath, "*.trr")) {
if (!File.Exists(_ShopTRRPath + "\\" + GetShopName(filename) + ".zip")) {
zip.NewZip(_ShopTRRPath + "\\" + GetShopName(filename) + ".zip");
} else {
zip.OpenZip(_ShopTRRPath + "\\" + GetShopName(filename) + ".zip");
}
try {
if(zip.GetEntryByName (filename.Substring(filename.LastIndexOf('\\') + 4))==null ){
zip.AppendOneFileOrDir(filename);
}
zip.WriteZipAndClose();
File.Delete(filename);
} catch {
}
}
return true;
} else
return false;
}
目前,我正在从应用程序文件夹中删除临时文件(如果有的话)。因此,这暂时解决了问题。目前,我正在从应用程序文件夹中删除临时文件(如果有的话)。因此,这暂时解决了问题。如果希望在UAC环境中安装此程序,则写入exe路径可能是不可接受的。只是想知道是否是chilkat使此临时文件位于可执行路径中。此代码作为调度任务运行,具有如果要在UAC环境中安装此程序,则30秒的间隔写入exe路径可能是不可接受的。只想知道是否是chilkat使此临时文件位于可执行路径中。此代码作为计划任务运行,间隔为30秒