当前位置: 首页>>代码示例>>C++>>正文


C++ Attachment::getID方法代码示例

本文整理汇总了C++中Attachment::getID方法的典型用法代码示例。如果您正苦于以下问题:C++ Attachment::getID方法的具体用法?C++ Attachment::getID怎么用?C++ Attachment::getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Attachment的用法示例。


在下文中一共展示了Attachment::getID方法的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);
	}

}
开发者ID:jennmat,项目名称:Cinch,代码行数:70,代码来源:AttachmentViewer.cpp


注:本文中的Attachment::getID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。