bool wxGxWebConnectionFactory::GetChildren(wxGxObject* pParent, char** &pFileNames, wxArrayLong & pChildrenIds) { wxGxCatalogBase* pCatalog = GetGxCatalog(); for(int i = CSLCount(pFileNames) - 1; i >= 0; i-- ) { CPLString szExt = CPLGetExtension(pFileNames[i]); if(wxGISEQUAL(szExt, "wconn")) { if( m_bHasDriver ) { wxGxObject* pObj = GetGxObject(pParent, GetConvName(pFileNames[i]), pFileNames[i]); if(pObj) pChildrenIds.Add(pObj->GetId()); } pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL ); } } return true; }
bool wxGxPrjFactory::GetChildren(wxGxObject* pParent, char** &pFileNames, wxArrayLong & pChildrenIds) { bool bCheckNames = CSLCount(pFileNames) < CHECK_DUBLES_MAX_COUNT; for(int i = CSLCount(pFileNames) - 1; i >= 0; i-- ) { CPLString szExt = CPLGetExtension(pFileNames[i]); wxGxObject* pGxObj = NULL; if(wxGISEQUAL(szExt, "prj")) { bool bAdd = true; for(int j = 0; prj_notadd_exts[j] != NULL; ++j ) { if(CPLCheckForFile((char*)CPLResetExtension(pFileNames[i], prj_notadd_exts[j]), NULL)) { bAdd = false; break; } } if(bAdd) { pGxObj = GetGxObject(pParent, GetConvName(pFileNames[i]), pFileNames[i], enumESRIPrjFile, bCheckNames); } pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL ); } else if(wxGISEQUAL(szExt, "qpj")) { bool bAdd = true; for(int j = 0; prj_notadd_exts[j] != NULL; ++j ) { if(CPLCheckForFile((char*)CPLResetExtension(pFileNames[i], prj_notadd_exts[j]), NULL)) { bAdd = false; break; } } if(bAdd) { pGxObj = GetGxObject(pParent, GetConvName(pFileNames[i]), pFileNames[i], enumQPJfile, bCheckNames); } pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL ); } else if(wxGISEQUAL(szExt, "spr")) { pGxObj = GetGxObject(pParent, GetConvName(pFileNames[i]), pFileNames[i], enumSPRfile, bCheckNames); pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL ); } if(pGxObj) { pChildrenIds.Add(pGxObj->GetId()); pGxObj = NULL; } } return true; }
void CTestPlayDialog::Update() { // display each row m_listResults.DeleteAllItems(); // get the latest results from the document int nTrumpSuit = pDOC->GetTrumpSuit(); int nContractLevel = pDOC->GetContractLevel(); int nDeclaringTeam = pDOC->GetDeclaringTeam(); int numTricksMade = pDOC->GetNumTricksWonByTeam(nDeclaringTeam); BOOL bDoubled = pDOC->IsContractDoubled(); BOOL bReDoubled = pDOC->IsContractRedoubled(); // update counts m_numContracts[nContractLevel-1][nTrumpSuit]++; m_numContracts[nContractLevel-1][nTotalsColumn]++; m_numContracts[nTotalsRow][nTrumpSuit]++; m_numContracts[nTotalsRow][nTotalsColumn]++; if (bDoubled) { m_numContracts[nContractLevel-1][nDoubledColumn]++; m_numContracts[7][nDoubledColumn]++; } else if (bReDoubled) { m_numContracts[nContractLevel-1][nRedoubledColumn]++; m_numContracts[7][nRedoubledColumn]++; } // NCR-706 WRite out boards that go down using Cash play BOOL bSaveThisBoard = FALSE; if(theApp.GetValue(tnFileProgramBuildNumber) == 1234) { bSaveThisBoard = TRUE; // Ask that this board be written theApp.SetValue(tnFileProgramBuildNumber, 1); // turn off } // NCR-706 end // also update # contracts made if (numTricksMade >= (nContractLevel+6)) { m_numMade[nContractLevel-1][nTrumpSuit]++; m_numMade[nContractLevel-1][nTotalsColumn]++; m_numMade[nTotalsRow][nTrumpSuit]++; m_numMade[nTotalsRow][nTotalsColumn]++; if (bDoubled) { m_numMade[nContractLevel-1][nDoubledColumn]++; m_numMade[7][nDoubledColumn]++; } else if (bReDoubled) { m_numMade[nContractLevel-1][nRedoubledColumn]++; m_numMade[7][nRedoubledColumn]++; } } // NCR-AT Save contracts that went down else if (((nContractLevel >= 1) && m_bSaveDowns) || bSaveThisBoard) //<<<<<<<< NCR changed to 1 vs 4 for NCR-706 testing { int nDownCnt = (nContractLevel+6) - numTricksMade; // show number of tricks down CFile file; CFileException fileException; CString strPath; // CTime time = CTime::GetCurrentTime(); strPath.Format("%s\\LostContract_Down_%d_%s.brd",theApp.GetValue(tszProgramDirectory), nDownCnt, pDOC->GetDealIDString()); // (LPCTSTR)time.Format("%X")); int nCode = file.Open((LPCTSTR)strPath, CFile::modeWrite | CFile::modeCreate | CFile::shareDenyWrite, &fileException); CArchive ar(&file, CArchive::store); pDOC->WriteFile(ar); ar.Close(); file.Close(); } // NCR-AT end saving lost contracts #ifdef _DEBUG // NCR-SCU Save hands that have used conventions // if(m_bSaveConvUsed && (pDOC->GetNumSCU() > 0)) { CFile file; CFileException fileException; CString strPath; // Build filename from conventions used CString fileNm = "CU"; // Filename prefix const int nInitNameLen = fileNm.GetLength(); // save length for test below bool usedConv[] = {false,false,false,false,false,false,false,false,false,false, false,false,false,false,false,false,false,false,false,false, false,false,false,false,false,false,false,false,false,false, false,false,false,false,false,false,false,false,false,false}; for(int k = 0; k < pDOC->GetNumSCU(); k++) { int cix = pDOC->GetSCU(k); // get next convention if(cix == tidOvercalls) continue; // skip saving overcalls if(usedConv[cix]) continue; // skip if seen before usedConv[cix] = true; // remember that we've use this one fileNm += GetConvName(cix); // add on convention } // end for(k) thru used conventions if(fileNm.GetLength() > nInitNameLen) { // Only write if a convention used // build filename from conventions used strPath.Format("%s\\%s_%s.brd",theApp.GetValue(tszProgramDirectory), fileNm, pDOC->GetDealIDString()); int nCode = file.Open((LPCTSTR)strPath, CFile::modeWrite | CFile::modeCreate | CFile::shareDenyWrite, &fileException); CArchive ar(&file, CArchive::store); pDOC->WriteFile(ar); ar.Close(); file.Close(); } } // NCR-SCU end saving hands that used a convention #endif // and display for(int nRow=0;nRow<8;nRow++) { m_listResults.InsertItem(nRow, tszRowTitle[nRow]); for(int nCol=0;nCol<8;nCol++) m_listResults.SetItem(nRow, nCol+1, LVIF_TEXT, FormString("%d / %d", m_numMade[nRow][nCol], m_numContracts[nRow][nCol]), 0, 0, 0, 0L); } // show % made CStatic* pLabel = (CStatic*) GetDlgItem(IDC_GAMES_MADE_LABEL); if (!pLabel->IsWindowVisible()) { pLabel->ShowWindow(SW_SHOW); pLabel->UpdateWindow(); } double fPercent = m_numMade[nTotalsRow][nTotalsColumn] / (double) m_numContracts[nTotalsRow][nTotalsColumn]; m_strPercentMade.Format(_T("%.1f%%"), fPercent * 100); UpdateData(FALSE); // m_listResults.UpdateWindow(); }
bool wxGxRasterFactory::GetChildren(wxGxObject* pParent, char** &pFileNames, wxArrayLong & pChildrenIds) { bool bCheckNames = CSLCount(pFileNames) < CHECK_DUBLES_MAX_COUNT; for(int i = CSLCount(pFileNames) - 1; i >= 0; i-- ) { wxGxObject* pGxObj = NULL; CPLString szExt = CPLGetExtension(pFileNames[i]); CPLString szPath; bool bContinue(false); unsigned int j; for(j = 0; j < sizeof(raster_exts) / sizeof(raster_exts[0]); ++j) { if(wxGISEQUAL(szExt, raster_exts[j].sExt) ) { if(raster_exts[j].bAvailable) { CPLString szPath(pFileNames[i]); pGxObj = GetGxObject(pParent, GetConvName(szPath), szPath, raster_exts[j].eType, bCheckNames); if(pGxObj != NULL) pChildrenIds.Add(pGxObj->GetId()); } pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL ); bContinue = true; break; } } if(bContinue) continue; if(wxGISEQUAL(szExt, "prj")) { if(pFileNames) { unsigned int j; for(j = 0; j < sizeof(raster_exts) / sizeof(raster_exts[0]); ++j) { szPath = (char*)CPLResetExtension(pFileNames[i], raster_exts[j].sExt); if(CPLCheckForFile((char*)szPath.c_str(), NULL)) { pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL ); bContinue = true; break; } } } } if(bContinue) continue; for( j = 0; raster_add_exts[j] != NULL; ++j ) { if(wxGISEQUAL(szExt, raster_add_exts[j])) { pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL ); break; } } } return true; }