void hkvTagfileAsset::getInternalProperties(hkvPropertyList& properties, hkvProperty::Purpose purpose) const { int iFlags = (purpose == hkvProperty::PURPOSE_USER_INTERFACE_READ_ONLY) ? hkvProperty::FLAG_READ_ONLY : 0; if (purpose == hkvProperty::PURPOSE_SERIALIZATION) { m_tagfiles[0].getTagfileEntryProperties(properties, purpose); } else { const TagfileEntry& entry = m_tagfiles[0]; hkStringBuf absSourcePath; getAbsoluteFilePath(absSourcePath); hkStringBuf relAssetFolder; getRelativeFilePath(relAssetFolder); relAssetFolder.pathDirname(); hkStringBuf name = getName(); hkvStringHelper::pathNoExtension(name); hkStringBuf relTargetPath; entry.getRelativeTargetPath(relTargetPath, relAssetFolder, name); const char* absLibraryPath = getOwnerLibrary()->getPath(); hkStringBuf absTargetPath = absLibraryPath; absTargetPath.pathAppend(relTargetPath); entry.getTagfileEntryProperties(properties, purpose, absSourcePath, absTargetPath, absLibraryPath); } }
bool ProjectPanel::buildTreeFrom(TiXmlNode *projectRoot, HTREEITEM hParentItem) { for (TiXmlNode *childNode = projectRoot->FirstChildElement(); childNode ; childNode = childNode->NextSibling()) { const TCHAR *v = childNode->Value(); if (lstrcmp(TEXT("Folder"), v) == 0) { HTREEITEM addedItem = _treeView.addItem((childNode->ToElement())->Attribute(TEXT("name")), hParentItem, INDEX_CLOSED_NODE); if (!childNode->NoChildren()) { bool isOK = buildTreeFrom(childNode, addedItem); if (!isOK) return false; } } else if (lstrcmp(TEXT("File"), v) == 0) { const TCHAR *strValue = (childNode->ToElement())->Attribute(TEXT("name")); generic_string fullPath = getAbsoluteFilePath(strValue); TCHAR *strValueLabel = ::PathFindFileName(strValue); int iImage = ::PathFileExists(fullPath.c_str())?INDEX_LEAF:INDEX_LEAF_INVALID; _treeView.addItem(strValueLabel, hParentItem, iImage, fullPath.c_str()); } } return true; }
void ProcessLister::handleProcessInformationAndAddToList( PSYSTEM_PROCESS_INFORMATION pProcess ) { Process process; WCHAR tempProcessName[MAX_PATH*2] = {0}; process.PID = (DWORD)pProcess->UniqueProcessId; HANDLE hProcess = ProcessAccessHelp::NativeOpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, process.PID); if (hProcess) { ProcessType processType = checkIsProcess64(hProcess); #ifdef _WIN64 if (processType == PROCESS_64) #else if (processType == PROCESS_32) #endif { process.sessionId = pProcess->SessionId; memcpy(tempProcessName, pProcess->ImageName.Buffer, pProcess->ImageName.Length); wcscpy_s(process.filename, tempProcessName); getAbsoluteFilePath(hProcess, &process); process.pebAddress = getPebAddressFromProcess(hProcess); getProcessImageInformation(hProcess, &process); processList.push_back(process); } CloseHandle(hProcess); } }
/** * Helper function for constructor. Creates all the new tables for a * psm file. Requires that the database has been successfully opened. * Sets the _blibSearchID. */ void PsmFile::createTables(const ops::variables_map& options_table){ SqliteRoutine::SQL_STMT("BEGIN", db_); char zSql[2048]; Verbosity::status("Creating results tables."); //create msExperiment and msExperimentRun if(!SqliteRoutine::TABLE_EXISTS("msExperiment", db_)) { strcpy(zSql, "create table msExperiment" "(id INTEGER primary key autoincrement not null," "serverAddress TEXT, serverDirectory TEXT, uploadDate TEXT, " "lastUpdate TEXT)"); SqliteRoutine::SQL_STMT(zSql, db_); zSql[0]='\0'; } if(!SqliteRoutine::TABLE_EXISTS("msExperimentRun", db_)) { strcpy(zSql,"create table msExperimentRun(experimentID INTEGER, " "runID INTEGER, primary key(experimentID, runID))"); SqliteRoutine::SQL_STMT(zSql, db_); zSql[0]='\0'; } //create msSearch table if(!SqliteRoutine::TABLE_EXISTS("msSearch", db_)) { strcpy(zSql, "create table msSearch(id INTEGER primary key autoincrement " "not null, " "experimentID INTEGER, expDate TEXT, serverDirectory TEXT, " "analysisProgramName TEXT, analysisProgramVersion TEXT, " "uploadDate TEXT)"); SqliteRoutine::SQL_STMT(zSql, db_); zSql[0]='\0'; } else { // delete existing results reorgDB(); } //fill in the msSearch table //get path char szFile[1024]; char* result = getcwd(szFile,1024); //get search time time_t t= time(NULL); char* date = ctime(&t); sprintf(zSql,"insert into msSearch(serverDirectory, analysisProgramName," "analysisProgramVersion, uploadDate) " "values('%s','BlibSearch','1.0','%s')", result, date); SqliteRoutine::SQL_STMT(zSql, db_); zSql[0]='\0'; int searchID = (int)sqlite3_last_insert_rowid(db_); //create msRunSearch table if(!SqliteRoutine::TABLE_EXISTS("msRunSearch", db_)) { strcpy(zSql, "create table msRunSearch(id INTEGER primary key " "autoincrement not null, " "runID INTEGER, searchID INTEGER, originalFileType TEXT, " "searchDate TEXT, " "searchDuration INTEGER, uploadDate TEXT)"); SqliteRoutine::SQL_STMT(zSql, db_); zSql[0] = '\0'; } //insert into msRunSearch sprintf(zSql, "insert into msRunSearch(runID,searchID, searchDate, " "uploadDate) values (1,%d,'%s','%s')", searchID, date, date); SqliteRoutine::SQL_STMT(zSql, db_); zSql[0]='\0'; int runSearchID = (int)sqlite3_last_insert_rowid(db_); //create BiblioLibrary table if(!SqliteRoutine::TABLE_EXISTS("BiblioLibrary", db_)) { strcpy(zSql, "create table BiblioLibrary(id INTEGER primary key " "autoincrement not null," "searchID INTEGER, name VARCHAR(255))"); SqliteRoutine::SQL_STMT(zSql, db_); zSql[0]='\0'; } else { Verbosity::error("The BiblioLibrary table exists and it shouldn't."); } //insert into BiblioLibrary table vector<string> libfilenames = options_table["library"].as< vector<string> >(); for(size_t i = 0; i < libfilenames.size(); i++) { string libname = getAbsoluteFilePath(libfilenames.at(i)); sprintf(zSql, "insert into BiblioLibrary(searchID,name) values(%d,'%s')", searchID, libname.c_str()); SqliteRoutine::SQL_STMT(zSql, db_); zSql[0]='\0'; } //create BiblioParams table if(!SqliteRoutine::TABLE_EXISTS("BiblioParmas", db_)) { strcpy(zSql, "create table BiblioParams(id INTEGER primary key " "autoincrement not null, " "searchID INTEGER,param VARCHAR(255),value REAL)"); SqliteRoutine::SQL_STMT(zSql, db_); zSql[0]='\0'; } else { Verbosity::error("The BiblioParams table exists and it shouldn't."); } // replace with other options //fill in BiblioParams table ops::variables_map::const_iterator i; for(i = options_table.begin(); i != options_table.end(); ++i) { const ops::variable_value& v = i->second; if( ! v.empty() ) { const type_info& type = v.value().type(); if( type == typeid(int) ) { sprintf(zSql, "insert into BiblioParams(searchID, param, value) " "values(%d,'%s',%d)", searchID, (i->first).c_str(), v.as<int>()); } else if( type == typeid(bool) ) { sprintf(zSql, "insert into BiblioParams(searchID, param, value) " "values(%d,'%s',%d)", searchID, (i->first).c_str(), (int)v.as<bool>()); } else if( type == typeid(double) ) { sprintf(zSql, "insert into BiblioParams(searchID, param, value) " "values(%d,'%s',%f)", searchID, (i->first).c_str(), v.as<double>()); } // else don't use values of any other types SqliteRoutine::SQL_STMT(zSql, db_); zSql[0] = '\0'; } // else don't insert empty values } // next value //create table BiblioSpecSpectrumData if(!SqliteRoutine::TABLE_EXISTS("BiblioSpecSpectrumData", db_)) { strcpy(zSql, "create table BiblioSpecSpectrumData (scanID INTERGER," "runSearchID INTEGER, numLibraryMatches REAL, binSize REAL, " "shape REAL, scale REAL, fraction2fit REAL, " "weibullHistogram BLOB, primary key(scanID,runSearchID))"); SqliteRoutine::SQL_STMT(zSql, db_); zSql[0]='\0'; } else { Verbosity::error( "Table BiblioSpecSpectrumData exists and shouldn't."); } //create table msRunSearchResult if(!SqliteRoutine::TABLE_EXISTS("msRunSearchResult", db_)) { strcpy(zSql, "create table msRunSearchResult(id INTEGER primary key " "autoincrement not null, " "runSearchID INTEGER, scanID INTEGER, charge INTEGER, " "peptide VARCHAR(255), preResidue CHAR(1), postResidue CHAR(1), " "validationStatus CHAR(1))"); SqliteRoutine::SQL_STMT(zSql, db_); zSql[0]='\0'; } if(!SqliteRoutine::TABLE_EXISTS("BiblioSpecSearchResult", db_)) { strcpy(zSql, "create table BiblioSpecSearchResult(resultID INTEGER " "primary key, " "bsSpectrumID INTEGER, bslibraryID INTEGER, rank INTEGER, " "dotProductScore REAL, " "weibullPValue REAL, PeptideModSeq VARCHAR(255))"); SqliteRoutine::SQL_STMT(zSql, db_); zSql[0]='\0'; } else { Verbosity::error("Table BiblioSpecSearchResult exists and shouldn't."); } SqliteRoutine::SQL_STMT("COMMIT", db_); blibRunSearchID_ = runSearchID; }