Having some issues while using chilkat library for zipping/unzipping
I am using chilkat library for zipping some files and moving them to a another path. This works fine most of the time, but some times there is a tmp file made in path where my exe resides. Now I checked suddenly after 3 months,this files has gone to take 2 GB of hard disk. Following is my code:
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.NewZ开发者_Python百科ip(_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;
}
FOr now,i am deleting the temp files if any from the application folder.So this solves the problem for now.
精彩评论