//存入数据库 BOOL CnpadBookApp::changSaveToDbStatus(BOOL isSave,int cID,LPCTSTR cName){ int bufferID=::SendMessage(nppData._nppHandle, NPPM_GETCURRENTBUFFERID,0,0); if(bufferID>0){ articleInfo* aInfo=pArticleManage->find(bufferID,FBufferID); if(aInfo!=NULL && isSave){ aInfo->isSavetoDb=TRUE; aInfo->cID=cID; ZeroMemory(aInfo->className,lstrlen(aInfo->className)); lstrcpy(aInfo->className,cName); if(aInfo->ID==0){ CInputDB insert; insert.getText(aInfo,TRUE); } else if(aInfo->cID==0 ||lstrlen(aInfo->className)<=0){ getArticleInfo(aInfo); pBookDlg->activeChange(aInfo); //更新分类 } }else{ aInfo->isSavetoDb=FALSE; } }else if(!isSave){ TCHAR path[MAX_PATH]; ZeroMemory(path,MAX_PATH); ::SendMessage(nppData._nppHandle, NPPM_GETFULLPATHFROMBUFFERID,bufferID,(LPARAM)path); wchar_t* pos=wcschr(path,_T('\\')); if(pos!=NULL){ int id=0; articleInfo* pt=pArticleManage->add_bufferID(id,bufferID,path,pBookDlg->getNowClassID()); if(!pt) return FALSE; id=articleIsExist(path); pt->ID=id; if(id==0){ CInputDB insert; insert.getText(pt,TRUE); } else if(pt->cID==0 ||lstrlen(pt->className)<=0){ getArticleInfo(pt); } pBookDlg->activeChange(pt); //pBookDlg->activeChange(pt); } } return TRUE; }
BOOL CnpadBookApp::addNewInfo(int bufferID){ TCHAR path[MAX_PATH]; ZeroMemory(path,MAX_PATH); ::SendMessage(nppData._nppHandle, NPPM_GETFULLPATHFROMBUFFERID,bufferID,(LPARAM)path); wchar_t* pos=wcschr(path,_T('\\')); if(pos!=NULL){ int id=0; articleInfo* pt=pArticleManage->add_bufferID(id,bufferID,path,pBookDlg->getNowClassID()); if(!pt) return FALSE; id=articleIsExist(path); pt->ID=id; if(id==0){ pt->isSavetoDb=TRUE; CInputDB insert; insert.getText(pt,TRUE); } else if(pt->cID==0 ||lstrlen(pt->className)<=0){ getArticleInfo(pt); } pBookDlg->activeChange(pt); //pBookDlg->activeChange(pt); } else{ pBookDlg->activeNullInfo(); } }
/*retrieve article info*/ article_info *retrievearticleinfo_1_svc(article_request *ar, struct svc_req *cl) { static article_info ai; int res = getArticleInfo(ar->articleID, &ai); if(res == 1) { ai.id = ar->articleID; } else { ai.id = -1; } return &ai; }