示例#1
0
//---------------------------------------------------------------------------
void __fastcall TClientAssistant::ClientsBrowseLeave(bool Next)
{
  if (Next) {
    if ((IsDataSetEmpty(SearchQuery)) ||
      !(DataSetFindValue(Clients, SearchQuery->FieldByName("ACCT_NBR")->AsString,
      "ACCT_NBR"))) {
      DatabaseError("No data found");
    }
    if ((Mode == camDelete) && ConfirmDelete()) {
      Clients->Delete();
      RefreshQuery(SearchQuery);
    }
  }
  else {
    SearchQuery->Close();
  }
}
示例#2
0
int MrRipper::DelFiles(struct PluginPanelItem *PanelItem, int ItemsNumber, int OpMode)
{    
    if (bPluginManager) return FALSE;

    TSaveScreen SS;
    DWORD StartTime=GetTickCount();
    BOOL WaitMessage=FALSE;
    double Progress1, Progress2;
    long FullSize, ProcessedBytes;
    int Owervrite = 0;
    void * FAT = NULL;    
    char TmpFile[MAX_PATH];

        //Dummy removing
        
        MakeCopyList(PanelItem, ItemsNumber);

        for (rip_vec::iterator I = copyfiles.begin(); I != copyfiles.end();I++)
                if (I->FileName[strlen(I->FileName)-1]=='\\'){            
                        continue;
                } else {                
                        if (I->Fmt == FMT_DUMMY){
                                for (rip_vec::iterator z=dummyfiles.begin(); z!=dummyfiles.end(); z++){
                                        if ((I->FileSize == z->FileSize)&&
                                                (I->StartOffset == z->StartOffset)) {
                                                        my_free(z->Description);
                                                        my_free(z->FileName);
                                                        my_free(z->Plugin);
                                                        dummyfiles.erase(z);
                                                        if (z==dummyfiles.end()) break;                                                 
                                        }
                                }
                        }        
        }    

        //Real deleting
    if (glbFmt == -1) return FALSE; //Do delete only if RIP-module support it

    FormatFinder FF(PluginPath);        
    FF.WorkFileSize = WorkFileSize;
    for (int i = 0; i<FF.GetFormatCount(); i++)             
        for (int j = 0; j<FF.GetnKnownFormats(i); j++)
            FF.SetActiveOpt(i, j, GetRegKey(HKEY_CURRENT_USER,"",FF.GetRegPath(i, j), 1));

    MakeCopyList(PanelItem, ItemsNumber);       
    
    FullSize = 0;
    
    for (i = 0; i < copyfiles.size(); i++)
        FullSize += copyfiles[i].FileSize;
                        
    ProcessedBytes = 0;                                                     
    
    if (FF.GetCanDelFile(glbFmt, glbPlugin)) {
        if (!FF.GetFAT(glbPlugin, glbFmt, RipFileName, &FAT)) {
            Free_copyfiles();
            return FALSE;
        }
        if (!ConfirmDelete()) {
            Free_copyfiles();
            return FALSE;
        }
        for (rip_vec::iterator I = copyfiles.begin(); I != copyfiles.end();I++){        
            if (I->FileName[strlen(I->FileName)-1]=='\\'){            
                continue;
            } else {                
                if (FF.DelFile(I->Plugin, I->Fmt, RipFileName, I->FileName, I->StartOffset, I->FileSize, I->UnpSize, &FAT)){
                    ProcessedBytes += I->FileSize;
                    WaitMessage=FALSE;
                    if (!OpMode & OPM_SILENT){                        
                        if (GetTickCount()-StartTime>500){
                            if (CheckForKey(VK_ESCAPE)) break;
                            Progress1 = 100.0;
                            Progress2 = ProcessedBytes; Progress2 *= 100; Progress2 /= FullSize;
                            char FileMsg[100], ProgressMsg1[100], ProgressMsg2[100];
                            FSF.sprintf(FileMsg,GetMsg(MDeleting), I->FileName);
                            FSF.sprintf(ProgressMsg1,GetMsg(MExtr1), Progress1);
                            FSF.sprintf(ProgressMsg2,GetMsg(MExtr2), Progress2);                                                                                        
                            const char *MsgItems[]={GetMsg(MExtraction),FileMsg, ProgressMsg1, ProgressMsg2};
                            Info.Message(Info.ModuleNumber,WaitMessage ? FMSG_LEFTALIGN|FMSG_KEEPBACKGROUND:FMSG_LEFTALIGN,NULL,MsgItems,sizeof(MsgItems)/sizeof(MsgItems[0]),0);
                            WaitMessage=TRUE;
                        }       
                    }                   
                } else {
                    if (DelError()==0) continue;
                    else break;
                }
            }
        }
    } else {
        DelIsNotSupportedByPlugin2();
    }

    FSF.sprintf(TmpFile, "%s%s", RipFileName, "~");
    if (!OpMode & OPM_SILENT){
        const char *MsgItems[]={GetMsg(MRecompile), GetMsg(MRecompileMsg)};
        Info.Message(Info.ModuleNumber,0,NULL,MsgItems,sizeof(MsgItems)/sizeof(MsgItems[0]),0);
    }
    if (FF.FreeFAT(glbPlugin, glbFmt, RipFileName, TmpFile, &FAT)) {                
        CopyFile(TmpFile, RipFileName, FALSE);
        DeleteFile(TmpFile);
    }
    
    this->FAT.DelItem(this->FAT.Root);
    Free_shownfiles();
    Free_copyfiles();
    Free_dirs();
    
    return TRUE;
}