本文整理汇总了C++中Attachment::getContentMD5方法的典型用法代码示例。如果您正苦于以下问题:C++ Attachment::getContentMD5方法的具体用法?C++ Attachment::getContentMD5怎么用?C++ Attachment::getContentMD5使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachment
的用法示例。
在下文中一共展示了Attachment::getContentMD5方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessChanges
void ProcessChanges(wchar_t* dir){
HANDLE hFind = INVALID_HANDLE_VALUE;
WIN32_FIND_DATA ffd;
TCHAR szDir[MAX_PATH];
StringCchCopy(szDir, MAX_PATH, dir);
StringCchCat(szDir, MAX_PATH, TEXT("\\*"));
stringstream idfile;
idfile << ws2s(dir) << "\\.id";
stringstream revfile;
revfile << ws2s(dir) << "\\.rev";
string id = readSingleLine(idfile.str().c_str());
string rev = readSingleLine(revfile.str().c_str());
if ( id.length() == 0 ){
return;
}
hFind = FindFirstFile(szDir, &ffd);
bool hasUploadedAttachments = false;
do
{
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
}
else
{
if ( wcscmp(L".id", ffd.cFileName) != 0 && wcscmp(L".rev", ffd.cFileName) != 0 ){
wchar_t filename[MAX_PATH];
StringCchCopy(filename, MAX_PATH, dir);
StringCchCat(filename, MAX_PATH, L"\\");
StringCchCat(filename, MAX_PATH, ffd.cFileName);
string c = md5file(filename);
/* Compare to content md5 of attachment in the db */
Document doc = db.getDocument(id, rev);
try {
Attachment a = doc.getAttachment(ws2s(ffd.cFileName));
string serverMD5 = a.getContentMD5();
const char* j = serverMD5.c_str();
int i = strcmp(c.c_str(), j);
if ( i != 0 ) {
doc.updateAttachmentFromFile(a.getID(), ws2s(filename));
hasUploadedAttachments = true;
}
}catch(AttachmentNotFoundException e){
doc.addAttachmentFromFile(ws2s(ffd.cFileName), "", ws2s(filename));
hasUploadedAttachments = true;
}
}
}
}
while (FindNextFile(hFind, &ffd) != 0);
FindClose(hFind);
if ( hasUploadedAttachments ){
PostMessage(GetParent(attachmentsHwnd), WM_ATTACHMENTS_UPLOADED, 0, 0);
}
}