void PluginImpl::GameFrame(bool simulating) { if (simulating && g_demoIsInternal) { g_demoIsInternal = g_pEngineClient->IsRecordingDemo(); if (!g_demoIsInternal && !g_pDemoInfo->HasMarks() && prec_delete_useless_demo.GetInt() == 1) { prec_delete_demo(CCommand(0, nullptr)); } } }
CCommandSet CAggrDiskUIHandler::GetCommandSet(CDiskObjectPtr obj) const { CCommandSet setCommand; setCommand.push_back( CCommand(IDM_TOOL_UNBIND, obj->GetAccessMask() & GENERIC_WRITE) ); return setCommand; }
CCommandSet CRAID0DiskUIHandler::GetCommandSet(CDiskObjectPtr obj) const { CCommandSet setCommand; // AING_TO_DO : add IDM_RAID0_UNBIND setCommand.push_back( CCommand(IDM_TOOL_UNBIND, obj->GetAccessMask() & GENERIC_WRITE) ); return setCommand; }
/////////////////////////////////////////////////////////////////////////////// // CUnsupportedDiskUIHandler /////////////////////////////////////////////////////////////////////////////// CCommandSet CUnsupportedDiskUIHandler::GetCommandSet(CDiskObjectPtr obj) const { ATLASSERT( dynamic_cast<CUnitDiskObject*>(obj.get()) != NULL); CCommandSet setCommand; setCommand.push_back ( CCommand( IDM_TOOL_CLEARDIB, (obj->GetAccessMask() & GENERIC_WRITE) ) ); return setCommand; }
CCommandSet CRAID4DiskUIHandler::GetCommandSet(CDiskObjectPtr obj) const { CCommandSet setCommand; BOOL bCanWrite; CRAID4DiskObjectPtr disk = boost::dynamic_pointer_cast<CRAID4DiskObject>(obj); setCommand.push_back( CCommand(IDM_TOOL_UNBIND, obj->GetAccessMask() & GENERIC_WRITE) ); setCommand.push_back( CCommand(IDM_TOOL_SYNCHRONIZE, disk->IsDirty() && disk->HasWriteAccess())); setCommand.push_back( CCommand(IDM_TOOL_REPAIR, 1 == disk->GetMissingMemberCount())); setCommand.push_back( CCommand(IDM_TOOL_SPAREADD, obj->GetAccessMask() & GENERIC_WRITE) ); return setCommand; }
CCommandSet CMirDiskUIHandler::GetCommandSet(CDiskObjectPtr obj) const { ATLASSERT( dynamic_cast<const CMirDiskObject*>(obj.get()) != NULL ); CCommandSet setCommand; BOOL bCanWrite; CMirDiskObjectPtr mirDisk = boost::dynamic_pointer_cast<CMirDiskObject>(obj); bCanWrite = mirDisk->GetAccessMask() & GENERIC_WRITE; setCommand.push_back( CCommand( IDM_TOOL_UNBIND, bCanWrite ) ); if(NMT_MIRROR == mirDisk->GetNDASMediaType()) { // migrate : mirror -> RAID 1 setCommand.push_back( CCommand( IDM_TOOL_MIGRATE, !mirDisk->IsBroken() && mirDisk->HasWriteAccess())); } else { // do not check IsDirty here (cause it takes some time) setCommand.push_back( CCommand( IDM_TOOL_SYNCHRONIZE, /* bCanWrite && */ mirDisk->IsDirty() && !mirDisk->IsBroken() && mirDisk->HasWriteAccess())); } return setCommand; }
/*! * @brief Reads a script file parsing the commands as it goes * * @param[in] filename - name of the script file * * @author J. Peterson * @date 06/22/2014 */ bool CTestScript::readScriptFile(const char *filename) { // // Clear out the current list of tests and commands // m_testList.clear(); m_commandList.clear(); m_version.clear(); // // If no file name was given then we are done // if ((filename == NULL) || (filename[0] == '\0')) { return(false); } // // Open the file // FILE *fp = fopen(filename, "r"); if (fp == NULL) { QMessageBox msgBox; msgBox.setText("Could not open script file."); msgBox.exec(); return(false); } // // Read each line of the script file and parse it. while (!feof(fp)) { char lineBuffer[1024]; if (fgets(lineBuffer, sizeof(lineBuffer), fp)) { // // create the new command // m_commandList.push_back(CCommand()); int i = m_commandList.size() - 1; CCommand *pCommand = &m_commandList[i]; pCommand->parse(lineBuffer, i); if (pCommand->m_type == CCommand::CMD_UNKNOWN) { QString title = QFileInfo( QCoreApplication::applicationFilePath() ).fileName(); QString msg = "<html><head/><body><p><span style=\" font-size:10pt; font-weight:600; color:#F00000;\"><pre>Poorly formed command on line "; QString lineNum; lineNum.setNum(i+1, 10); msg.append(lineNum); msg.append(":\n\n "); msg.append(lineBuffer); msg.append("\n</pre></span></p></body></html>"); QMessageBox::warning(NULL, title, msg); } if (pCommand->m_type == CCommand::CMD_VERSION) { if (!m_version.isEmpty()) { QString title = QFileInfo( QCoreApplication::applicationFilePath() ).fileName(); QString msg = "<html><head/><body><p><span style=\" font-size:10pt; font-weight:600; color:#F00000;\"><pre>Re-declaration of Version on line: "; QString lineNum; lineNum.setNum(i, 10); msg.append(lineNum); msg.append(":\n\n "); msg.append(lineBuffer); msg.append("\n</pre></span></p></body></html>"); QMessageBox::warning(NULL, title, msg); } m_version = pCommand->m_scriptVersion; } if (pCommand->m_type == CCommand::CMD_TEST) { m_testList.push_back(i); } } } fclose(fp); return(true); }
CCommandSet CUnitDiskUIHandler::GetCommandSet(CDiskObjectPtr obj) const { ATLASSERT( dynamic_cast<CUnitDiskObject*>(obj.get()) != NULL); CCommandSet setCommand; CUnitDiskObjectPtr unitDisk = boost::dynamic_pointer_cast<CUnitDiskObject>(obj); CUnitDiskInfoHandlerPtr handler = unitDisk->GetInfoHandler(); BOOL bCanWrite; if ( handler->IsBound() ) { CDiskObjectPtr aggrRoot = unitDisk->GetParent(); if ( aggrRoot->IsRoot() ) { // This can occur when the tree is updated just after // the disk is bound. // This additional if code prevents error. setCommand.push_back( CCommand(IDM_TOOL_UNBIND) ); } else { while ( !aggrRoot->GetParent()->IsRoot() ) aggrRoot = aggrRoot->GetParent(); // To Unbind, we should have write privilege to all the disks in bind setCommand.push_back( CCommand(IDM_TOOL_UNBIND, aggrRoot->GetAccessMask() & GENERIC_WRITE) ); } } else { bCanWrite = unitDisk->GetAccessMask() & GENERIC_WRITE; setCommand.push_back( CCommand(IDM_TOOL_ADDMIRROR, bCanWrite) ); } if ( handler->IsMirrored() ) { CMirDiskObjectPtr parent = boost::dynamic_pointer_cast<CMirDiskObject>(unitDisk->GetParent()); if ( parent.get() != NULL ) { // To synchronize, we have write privilege to the two disks in mirroring setCommand.push_back( CCommand(IDM_TOOL_SYNCHRONIZE, (parent->GetAccessMask() & GENERIC_WRITE) && parent->IsDirty() && !parent->IsBroken() && parent->HasWriteAccess() ) ); } CDiskObjectPtr aggrRoot = unitDisk->GetParent(); if ( aggrRoot->IsRoot() ) { // This can occur when the tree is updated just after // the disk is bound. // This additional if code prevents error. setCommand.push_back( CCommand(IDM_TOOL_UNBIND) ); } else { while ( !aggrRoot->GetParent()->IsRoot() ) aggrRoot = aggrRoot->GetParent(); } } else if(NMT_RAID4 == handler->GetNDASMediaType()) { CRAID4DiskObjectPtr parent = boost::dynamic_pointer_cast<CRAID4DiskObject>(unitDisk->GetParent()); if ( parent.get() != NULL ) { // To synchronize, we have write privilege to the two disks in mirroring setCommand.push_back( CCommand(IDM_TOOL_SYNCHRONIZE, (parent->GetAccessMask() & GENERIC_WRITE) && parent->IsDirty() && !parent->IsBroken() ) ); } } if(unitDisk->IsUnitDisk()) { setCommand.push_back( CCommand(IDM_TOOL_SINGLE) ); } return setCommand; }
void CEmulationCard::SpecifyCommand(const CByteArray &oRequestAPDU, LONG lRet, const CByteArray oResponseAPDU) { m_Commands.push_back(CCommand(oRequestAPDU, lRet, oResponseAPDU)); }