//****************************************************************** void CBCGPKeyHelper::AddVirtKeyStr (CString& str, UINT uiVirtKey, BOOL bLast) const { CString strKey; if (uiVirtKey == VK_PAUSE) { strKey = _T("Pause"); } else { #define BUFFER_LEN 50 TCHAR szBuffer [BUFFER_LEN + 1]; ZeroMemory (szBuffer, sizeof (szBuffer)); UINT nScanCode = ::MapVirtualKeyEx (uiVirtKey, 0, ::GetKeyboardLayout (0)) <<16 | 0x1; if (uiVirtKey >= VK_PRIOR && uiVirtKey <= VK_HELP) { nScanCode |= 0x01000000; } ::GetKeyNameText (nScanCode, szBuffer, BUFFER_LEN); strKey = szBuffer; } strKey.MakeLower(); //-------------------------------------- // The first letter should be uppercase: //-------------------------------------- for (int nCount = 0; nCount < strKey.GetLength(); nCount++) { TCHAR c = strKey[nCount]; if (IsCharLower (c)) { c = (TCHAR) toupper (c); // Convert single character JY 4-Dec-99 strKey.SetAt (nCount, c); break; } } str += strKey; if (!bLast) { str += '+'; } }
long CuDlgMain::OnUpdataData (WPARAM wParam, LPARAM lParam) { BOOL bCheck = (BOOL)wParam; int nItem = (int)lParam; CWaitCursor doWaitCursor; int i, nCount = m_cTab1.GetItemCount(); TCITEM item; memset (&item, 0, sizeof (item)); item.mask = TCIF_PARAM; for (i=0; i<nCount; i++) { m_cTab1.GetItem(i, &item); CWnd* pDlgPage = (CWnd*)item.lParam; if (pDlgPage && IsWindow(pDlgPage->m_hWnd)) { pDlgPage->SendMessage(WMUSRMSG_UPDATEDATA, 0, 0); } } // // Clean up the current differences: POSITION p, pos = m_listDifference.GetHeadPosition(); while (pos != NULL) { p = pos; CaCdaDifference* pObj = m_listDifference.GetNext(pos); if (pObj->GetType() != CDA_GENERAL) { m_listDifference.RemoveAt(p); delete pObj; } } m_compareParam.CleanIgnore(); nCount = m_listMainParam.GetItemCount(); for (i=0; i<nCount; i++) { CaCdaDifference* pObj = (CaCdaDifference*)m_listMainParam.GetItemData(i); CString strName = pObj->GetName(); strName.MakeLower(); if (m_listStrPrecheckIgnore.Find(strName) != NULL) { if (m_listMainParam.GetCheck (i, 3)) { m_compareParam.AddIgnore (strName); } } } UINT nMask = PARAM_CONFIGxENV; UpdateDifferences(nMask); return 0; }
BOOL WIZTODODATAEX::WizTodoDataArrayRemoveMultiItem(WIZTODODATAEX::CWizTodoDataExArray& arrayData) { BOOL bCombined = FALSE; // std::deque<int> arrayMultiIndex; // std::map<CString, int> mapTextAndIndex; for (WIZTODODATAEX::CWizTodoDataExArray::iterator it = arrayData.begin(); it != arrayData.end(); it++) { WIZTODODATAEX& dataCurr = *it; int nIndex = (int)(it - arrayData.begin()); // CString strText = it->strText; strText.MakeLower(); // std::map<CString, int>::const_iterator itMap = mapTextAndIndex.find(strText); if (itMap == mapTextAndIndex.end()) { mapTextAndIndex[strText] = nIndex; // if (!dataCurr.arrayChild.empty()) { bCombined = WizTodoDataArrayRemoveMultiItem(dataCurr.arrayChild); } } else { WIZTODODATAEX& dataDest = arrayData[itMap->second]; WIZTODODATAEX::WizTodoDataItemCopyAndCombine(dataDest, dataCurr); // arrayMultiIndex.push_back(nIndex); // bCombined = TRUE; } } // if (arrayMultiIndex.empty()) return bCombined; // size_t nMultiIndexCount = arrayMultiIndex.size(); for (intptr_t i = nMultiIndexCount - 1; i >= 0; i--) { int nIndex = arrayMultiIndex[i]; // arrayData.erase(arrayData.begin() + nIndex); } // return TRUE; }
void CAddGroupDlg::OnOK() { UpdateData(TRUE); if(m_strGroupName.GetLength() == 0) { MessageBox(TRL("Enter a group name!"), PWM_PRODUCT_NAME_SHORT, MB_ICONWARNING | MB_OK); return; } CString strId = m_strGroupName; strId = strId.MakeLower(); CString strSearch = PWS_SEARCHGROUP; // PWS_SEARCHGROUP is translated strSearch = strSearch.MakeLower(); CString strBackup1 = PWS_BACKUPGROUP; strBackup1 = strBackup1.MakeLower(); CString strBackup2 = PWS_BACKUPGROUP_SRC; strBackup2 = strBackup2.MakeLower(); if(m_strGroupName == m_strInitialName) { } // Always allow unchanged else if(strId == strSearch) { MessageBox(TRL("The group you selected cannot store entries. Please select a different group."), PWM_PRODUCT_NAME_SHORT, MB_ICONWARNING | MB_OK); return; } else if((strId == strBackup1) || (strId == strBackup2)) { CString strResMsg = TRL("The specified name is reserved."); strResMsg += _T("\r\n\r\n"); strResMsg += TRL("Please choose a different name."); MessageBox(strResMsg, PWM_PRODUCT_NAME_SHORT, MB_ICONWARNING | MB_OK); return; } CDialog::OnOK(); }
CString CFilesHashDlg::ResultFind(CString strFile, CString strHash) { CString strResult(MAINDLG_FIND_IN_RESULT); strResult.Append(_T("\r\n")); strResult.Append(HASHVALUE_STRING); strResult.Append(_T(" ")); strResult.Append(strHash); strResult.Append(_T("\r\n\r\n")); strResult.Append(MAINDLG_RESULT); strResult.Append(_T("\r\n\r\n")); strHash.MakeUpper(); strFile.MakeLower(); size_t count = 0; CString strPathLower; ResultList::iterator itr = m_thrdData.resultList.begin(); for(; itr != m_thrdData.resultList.end(); ++itr) { strPathLower = itr->strPath; strPathLower.MakeLower(); if(strPathLower.Find(strFile) >= 0 && (itr->strMD5.Find(strHash) >= 0 || itr->strSHA1.Find(strHash) >= 0 || itr->strSHA256.Find(strHash) >= 0 || itr->strCRC32.Find(strHash) >= 0 )) { ++count; AppendResult(*itr, strResult); } } if(count == 0) strResult.Append(MAINDLG_NORESULT); return strResult; }
bool CPhotoManager::GetImageHost(CString& szImageHost) { CString szTemp = m_strHost; szTemp.MakeLower(); if (szTemp.Find(_T("//dev")) >= 0) szImageHost.Replace(_T("//www"), _T("//dev")); else if (szTemp.Find(_T("//work")) >= 0) szImageHost.Replace(_T("//www"), _T("//work")); else if (szTemp.Find(_T("//stage")) >= 0) szImageHost.Replace(_T("//www"), _T("//stage")); return true; }
STDMETHODIMP CTangramTreeView::put_TangramTreeViewCallBack(BSTR bstrKey, ITangramTreeViewCallBack* newVal) { CString strKey = OLE2T(bstrKey); strKey.Trim(); strKey.MakeLower(); map<CString,ITangramTreeViewCallBack*>::iterator it = m_mapTangramTreeViewCallBack.find(strKey); if(it==m_mapTangramTreeViewCallBack.end()) { m_mapTangramTreeViewCallBack[strKey] = newVal; newVal->AddRef(); } return S_OK; }
//------------------------------------------------------------------* CSysVar * CSysVarPool::LookupSysVar(LPCTSTR pszName) { CSysVar *pVar = NULL; CString strName = pszName; strName.MakeLower(); if (m_sysVarMap.Lookup(strName, pVar)) { // found it, do update assert(pVar != NULL); pVar->addRef(); return pVar; } return NULL; }
void CXTPPropertyGridItemFlags::SetValue(CString strValue) { int nValue = 0; strValue.MakeLower(); CXTPPropertyGridItemConstraints* pConstraints = GetConstraints(); for (int i = 0; i < pConstraints->GetCount(); i++) { if (HasFlag(strValue, pConstraints->GetAt(i))) nValue |= pConstraints->GetConstraintAt(i)->m_dwData; } SetFlags(nValue); }
const bool CStringMatch::IsStringAutopost(CString s) { // Check for bad parameters if (!s || s == "") return false; s.Remove(' '); s.Remove('-'); CString s_lower_case = s.MakeLower(); s = s_lower_case.Left(8); return (s == "autopost" || s == "aut0p0st"); }
CString sReadFromIni(CString strSection, CString strKey, CString sDefValue =_T("")) { wchar_t pstrString[MAX_PATH]; CString sFileName; sFileName = AfxGetApp()->m_pszProfileName; sFileName.MakeLower(); if(!GetPrivateProfileString(strSection, strKey,sDefValue, pstrString,MAX_PATH, sFileName)) return sDefValue; CString strString; strString =pstrString; return strString; }
// Finding a fragment in the fragment cache PHTTP_DATA_CHUNK RequestQueue::FindFragment(CString p_prefix) { AutoCritSec lock(&m_lock); p_prefix.MakeLower(); Fragments::iterator it = m_fragments.find(p_prefix); if(it != m_fragments.end()) { return it->second; } // Fragment not found return nullptr; }
void CSettingGitConfig::LoadDataImpl(CAutoConfig& config) { m_bInheritSigningKey = (config.GetString(_T("user.signingkey"), m_UserSigningKey) == GIT_ENOTFOUND); // special handling for UserName and UserEmail, because these can also be defined as environment variables for effective settings if (m_iConfigSource == CFG_SRC_EFFECTIVE) { m_UserName = g_Git.GetUserName(); m_UserEmail = g_Git.GetUserEmail(); m_bInheritUserName = FALSE; m_bInheritEmail = FALSE; m_bInheritSigningKey = FALSE; } else { m_bInheritUserName = (config.GetString(_T("user.name"), m_UserName) == GIT_ENOTFOUND); m_bInheritEmail = (config.GetString(_T("user.email"), m_UserEmail) == GIT_ENOTFOUND); } if (git_config_get_bool(&m_bAutoCrlf, config, "core.autocrlf") == GIT_ENOTFOUND) m_bAutoCrlf = BST_INDETERMINATE; if (git_config_get_bool(&m_bQuotePath, config, "core.quotepath") == GIT_ENOTFOUND) { if (m_iConfigSource == CFG_SRC_EFFECTIVE) m_bQuotePath = BST_CHECKED; else m_bQuotePath = BST_INDETERMINATE; } BOOL bSafeCrLf = FALSE; if (git_config_get_bool(&bSafeCrLf, config, "core.safecrlf") == GIT_ENOTFOUND) m_cSafeCrLf.SetCurSel(0); else if (bSafeCrLf) m_cSafeCrLf.SetCurSel(2); else { CString sSafeCrLf; config.GetString(_T("core.safecrlf"), sSafeCrLf); sSafeCrLf = sSafeCrLf.MakeLower().Trim(); if (sSafeCrLf == _T("warn")) m_cSafeCrLf.SetCurSel(3); else m_cSafeCrLf.SetCurSel(1); } m_bNeedSave = false; SetModified(FALSE); UpdateData(FALSE); }
void CPLViewerDoc::OnFileSave() { CFileDialog SaveDlg (false, ".jpg", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "JPEG File (*.jpg)|*.jpg|Windows Bitmap (*.bmp)|*.bmp|TIFF File (*.tif)|*.tif|PNG File (*.png)|*.png|", AfxGetMainWnd()); if (SaveDlg.DoModal() == IDOK) { CString sFName = SaveDlg.GetPathName(); CString sExt = SaveDlg.GetFileExt(); sExt.MakeLower(); try { if (sExt == "jpg") { PLJPEGEncoder Encoder; Encoder.MakeFileFromBmp(sFName, m_pDib); } else if (sExt == "tif") { PLTIFFEncoder Encoder; Encoder.MakeFileFromBmp(sFName, m_pDib); } else if (sExt == "png") { PLPNGEncoder Encoder; Encoder.MakeFileFromBmp(sFName, m_pDib); } else if (sExt == "bmp") { PLBmpEncoder Encoder; Encoder.MakeFileFromBmp(sFName, m_pDib); } else { // Extension must be one of the supported types. If not, // something is wrong in the user interface code. ASSERT (false); } } catch(PLTextException e) { CString bmpEx; bmpEx.Format("Error saving the file: %s", (LPCTSTR) e, (LPCTSTR) e.GetCode()); AfxMessageBox(bmpEx); } } }
void CBrowseRefsDlg::FillListCtrlForShadowTree(CShadowTree* pTree, CString refNamePrefix, bool isFirstLevel) { if(pTree->IsLeaf()) { CString filter; m_ctrlFilter.GetWindowText(filter); filter.MakeLower(); bool positive = filter[0] != '!'; if (!positive) filter = filter.Mid(1); CString ref = refNamePrefix + pTree->m_csRefName; if (!(pTree->m_csRefName.IsEmpty() || pTree->m_csRefName == "refs" && pTree->m_pParent == NULL) && IsMatchFilter(pTree, ref, filter, positive)) { int indexItem = m_ListRefLeafs.InsertItem(m_ListRefLeafs.GetItemCount(), L""); m_ListRefLeafs.SetItemData(indexItem,(DWORD_PTR)pTree); m_ListRefLeafs.SetItemText(indexItem,eCol_Name, ref); m_ListRefLeafs.SetItemText(indexItem, eCol_Upstream, pTree->m_csUpstream); m_ListRefLeafs.SetItemText(indexItem, eCol_Date, pTree->m_csDate != 0 ? CLoglistUtils::FormatDateAndTime(pTree->m_csDate, m_DateFormat, true, m_bRelativeTimes) : _T("")); m_ListRefLeafs.SetItemText(indexItem,eCol_Msg, pTree->m_csSubject); m_ListRefLeafs.SetItemText(indexItem,eCol_LastAuthor, pTree->m_csAuthor); m_ListRefLeafs.SetItemText(indexItem,eCol_Hash, pTree->m_csRefHash); int pos = 0; m_ListRefLeafs.SetItemText(indexItem,eCol_Description, pTree->m_csDescription.Tokenize(_T("\n"), pos)); } } else { CString csThisName; if (!isFirstLevel && !m_bIncludeNestedRefs) return; else if (!isFirstLevel) csThisName=refNamePrefix+pTree->m_csRefName+L"/"; else m_pListCtrlRoot = pTree; for(CShadowTree::TShadowTreeMap::iterator itSubTree=pTree->m_ShadowTree.begin(); itSubTree!=pTree->m_ShadowTree.end(); ++itSubTree) { FillListCtrlForShadowTree(&itSubTree->second,csThisName,false); } } if (isFirstLevel) { CRefLeafListCompareFunc compareFunc(&m_ListRefLeafs, m_currSortCol, m_currSortDesc); m_ListRefLeafs.SortItemsEx(&CRefLeafListCompareFunc::StaticCompare, (DWORD_PTR)&compareFunc); SetSortArrow(&m_ListRefLeafs,m_currSortCol,!m_currSortDesc); } }
void CClipboardMonitorDlg::ProcessString(CString& str) { if (str.IsEmpty()) return; int len = str.GetLength(); // remove quotes if present if (str[0] == L'\"' && str[len - 1] == L'\"') { str.Delete(len - 1); str.Delete(0); len -= 2; } str.MakeLower(); // check extension if (str.Right(2) != ".h") return; // make UNIX-style slashes str.Replace('\\', '/'); for (int i=0; i<m_includes.GetSize(); ++i) { const CString& path = m_includes[i]; int pos = str.Find(path); if (pos == -1) continue; // check to be a valid file name DWORD attr = GetFileAttributes(str); if (attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY)) return; // remove extra path part str.Delete(0, pos + path.GetLength()); if (str[0] == '/') str.Delete(0); // create c-style #include string CString include; include.Format(L"#include \"%s\"\r\n", str); // put it on the clipboard CopyToClipboard(include); break; } }
// // Count features // bool CCSRegion::countRegionFeatures(CCSAssemblyFileMgr* pAssemblyFileMgr) { // For each line in the region CCSAssemblyLine* pLine = NULL; CCSAssemblyToken* pToken = NULL; for (int lineIdx = m_startIdx; lineIdx <= m_endIdx; ++lineIdx) { pLine = m_pFcn->getAssemblyFile()->GetAt(lineIdx); if (pLine->IsEmpty()) continue; // Get mnemonic CString mnemonic; if (pLine->GetAt(0)->getTokenType() == CSTOKEN_TYPE_MNEMONIC) { mnemonic = pLine->GetAt(0)->getTokenStr(); if (mnemonic.IsEmpty()) { tcout << _T("Error: countRegionFeatures: Empty mnemonic in line: ") << pLine->getLineStr().GetString() << endl; ASSERT(false); continue; } incFeatureCount(mnemonic.MakeLower()); } // For each token CString opType, idxStr; for (int tIdx = 0; tIdx < pLine->GetSize(); ++tIdx) { pToken = pLine->GetAt(tIdx); if (pToken->getTokenType() == CSTOKEN_TYPE_OPMEM || pToken->getTokenType() == CSTOKEN_TYPE_OPREG || pToken->getTokenType() == CSTOKEN_TYPE_OPVAL) { // Get opType of each operand opType = pLine->GetAt(tIdx)->getTokenTypeStr(); incFeatureCount(opType.MakeLower()); } } // Get mnemonic + opType of the first operand CString mnemonicOpType0; if (pLine->GetSize() > 1) { mnemonicOpType0 = mnemonic + pLine->GetAt(1)->getTokenTypeStr(); incFeatureCount(mnemonicOpType0.MakeLower()); } // Get opType of the first and second operands CString opType0OpType1; if (pLine->GetSize() > 2) { opType0OpType1 = pLine->GetAt(1)->getTokenTypeStr() + pLine->GetAt(2)->getTokenTypeStr(); incFeatureCount(opType0OpType1.MakeLower()); } } return true; }
bool CUpdateManager::internal_do_update(CUpdateInfo& ui) { CString filename = IuCommonFunctions::IUTempFolder + ui.packageName() +_T(".zip"); std::string filenamea= IuCoreUtils::WstringToUtf8((LPCTSTR)filename); IU_ConfigureProxy(nm); nm.setOutputFile( filenamea); m_statusCallback->updateStatus(nCurrentIndex, TR("Downloading file ")+ ui.downloadUrl()); nm.doGet(IuCoreUtils::WstringToUtf8((LPCTSTR) ui.downloadUrl())); if(nm.responseCode() != 200) { WriteLog(logError,_T("Update Engine"),TR("Error while updating component ") + ui.packageName() + CString(_T("\r\nHTTP response code: "))+IuCoreUtils::Utf8ToWstring(IuCoreUtils::int64_tToString(nm.responseCode())).c_str()+_T("\r\n")+ IuCoreUtils::Utf8ToWstring(nm.errorString()).c_str(),CString("URL=")+ui.downloadUrl()); return 0; } CString hash = ui.getHash(); hash.MakeLower(); if( hash != IuCoreUtils::Utf8ToWstring(IuCoreUtils::CryptoUtils::CalcMD5HashFromFile(IuCoreUtils::WstringToUtf8((LPCTSTR)filename))).c_str() || ui.getHash().IsEmpty()) { updateStatus(0, CString(TR("MD5 check of the update package failed "))+IuCoreUtils::ExtractFileName(IuCoreUtils::WstringToUtf8((LPCTSTR)filename)).c_str()); return 0; } CUnzipper unzipper(filename); CString unzipFolder = IuCommonFunctions::IUTempFolder + ui.packageName(); if(!unzipper.UnzipTo(unzipFolder)) { updateStatus(0, TR("Unable to unpack archive ")+ filename); return 0; } CUpdatePackage updatePackage; updatePackage.setUpdateStatusCallback(this); if(!updatePackage.LoadUpdateFromFile(unzipFolder + _T("\\")+_T("package.xml"))) { MessageBox(0,TR("Could not read ") + ui.packageName(),0,0); return false; } if(!updatePackage.doUpdate()) return false; CString finishText; finishText.Format(TR("Update finished. Updated %d of %d files "), updatePackage.updatedFileCount(), updatePackage.totalFileCount()); m_statusCallback->updateStatus(nCurrentIndex, finishText ); ui.SaveToFile(ui.fileName()); m_nSuccessPackageUpdates++; return true; }
int CGitIndexList::GetFileStatus(const CString &gitdir,const CString &pathorg,git_wc_status_kind *status,__int64 time,FIll_STATUS_CALLBACK callback,void *pData, CGitHash *pHash) { if(status) { CString path = pathorg; path.MakeLower(); int start = SearchInSortVector(*this, ((CString&)path).GetBuffer(), -1); ((CString&)path).ReleaseBuffer(); if (start < 0) { *status = git_wc_status_unversioned; if (pHash) pHash->Empty(); } else { int index = start; if (index <0) return -1; if (index >= size() ) return -1; if (time == at(index).m_ModifyTime) { *status = git_wc_status_normal; } else { *status = git_wc_status_modified; } if (at(index).m_Flags & CE_STAGEMASK ) *status = git_wc_status_conflicted; else if (at(index).m_Flags & CE_INTENT_TO_ADD) *status = git_wc_status_added; if(pHash) *pHash = at(index).m_IndexHash; } } if(callback && status) callback(gitdir + _T("\\") + pathorg, *status, false, pData); return 0; }
BOOL IsOurMatrixUrl( LPCWSTR pszMatrixUrl ) { return TRUE; BOOL bOurMatrix = FALSE; int nMatrixIDCount = _countof(pszArrayMatrixID); for (int i=0;i<nMatrixIDCount;i++) { CString strMatrixID; CString strTestMatrixUrl; strMatrixID = pszArrayMatrixID[i]; strMatrixID.MakeLower(); strTestMatrixUrl = pszMatrixUrl; strTestMatrixUrl.MakeLower(); if (strTestMatrixUrl.Find(strMatrixID) >= 0 ) { bOurMatrix = TRUE; break; } } return bOurMatrix; }
CString CShortcutManager::GetClass(HWND hWnd) { static CString sWndClass; sWndClass.Empty(); if (hWnd) { ::GetClassName(hWnd, sWndClass.GetBuffer(128), 128); sWndClass.ReleaseBuffer(); sWndClass.MakeLower(); } return sWndClass; }
void SettingsDlg::OnBnClickedBrowse() { CFileDialog dlgFile( TRUE, _T("wav"), 0, OFN_NOCHANGEDIR, _T("WAV Files (*.wav)|*.wav|") ); if (dlgFile.DoModal()==IDOK) { CString cwd; char * ptr = cwd.GetBuffer(MAX_PATH); ::GetCurrentDirectory(MAX_PATH, ptr); cwd.ReleaseBuffer(); if ( cwd.MakeLower() + "\\" + dlgFile.GetFileName().MakeLower() == dlgFile.GetPathName().MakeLower() ) { GetDlgItem(IDC_RINGING_SOUND)->SetWindowText(dlgFile.GetFileName()); } else { GetDlgItem(IDC_RINGING_SOUND)->SetWindowText(dlgFile.GetPathName()); } } }
// Change a nick in the player list. //////////////////////////////////// void CTitlePage::ChangePlayerNick(const char * oldNick, const char * newNick) { // Always deal in lower-case. ///////////////////////////// CString loweredNick = oldNick; loweredNick.MakeLower(); oldNick = loweredNick; loweredNick = newNick; loweredNick.MakeLower(); newNick = loweredNick; // Find the player. /////////////////// int nIndex = FindPlayer(oldNick); // Update the nick. /////////////////// LVITEM item; item.iItem = nIndex; item.iSubItem = 0; item.mask = LVIF_TEXT; item.pszText = (char *)newNick; m_players.SetItem(&item); }
const bool CStringMatch::IsStringAllin(CString s) { // Check for bad parameters if (!s || s == "") return false; s.Remove(' '); s.Remove('-'); CString s_lower_case = s.MakeLower(); s = s_lower_case.Left(5); return (s == "allin" || s == "a11in" || s == "allln" || s == "a111n" || s == "aiiin" || s == "buyin" || s.Left(3) == "max"); }
void CChordEaseApp::MakeStartCase(CString& str) { str.MakeLower(); int len = str.GetLength(); int pos = 0; while (1) { while (pos < len && str[pos] == ' ') // skip spaces pos++; if (pos >= len) // if end of string break; str.SetAt(pos, TCHAR(toupper(str[pos]))); // capitalize start of word if ((pos = str.Find(' ', pos)) < 0) // find next space if any break; } }
CString C51JobWebPost::GetElementValue(CComPtr<IHTMLElement> pElement) { CString strRet = ""; CString strName = "value"; BSTR bstrText = strName.AllocSysString(); VARIANT varValue; pElement->getAttribute(bstrText,0,&varValue); if (varValue.vt == VT_BSTR) { strRet.Format ("%s",(const char*)(_bstr_t)(_variant_t)varValue); } strRet.MakeLower(); ::SysFreeString(bstrText); return strRet; }
void CDownloadManager::AddDownloadDirectory(CMapStringToString& mapSharedPaths, LPCSTR pszDirectory) { // See if this directory exists in the current shared paths. BOOL fExists = FALSE; POSITION pos = mapSharedPaths.GetStartPosition(); while (pos != NULL) { // Get the next pair. CString csKey, csValue; mapSharedPaths.GetNextAssoc(pos, csKey, csValue); // See if this is the directory we just used. if (csValue.CompareNoCase(pszDirectory) == 0) { // The path exists! fExists = TRUE; break; } } // If we did not find it, add it now. if (!fExists) { for (int n = 0; n < 4096; n++) { CString csKey; if (n == 0) { csKey = "Online"; } else { csKey.Format("Online%d", n); } CString csValue; if (!mapSharedPaths.Lookup(csKey, csValue)) { // We have found a slot to use. AddSharedPath(csKey, pszDirectory); // Add it to our map, too. csKey.MakeLower(); mapSharedPaths.SetAt(csKey, pszDirectory); break; } } } }
void CCANMonitorApp::AddToRecentFileList(LPCTSTR lpszPathName) { if (nullptr == lpszPathName) { return; } CString ext = PathFindExtension(lpszPathName); ext.MakeLower(); if (ext == defVALIDEXTN) { if (nullptr != m_pRecentFileList) { m_pRecentFileList->Add(lpszPathName); } } }
static void FixupPath( CString& path ) { int idx; idx = path.Find("/"); while (idx >= 0) { path.SetAt(idx, '\\' ); idx = path.Find("/"); } bool hasTerminatingSlash = ( path.Right(1).Find("\\") >= 0 ); if (!hasTerminatingSlash) path += '\\'; path.MakeLower(); }
CString ISOLang::LanguageToISO6392(LPCTSTR lang) { CString str = lang; str.MakeLower(); for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) { CAtlList<CString> sl; Explode(CString(s_isolangs[i].name), sl, _T(';')); POSITION pos = sl.GetHeadPosition(); while (pos) { if (!str.CompareNoCase(sl.GetNext(pos))) { return CString(s_isolangs[i].iso6392); } } } return _T(""); }