bool FileInfosFilter::PassesAttributesFilter(const FileInfo& fi) const { if (query_->ExcludeHiddenAndSystem && fi.IsHiddenOrSystem()) { return false; } if (query_->ExcludeFolders && fi.IsDirectory()) { return false; } if (query_->ExcludeFiles && !fi.IsDirectory()) { return false; } return true; }
void MainWindow::copyCurrentUrlToClipboard() { FileInfo * currentItem = _selectionModel->currentItem(); if ( currentItem ) { QClipboard * clipboard = QApplication::clipboard(); QString url = currentItem->url(); clipboard->setText( url ); showProgress( tr( "Copied to system clipboard: %1" ).arg( url ) ); } else { showProgress( tr( "No current item" ) ); } }
void Scanner::_ChangeToDesired() { if (fBusy || fDesiredPath.size() <= 0) return; char* workPath = strdup(fDesiredPath.c_str()); char* pathPtr = &workPath[1]; // skip leading '/' char* endOfPath = pathPtr + strlen(pathPtr); // Check the name of the root directory. It is a special case because // it has no parent data structure. FileInfo* checkDir = fSnapshot->rootDir; FileInfo* prefDir = NULL; char* sep = strchr(pathPtr, '/'); if (sep != NULL) *sep = '\0'; if (strcmp(pathPtr, checkDir->ref.name) == 0) { // Root directory matches, so follow the remainder of the path as // far as possible. prefDir = checkDir; pathPtr += 1 + strlen(pathPtr); while (pathPtr < endOfPath) { sep = strchr(pathPtr, '/'); if (sep != NULL) *sep = '\0'; checkDir = prefDir->FindChild(pathPtr); if (checkDir == NULL || checkDir->children.size() == 0) break; pathPtr += 1 + strlen(pathPtr); prefDir = checkDir; } } // If the desired path is the volume's root directory, default to the // volume display. if (prefDir == fSnapshot->rootDir) prefDir = NULL; ChangeDir(prefDir); free(workPath); fDesiredPath.erase(); }
void ServerContext::AnswerFile(RestApiOutput& output, const std::string& instancePublicId, FileContentType content) { FileInfo attachment; if (!index_.LookupAttachment(attachment, instancePublicId, content)) { throw OrthancException(ErrorCode_InternalError); } accessor_.SetCompressionForNextOperations(attachment.GetCompressionType()); std::auto_ptr<HttpFileSender> sender(accessor_.ConstructHttpFileSender(attachment.GetUuid())); sender->SetContentType("application/dicom"); sender->SetDownloadFilename(instancePublicId + ".dcm"); output.AnswerFile(*sender); }
bool FileContainerTemporary::directory_create(const std::string &dirname) { if (!is_opened()) return false; if (is_file(dirname)) return false; if (is_directory(dirname)) return true; if (!container_->directory_check_name(dirname)) return false; FileInfo info; info.name = fix_slashes(dirname); info.split_name(); info.is_directory = true; if (info.name_part_localname.empty() || !is_directory(info.name_part_directory)) return false; files_[info.name] = info; return true; }
//===----------------------------------------------------------------------===// int main(int argc, char **argv) { // Print a stack trace if we signal out. sys::PrintStackTraceOnErrorSignal(); PrettyStackTraceProgram X(argc, argv); llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. cl::ParseCommandLineOptions(argc, argv, "llvm coverage tool\n"); GCOVFile GF; if (InputGCNO.empty()) errs() << " " << argv[0] << ": No gcov input file!\n"; OwningPtr<MemoryBuffer> GCNO_Buff; if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputGCNO, GCNO_Buff)) { errs() << InputGCNO << ": " << ec.message() << "\n"; return 1; } GCOVBuffer GCNO_GB(GCNO_Buff.take()); if (!GF.read(GCNO_GB)) { errs() << "Invalid .gcno File!\n"; return 1; } if (!InputGCDA.empty()) { OwningPtr<MemoryBuffer> GCDA_Buff; if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputGCDA, GCDA_Buff)) { errs() << InputGCDA << ": " << ec.message() << "\n"; return 1; } GCOVBuffer GCDA_GB(GCDA_Buff.take()); if (!GF.read(GCDA_GB)) { errs() << "Invalid .gcda File!\n"; return 1; } } if (DumpGCOV) GF.dump(); FileInfo FI; GF.collectLineCounts(FI); FI.print(InputGCNO, InputGCDA); return 0; }
void NZBFile::CalcHashes() { TempFileList fileList; for (FileList::iterator it = m_pNZBInfo->GetFileList()->begin(); it != m_pNZBInfo->GetFileList()->end(); it++) { fileList.push_back(*it); } fileList.sort(CompareFileInfo); unsigned int iFullContentHash = 0; unsigned int iFilteredContentHash = 0; int iUseForFilteredCount = 0; for (TempFileList::iterator it = fileList.begin(); it != fileList.end(); it++) { FileInfo* pFileInfo = *it; // check file extension bool bSkip = !pFileInfo->GetParFile() && Util::MatchFileExt(pFileInfo->GetFilename(), g_pOptions->GetExtCleanupDisk(), ",;"); for (FileInfo::Articles::iterator it = pFileInfo->GetArticles()->begin(); it != pFileInfo->GetArticles()->end(); it++) { ArticleInfo* pArticle = *it; int iLen = strlen(pArticle->GetMessageID()); iFullContentHash = Util::HashBJ96(pArticle->GetMessageID(), iLen, iFullContentHash); if (!bSkip) { iFilteredContentHash = Util::HashBJ96(pArticle->GetMessageID(), iLen, iFilteredContentHash); iUseForFilteredCount++; } } } // if filtered hash is based on less than a half of files - do not use filtered hash at all if (iUseForFilteredCount < (int)fileList.size() / 2) { iFilteredContentHash = 0; } m_pNZBInfo->SetFullContentHash(iFullContentHash); m_pNZBInfo->SetFilteredContentHash(iFilteredContentHash); }
FileHandle::~FileHandle() { WriteToDisk(); FileInfo* fp = first_file_; while (fp != NULL) { FileInfo* fpn = fp->GetNext(); BlockInfo* bp = fp->GetFirstBlock(); while (bp != NULL) { BlockInfo* bpn = bp->GetNext(); delete bp; bp = bpn; } delete fp; fp = fpn; } }
void ServerContext::ChangeAttachmentCompression(const std::string& resourceId, FileContentType attachmentType, CompressionType compression) { LOG(INFO) << "Changing compression type for attachment " << EnumerationToString(attachmentType) << " of resource " << resourceId << " to " << compression; FileInfo attachment; if (!index_.LookupAttachment(attachment, resourceId, attachmentType)) { throw OrthancException(ErrorCode_UnknownResource); } if (attachment.GetCompressionType() == compression) { // Nothing to do return; } std::string content; StorageAccessor accessor(area_); accessor.Read(content, attachment); FileInfo modified = accessor.Write(content.empty() ? NULL : content.c_str(), content.size(), attachmentType, compression, storeMD5_); try { StoreStatus status = index_.AddAttachment(modified, resourceId); if (status != StoreStatus_Success) { accessor.Remove(modified); throw OrthancException(ErrorCode_Database); } } catch (OrthancException&) { accessor.Remove(modified); throw; } }
void QueueEditor::ReorderFiles(DownloadQueue* pDownloadQueue, ItemList* pItemList) { if (pItemList->size() == 0) { return; } EditItem* pFirstItem = pItemList->front(); NZBInfo* pNZBInfo = pFirstItem->m_pFileInfo->GetNZBInfo(); unsigned int iInsertPos = 0; // find first file of the group for (FileQueue::iterator it = pDownloadQueue->GetFileQueue()->begin(); it != pDownloadQueue->GetFileQueue()->end(); it++) { FileInfo* pFileInfo = *it; if (pFileInfo->GetNZBInfo() == pNZBInfo) { break; } iInsertPos++; } // now can reorder for (ItemList::iterator it = pItemList->begin(); it != pItemList->end(); it++) { EditItem* pItem = *it; FileInfo* pFileInfo = pItem->m_pFileInfo; // move file item for (FileQueue::iterator it = pDownloadQueue->GetFileQueue()->begin(); it != pDownloadQueue->GetFileQueue()->end(); it++) { FileInfo* pFileInfo1 = *it; if (pFileInfo1 == pFileInfo) { pDownloadQueue->GetFileQueue()->erase(it); pDownloadQueue->GetFileQueue()->insert(pDownloadQueue->GetFileQueue()->begin() + iInsertPos, pFileInfo); iInsertPos++; break; } } delete pItem; } }
/// collectLineCounts - Collect line counts. This must be used after /// reading .gcno and .gcda files. void GCOVFunction::collectLineCounts(FileInfo &FI) { // If the line number is zero, this is a function that doesn't actually appear // in the source file, so there isn't anything we can do with it. if (LineNumber == 0) return; for (const auto &Block : Blocks) Block->collectLineCounts(FI); FI.addFunctionLine(Filename, LineNumber, this); }
int FileInfo::treeLevel() const { int level = 0; FileInfo * parent = _parent; while ( parent ) { level++; parent = parent->parent(); } return level; if ( _parent ) return _parent->treeLevel() + 1; else return 0; }
void FileHandle::WriteToDisk() { FileInfo* fp = first_file_; while (fp != NULL) { BlockInfo* bp = fp->GetFirstBlock(); while (bp != NULL) { //如果该块被修改过,则写到文件中 if (bp->get_dirty()) { bp->WriteInfo(path_); bp->set_dirty(false); } bp = bp->GetNext(); } fp = fp->GetNext(); } }
/** * Check if deletion of already downloaded files is possible (when nzb id deleted from queue). * The deletion is most always possible, except the case if all remaining files in queue * (belonging to this nzb-file) are PARS. */ bool QueueEditor::CanCleanupDisk(DownloadQueue* pDownloadQueue, NZBInfo* pNZBInfo) { for (FileQueue::iterator it = pDownloadQueue->GetFileQueue()->begin(); it != pDownloadQueue->GetFileQueue()->end(); it++) { FileInfo* pFileInfo = *it; char szLoFileName[1024]; strncpy(szLoFileName, pFileInfo->GetFilename(), 1024); szLoFileName[1024-1] = '\0'; for (char* p = szLoFileName; *p; p++) *p = tolower(*p); // convert string to lowercase if (!strstr(szLoFileName, ".par2")) { // non-par file found return true; } } return false; }
void FileInfoListView::addRange(FileInfo **filesInfo, size_t count) { int index = max(0, (getCount() - 1)); size_t i = 0; FileInfo *arr = *filesInfo; for (i = 0; i < count; i++) { FileInfo *fi = &arr[i]; if (fi->isDirectory()) { addItem(index++, fi); } } for (i = 0; i < count; i++) { FileInfo *fi = &arr[i]; if (!fi->isDirectory()) { addItem(index++, fi); } } }
void CacheReader::finalizeRecursive( DirInfo * dir ) { if ( dir->readState() != DirOnRequestOnly ) { dir->setReadState( DirCached ); _tree->sendFinalizeLocal( dir ); dir->finalizeLocal(); _tree->sendReadJobFinished( dir ); } FileInfo * child = dir->firstChild(); while ( child ) { if ( child->isDirInfo() ) finalizeRecursive( child->toDirInfo() ); child = child->next(); } }
void Project::GetFilesMetadata(Project::FileInfoVector_t& files) { std::queue<wxXmlNode*> elements; if ( !m_doc.IsOk() || !m_doc.GetRoot()) return; elements.push( m_doc.GetRoot() ); while ( !elements.empty() ) { wxXmlNode *element = elements.front(); elements.pop(); while ( element ) { if ( element->GetName() == wxT("File") ) { // files are kept relative to the project file wxString fileName = element->GetPropVal(wxT("Name"), wxEmptyString); wxFileName tmp(fileName); tmp.MakeAbsolute(m_fileName.GetPath()); FileInfo fi; fi.SetFilenameRelpath(fileName); fi.SetFilename( tmp.GetFullPath() ); fi.SetFlags( XmlUtils::ReadLong(element, "Flags", 0) ); wxString excludeConfigs = XmlUtils::ReadString(element, EXCLUDE_FROM_BUILD_FOR_CONFIG); fi.SetExcludeConfigs( ::wxStringTokenize(excludeConfigs, ";", wxTOKEN_STRTOK) ); fi.SetVirtualFolder( DoFormatVirtualFolderName(element) ); files.push_back( fi ); } else if ( element->GetChildren() ) { elements.push( element->GetChildren() ); } element = element->GetNext(); } } }
bool KLUPD::UpdateInfo::checkIfFileOptional(const FileInfo absentFile) // absentFile is a copy, because update file set is modified { // in case component identifier is not specified, then it is primary index or other helper file for(ComponentIdentefiers::const_iterator componentIter = absentFile.m_componentIdSet.begin();; ++componentIter) { if(componentIter == absentFile.m_componentIdSet.end()) { TRACE_MESSAGE2("Error: component identifier is not specified '%S', file is mandatory and can not be removed from update", absentFile.toString().toWideChar()); return false; } // non-empty component found if(!componentIter->empty()) break; } // check if any of component's file is mandatory for(FileVector::const_iterator fileIter = m_matchFileList.begin(); fileIter != m_matchFileList.end(); ++fileIter) { // search if absent file has the same component identifier that absent file ComponentIdentefiers::const_iterator componentIter = std::find_first_of(absentFile.m_componentIdSet.begin(), absentFile.m_componentIdSet.end(), fileIter->m_componentIdSet.begin(), fileIter->m_componentIdSet.end()); // not match by component if(componentIter == absentFile.m_componentIdSet.end()) continue; if(!m_callbacks.checkIfFileOptional(*fileIter, m_retranslationMode)) { TRACE_MESSAGE3("Error: missing file '%S' which is mandatory for '%S'", absentFile.toString().toWideChar(), fileIter->toString().toWideChar()); return false; } } TRACE_MESSAGE2("File '%S' is optional for update", absentFile.toString().toWideChar()); return true; }
void DownloadOperation::processFile() { m_fileOffset = 0; File targetFile(m_pathToTargetFile.getString()); if (targetFile.exists()) { FileInfo *sourceFileInfo = m_toCopy->getFileInfo(); FileInfo targetFileInfo(&targetFile); // // Copy listener must decide what to do with this situation // int action = m_copyListener->targetFileExists(sourceFileInfo, &targetFileInfo, m_pathToTargetFile.getString()); switch (action) { case CopyFileEventListener::TFE_OVERWRITE: break; case CopyFileEventListener::TFE_SKIP: m_totalBytesCopied += sourceFileInfo->getSize(); gotoNext(); return ; case CopyFileEventListener::TFE_APPEND: m_fileOffset = targetFileInfo.getSize(); break; case CopyFileEventListener::TFE_CANCEL: if (!isTerminating()) { terminate(); } // if not terminating return ; default: _ASSERT(FALSE); } // switch } // if target file exists // Send request that we want to download file m_sender->sendDownloadRequest(m_pathToSourceFile.getString(), m_fileOffset); }
bool PrePostProcessor::IsNZBFileCompleted(DownloadQueue* pDownloadQueue, NZBInfo* pNZBInfo, bool bIgnorePausedPars, bool bAllowOnlyOneDeleted) { bool bNZBFileCompleted = true; int iDeleted = 0; for (FileQueue::iterator it = pDownloadQueue->GetFileQueue()->begin(); it != pDownloadQueue->GetFileQueue()->end(); it++) { FileInfo* pFileInfo = *it; if (pFileInfo->GetNZBInfo() == pNZBInfo) { if (pFileInfo->GetDeleted()) { iDeleted++; } if (((!pFileInfo->GetPaused() || !bIgnorePausedPars || !(m_ParCoordinator.ParseParFilename(pFileInfo->GetFilename(), NULL, NULL))) && !pFileInfo->GetDeleted()) || (bAllowOnlyOneDeleted && iDeleted > 1)) { bNZBFileCompleted = false; break; } } } return bNZBFileCompleted; }
void MainWindow::updateActions() { bool reading = _dirTreeModel->tree()->isBusy(); _ui->actionStopReading->setEnabled( reading ); _ui->actionRefreshAll->setEnabled ( ! reading ); _ui->actionAskReadCache->setEnabled ( ! reading ); _ui->actionAskWriteCache->setEnabled( ! reading ); bool haveCurrentItem = ( _selectionModel->currentItem() != 0 ); bool treeNotEmpty = ( _dirTreeModel->tree()->firstToplevel() != 0 ); _ui->actionCopyUrlToClipboard->setEnabled( haveCurrentItem ); _ui->actionGoUp->setEnabled( haveCurrentItem ); _ui->actionGoToToplevel->setEnabled( treeNotEmpty ); FileInfoSet selectedItems = _selectionModel->selectedItems(); FileInfo * sel = selectedItems.first(); bool oneDirSelected = ( selectedItems.size() == 1 ) && ( sel->isDir() ); _ui->actionMoveToTrash->setEnabled( sel && ! sel->isDotEntry() ); _ui->actionRefreshSelected->setEnabled( oneDirSelected && ! sel->isExcluded() && ! sel->isMountPoint() ); _ui->actionContinueReadingAtMountPoint->setEnabled( oneDirSelected && sel->isMountPoint() ); _ui->actionReadExcludedDirectory->setEnabled ( oneDirSelected && sel->isExcluded() ); bool showingTreemap = _ui->treemapView->isVisible(); _ui->actionTreemapZoomIn->setEnabled ( showingTreemap && _ui->treemapView->canZoomIn() ); _ui->actionTreemapZoomOut->setEnabled ( showingTreemap && _ui->treemapView->canZoomOut() ); _ui->actionResetTreemapZoom->setEnabled( showingTreemap && _ui->treemapView->canZoomOut() ); _ui->actionTreemapRebuild->setEnabled ( showingTreemap ); }
QList<FileInfo *> DecoderWildMidiFactory::createPlayList(const QString &fileName, bool useMetaData, QStringList *) { Q_UNUSED(useMetaData); QList <FileInfo*> list; FileInfo *info = new FileInfo(fileName); if(WildMidiHelper::instance()->initialize() && WildMidiHelper::instance()->sampleRate()) { void *midi_ptr = WildMidi_Open (fileName.toLocal8Bit()); if(midi_ptr) { WildMidiHelper::instance()->addPtr(midi_ptr); _WM_Info *wm_info = WildMidi_GetInfo(midi_ptr); info->setLength((qint64)wm_info->approx_total_samples / WildMidiHelper::instance()->sampleRate()); WildMidi_Close(midi_ptr); WildMidiHelper::instance()->removePtr(midi_ptr); } } list << info; return list; }
void QueueEditor::BuildGroupList(DownloadQueue* pDownloadQueue, FileList* pGroupList) { pGroupList->clear(); for (FileQueue::iterator it = pDownloadQueue->GetFileQueue()->begin(); it != pDownloadQueue->GetFileQueue()->end(); it++) { FileInfo* pFileInfo = *it; FileInfo* pGroupInfo = NULL; for (FileList::iterator itg = pGroupList->begin(); itg != pGroupList->end(); itg++) { FileInfo* pGroupInfo1 = *itg; if (pGroupInfo1->GetNZBInfo() == pFileInfo->GetNZBInfo()) { pGroupInfo = pGroupInfo1; break; } } if (!pGroupInfo) { pGroupList->push_back(pFileInfo); } } }
void ServerContext::ReadFile(std::string& result, const std::string& instancePublicId, FileContentType content, bool uncompressIfNeeded) { FileInfo attachment; if (!index_.LookupAttachment(attachment, instancePublicId, content)) { throw OrthancException(ErrorCode_InternalError); } if (uncompressIfNeeded) { accessor_.SetCompressionForNextOperations(attachment.GetCompressionType()); } else { accessor_.SetCompressionForNextOperations(CompressionType_None); } accessor_.Read(result, attachment.GetUuid(), attachment.GetContentType()); }
bool expectAndWipeConflict(FileModifier &local, FileInfo state, const QString path) { PathComponents pathComponents(path); auto base = state.find(pathComponents.parentDirComponents()); if (!base) return false; for (const auto &item : base->children) { if (item.name.startsWith(pathComponents.fileName()) && item.name.contains("(conflicted copy")) { local.remove(item.path()); return true; } } return false; }
void DialogsProvider::OnIdle( wxIdleEvent& WXUNUSED(event) ) { /* Update the log window */ if( p_messages_dialog ) p_messages_dialog->UpdateLog(); /* Update the playlist */ if( p_playlist_dialog ) p_playlist_dialog->UpdatePlaylist(); /* Update the fileinfo windows */ if( p_fileinfo_dialog ) p_fileinfo_dialog->Update(); }
//保存到数据库 bool MasterServer::save_fileinfo_to_db(FileInfo &fileinfo) { if(m_db_connection == NULL) return false; char sql_str[1024]; ChunkPath &chunk_path = fileinfo.get_chunkpath(0); snprintf(sql_str, 1024, "insert into SFS.fileinfo_%s (fid, name, size, chunkid, chunkip, chunkport, findex, foffset) " "values('%s', '%s', %d, '%s', '%s', %d, %d, %d);" ,fileinfo.fid.substr(0,2).c_str(), fileinfo.fid.c_str(), fileinfo.name.c_str(), fileinfo.size ,chunk_path.id.c_str() ,chunk_path.ip.c_str(), chunk_path.port ,chunk_path.index, chunk_path.offset); Query query = m_db_connection->query(sql_str); return query.exec(); }
bool Ini_UpdaterLists::readSingleFileInfoRollback(const TCHAR *iniFileName, TCHAR *fileSectionName, FileInfo &file) { if(!iniFileName || (*iniFileName == 0)) { TRACE_MESSAGE("Read rollback file information error: configuration file name is not specified"); return false; } if(!fileSectionName) { TRACE_MESSAGE("Read rollback file information error: configuration section is not specified"); return false; } TCHAR buffer[MAX_STR_BUFF + 1] = _T(""); // file name GetPrivateProfileString(fileSectionName, STRING(SS_KEY_RecentFileName).c_str(), _T(UNKNOWN_STRING), buffer, MAX_STR_BUFF, iniFileName); if(!_tcscmp(buffer, _T(UNKNOWN_STRING))) { TRACE_MESSAGE2("Read rollback file information error: no '%s' value found", STRING(SS_KEY_RecentFileName).to_string().c_str()); return false; } file.m_filename = buffer; // local path GetPrivateProfileString(fileSectionName, STRING(SS_KEY_RecentLocalPath).c_str(), _T(UNKNOWN_STRING), buffer, MAX_STR_BUFF, iniFileName); if(!_tcscmp(buffer, _T(UNKNOWN_STRING))) { TRACE_MESSAGE2("Read rollback file information error: no '%s' value found", STRING(SS_KEY_RecentLocalPath).to_string().c_str()); return false; } file.m_localPath = buffer; // change status GetPrivateProfileString(fileSectionName, STRING(SS_KEY_ChangeStatus).c_str(), _T(UNKNOWN_STRING), buffer, MAX_STR_BUFF, iniFileName); if(!_tcscmp(buffer, _T(UNKNOWN_STRING))) { TRACE_MESSAGE2("Read rollback file information error: no '%s' value found", STRING(SS_KEY_ChangeStatus).to_string().c_str()); return false; } file.m_rollbackChange = buffer; // md5 for consistency check GetPrivateProfileString(fileSectionName, STRING(kayw_MD5).c_str(), _T(UNKNOWN_STRING), buffer, MAX_STR_BUFF, iniFileName); if(_tcscmp(buffer, _T(UNKNOWN_STRING))) file.m_md5 = CBase64::decodeBuffer(STRING(buffer).to_string().c_str()); TRACE_MESSAGE2("Rollback information read: '%s'", file.toString().c_str()); return true; }
void Run(CThread * thread, void * arg) { LOGV(LL_INFO,"start thread[%ld]", *(int64_t*)arg); Client *client = new Client(); int initret = client->Init(); if (BLADE_ERROR == initret) abort(); FileInfo finfo; for (int i = 0; i < 5; ++i) { finfo = client->GetFileInfo(src + Int32ToString(*((int64_t*)arg)) + dname[i]); if (finfo.get_file_id() < 0) { LOGV(LL_ERROR, "Invalid file: %s.", (src + Int32ToString(*((int64_t*)arg)) + dname[i]).c_str()); continue; } for (int32_t k = i * (filenum -5) / 5; k < (i + 1) * (filenum - 5) / 5; ++k) { finfo = client->GetFileInfo(src + Int32ToString(*((int64_t*)arg)) + dname[i] + "_" + Int32ToString(k)); if (finfo.get_file_id() < 0) { LOGV(LL_ERROR, "Invalid file: %s.", (src + Int32ToString(*((int64_t*)arg)) + dname[i] + "_" + Int32ToString(k)).c_str()); continue; } } } }
void ServerContext::ReadFile(std::string& result, const std::string& instancePublicId, FileContentType content, bool uncompressIfNeeded) { FileInfo attachment; if (!index_.LookupAttachment(attachment, instancePublicId, content)) { throw OrthancException(ErrorCode_InternalError); } if (uncompressIfNeeded) { StorageAccessor accessor(area_); accessor.Read(result, attachment); } else { // Do not interpret the content of the storage area, return the // raw data area_.Read(result, attachment.GetUuid(), content); } }