00001 /* 00002 Free Download Manager Copyright (c) 2003-2007 FreeDownloadManager.ORG 00003 Open Download Manager Copyright (c) 2008-2010 OpenDownloadManager.ORG 00004 */ 00005 00006 #include "stdafx.h" 00007 #include "FdmApp.h" 00008 #include "vmsFilesToDelete.h" 00009 00010 #ifdef _DEBUG 00011 #undef THIS_FILE 00012 static char THIS_FILE[]=__FILE__; 00013 #define new DEBUG_NEW 00014 #endif 00015 00016 vmsFilesToDelete::vmsFilesToDelete() 00017 { 00018 00019 } 00020 00021 vmsFilesToDelete::~vmsFilesToDelete() 00022 { 00023 00024 } 00025 00026 void vmsFilesToDelete::AddFile(LPCSTR pszFile) 00027 { 00028 CStringList sl; 00029 00030 _App.FilesToDelete (sl); 00031 00032 sl.AddTail (pszFile); 00033 00034 _App.FilesToDelete_save (sl); 00035 } 00036 00037 void vmsFilesToDelete::Process() 00038 { 00039 CStringList sl; 00040 _App.FilesToDelete (sl); 00041 00042 for (int i = sl.GetCount () - 1; i >= 0; i--) 00043 { 00044 LPCSTR psz = sl.GetAt (sl.FindIndex (i)); 00045 BOOL bOK = TRUE; 00046 if (GetFileAttributes (psz) != DWORD (-1)) 00047 bOK = DeleteFile (psz); 00048 if (bOK) 00049 sl.RemoveAt (sl.FindIndex (i)); 00050 } 00051 00052 _App.FilesToDelete_save (sl); 00053 }
1.5.6