2
我正在使用chilkat庫壓縮一些文件並將它們移動到另一個路徑。這在大多數情況下都可以正常工作,但有時在我的exe文件所在的路徑中有一個tmp文件。現在我在3個月後突然檢查,這個文件已經佔用了2 GB的硬盤。以下是我的代碼:在使用chilkat庫進行壓縮/解壓縮時遇到一些問題
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路徑可能無法接受。 – spender 2011-03-24 14:51:31
只是想知道它是否使chilkat使這個臨時文件在可執行文件path.this代碼作爲一個計劃任務運行,間隔爲30秒 – 2011-03-24 15:48:51