intersection_kind direct_space_asu::does_intersect(const scitbx::double3 ¢er, const scitbx::double3 &box) const { const signed char n_corners = 2; rvector3_t asu_box_r[n_corners]; this->box_corners(asu_box_r[0], asu_box_r[1]); const scitbx::double3 asu_box[n_corners] = { conv_(asu_box_r[0]), conv_(asu_box_r[1])}; CCTBX_ASSERT( scitbx::ge_all(asu_box[1], asu_box[0]) ); const scitbx::double3 atom_box[n_corners] = { center - box, center + box }; CCTBX_ASSERT( scitbx::ge_all(atom_box[1], atom_box[0]) ); // need to test against enclosed_box for the 'fully' to work // if( scitbx::ge_all(atom_box[0], asu_enclosed_box[0]) && // scitbx::le_all(atom_box[1], asu_enclosed_box[1]) ) // return fully; if( scitbx::ge_all(atom_box[1], asu_box[0]) && scitbx::le_all(atom_box[0], asu_box[1]) ) return partially; return none; }
void DecompressManager::checkMd5() { TCHAR* targetDir = FileInfo::getInstance().getTargetFileName(); TCHAR jsonFileName[MAX_PATH] = {0}; wcscpy(jsonFileName, targetDir); wcscat(jsonFileName, L"F33APP\\AppMd5.json"); HANDLE jsonFile = CreateFile(jsonFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (jsonFile == INVALID_HANDLE_VALUE) { DWORD hr = GetLastError(); return ; } DWORD fileSize = GetFileSize(jsonFile, NULL); if (fileSize == -1) { return ; } char* jsonDocument = new char[fileSize]; if (jsonDocument == NULL) { return ; } DWORD readSize = 0; if (!ReadFile(jsonFile, jsonDocument, fileSize, &readSize, NULL)) { delete[] jsonDocument; return ; } Json::Reader reader; Json::Value jsonObject; if(reader.parse(jsonDocument, jsonObject) == false) { delete[] jsonDocument; decompressDelegate_->decompressError(JSON_FILE_PARSE_ERROR); return ; } Json::Value::Members member; member = jsonObject.getMemberNames(); for (Json::Value::Members::iterator iter = member.begin(); iter != member.end(); iter++) { TCHAR relativePath[MAX_PATH] = {0}; MultiByteToWideChar(GetACP(), 0, (*iter).c_str(), (*iter).size()*2, relativePath, MAX_PATH); FILE * fp = NULL; map<wstring, wstring >::iterator it; it=fileContainer_.find(relativePath); if(it==fileContainer_.end()) { //没有MD5值先忽略 continue; } wstring absolutePath((*it).second); if (absolutePath.find(L"AppMd5.json") != absolutePath.npos) { //MD5文件跳过 continue; } _wfopen_s(&fp, (*it).second.c_str(), L"rb"); if (fp == NULL) { continue ; } MD5VAL val=md5File(fp); char md5_result[MD5_KEY_MAX_LENGTH] = {0}; sprintf(md5_result, "%08x%08x%08x%08x",conv_(val.a),conv_(val.b),conv_(val.c),conv_(val.d)); fclose(fp); string origString = jsonObject[(*iter)].asString(); if (origString != md5_result) { delete[] jsonDocument; decompressDelegate_->decompressError(MD5_CHECK_ERROR); return ; } } delete[] jsonDocument; }