Example #1
0
void AssignSound()
{
  CString strBasePath = ValueForKey(g_qeglobals.d_project_entity, "basepath");
  AddSlash(strBasePath);
  CString strPath = strBasePath;
  strPath += "sound\\";

  CFileDialog dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Sound files (*.wav,*.mp3)|*.wav;*.mp3||", g_pParentWnd);
  dlgFile.m_ofn.lpstrInitialDir = strPath;
  if (dlgFile.DoModal() == IDOK)
  {
	  SendMessage(hwndEnt[EntKeyField], WM_SETTEXT, 0, (LPARAM)"noise");	
    CString str = dlgFile.GetPathName().GetBuffer(0);
    str.MakeLower();
    strBasePath.MakeLower();
    QE_ConvertDOSToUnixName(str.GetBuffer(0), str.GetBuffer(0));
    QE_ConvertDOSToUnixName(strBasePath.GetBuffer(0), strBasePath.GetBuffer(0));
    int n = str.Find(strBasePath);
    if (n == 0)
    {
      str = str.Right(str.GetLength() - strBasePath.GetLength());
    }

	  SendMessage(hwndEnt[EntValueField], WM_SETTEXT, 0, (LPARAM)str.GetBuffer(0));	
    AddProp();
    g_pParentWnd->GetXYWnd()->SetFocus();
  }
}
Example #2
0
void CSharedDirsTreeCtrl::FilterTreeAddSubDirectories(CDirectoryItem* pDirectory, CStringList& liDirs, int nLevel){
	// just some sanity check against too deep shared dirs
	// shouldnt be needed, but never trust the filesystem or a recursive function ;)
	if (nLevel > 14){
		ASSERT( false );
		return;
	}
	POSITION pos = liDirs.GetHeadPosition();
	CString strDirectoryPath = pDirectory->m_strFullPath;
	strDirectoryPath.MakeLower();
	while (pos){
		CString strCurrent = thePrefs.shareddir_list.GetNext(pos);
		CString strCurrentLow = strCurrent;
		strCurrentLow.MakeLower();
		if ( (strDirectoryPath.IsEmpty() || strCurrentLow.Find(strDirectoryPath + _T("\\"), 0) == 0) && strCurrentLow != strDirectoryPath){
			if (!FilterTreeIsSubDirectory(strCurrentLow, strDirectoryPath, liDirs)){
				CString strName = strCurrent;
				if (strName.Right(1) == "\\"){
					strName = strName.Left(strName.GetLength()-1);
				}
				strName = strName.Right(strName.GetLength() - (strName.ReverseFind('\\')+1));
				CDirectoryItem* pNewItem = new CDirectoryItem(strCurrent);
				pNewItem->m_htItem = InsertItem(TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE, strName, 5, 5, 0, 0, (LPARAM)pNewItem, pDirectory->m_htItem, TVI_LAST);
				pDirectory->liSubDirectories.AddTail(pNewItem);
				FilterTreeAddSubDirectories(pNewItem, liDirs, nLevel+1);
		
			}
		}
	}
}
Example #3
0
int CTrivia::ContainsStringExact(CString strLine, CString strSubString, BOOL bCase, BOOL bExactMatch)
{
	
    if(strLine.IsEmpty()) return FALSE;
	if(strSubString.IsEmpty()) return TRUE;
	int nReturn = -1;
	BOOL bFound = FALSE;
	if(!bCase){

		strLine.MakeLower();
		strSubString.MakeLower();
	}
	if(bExactMatch){

		if(strLine == strSubString){

			return 0;
		}
		else{

			return -1;
		}
	}

	CString strSearch = strSubString;
	strSearch.Remove('*');
	
	int nIndex = -1;
	BOOL bFront, bEnd;

	if((nIndex = strLine.Find(strSearch, 0)) >= 0){

		//Check if there is a space or ( at front and end of searched item
		bEnd = (nIndex + strSearch.GetLength() >= strLine.GetLength() ? TRUE : strLine.GetAt(strSearch.GetLength() + nIndex) == ' ');
		bFront = (nIndex > 0 ? strLine.GetAt(nIndex-1) == ' ' : TRUE);

		if((strSubString.GetAt(0) == '*') && (strSubString.GetAt(strSubString.GetLength()-1) == '*')){

			bFound = TRUE;
		}
		else if((strSubString.GetAt(0) == '*') && (strSubString.GetAt(strSubString.GetLength()-1) != '*')){

			bFound = bEnd;
		}
		else if((strSubString.GetAt(0) != '*') && (strSubString.GetAt(strSubString.GetLength()-1) == '*')){

			bFound = bFront;
		}
		else{

			bFound = bFront && bEnd;
		}
		if(bFound){
			
			nReturn = nIndex;
		}
	}
	return nReturn;
}
BOOL CheckAudioDevice(CString strPnpId, CString strHardwareId, CString strName)
{
	strPnpId.MakeLower();
	strHardwareId.MakeLower();
	strName.MakeLower();

	if (strPnpId.Find(strHardwareId) != -1
		&& strPnpId.Find(strName) != -1)
		return TRUE;
	return FALSE;
}
/*-----------------------------------------------------------------------------
	Take a crack at modifying custom headers
-----------------------------------------------------------------------------*/
void CWinInetEvents::OnHttpAddRequestHeaders(HINTERNET hRequest, CString &headers, DWORD &dwModifiers)
{
    if( active )
    {
        if( !userAgent.IsEmpty() )
        {
            CString lcase = headers;
            lcase.MakeLower();
            int offset = lcase.Find(_T("user-agent"));
            if( offset >= 0 )
            {
                offset = lcase.Find(_T(":"), offset);
                if( offset >= 0 )
                {
                    int end = lcase.Find(_T('\n'), offset);
                    if( end >= -1 )
                    {
                        // insert it in the middle of the string
                        headers = headers.Left(offset + 2) + userAgent + headers.Mid(end);
                    }
                }
            }
        }
        else if( script_modifyUserAgent && !keepua )
        {
            // modify the user agent string if it was passed as a custom header (IE8)
            CString agent;
            agent.Format(_T("; PTST 2.%d"), build);
            if( headers.Find(agent) == -1 )
            {
                CString lcase = headers;
                lcase.MakeLower();
                int offset = lcase.Find(_T("user-agent"));
                if( offset >= 0 )
                {
                    int end = lcase.Find(_T('\n'), offset);
                    if( end >= -1 )
                    {
                        // now scan backwards for the end parenthesis
                        CString left = lcase.Left(end);
                        int end2 = left.ReverseFind(_T(')'));
                        if( end2 >= 0 )
                            end = end2;

                        // insert it in the middle of the string
                        headers = headers.Left(end) + agent + headers.Mid(end);
                    }
                }
            }
        }
    }
}
Example #6
0
bool CSharedDirsTreeCtrl::FileSystemTreeHasSharedSubdirectory(CString strDir)
{
	if (strDir.Right(1) != _T('\\'))
		strDir += _T('\\');
	strDir.MakeLower();
	for (POSITION pos = m_strliSharedDirs.GetHeadPosition(); pos != NULL; )
	{
		CString strCurrent = m_strliSharedDirs.GetNext(pos);
		strCurrent.MakeLower();
		if (strCurrent.Find(strDir) == 0 && strDir != strCurrent)
			return true;
	}
	return false;
}
bool CDirectoryTreeCtrl::HasSharedSubdirectory(CString strDir)
{
	if (strDir.Right(1) != _T('\\'))
		strDir += _T('\\');
	strDir.MakeLower();
	for (POSITION pos = m_lstShared.GetHeadPosition(); pos != NULL; )
	{
		CString str = m_lstShared.GetNext(pos);
		str.MakeLower();
		if (str.Find(strDir) == 0 && strDir != str)//strDir.GetLength() != str.GetLength())
			return true;
	}
	return false;
}
//在设备列表框中查找
void CDlgAddCards::FindInLstDevices()
{	
	UpdateData();

	CString sKey = m_sFilterKey.Trim();
	sKey = sKey.MakeLower();
	if(sKey.IsEmpty())
		return;

	set<int> rowToDelete;//要删除的行(指定的列不含关键字)
	int nRowCnt = m_lstDevices.GetItemCount();
	int nColCnt = m_vecKeynames.size();

	//删除不含关键字的行,注意:从后往前删
	for (int r = nRowCnt - 1; r >= 0; r--)
	{
		bool bFind = false;

		if (sKey.IsEmpty())
		{
			bFind = true;//搜索关键字为空,无需查找,直接显示
		}
		else
		{
			//在所选的列中查找
			for (set<int>::iterator it = m_setColIDToFind.begin();
				it != m_setColIDToFind.end(); ++it)
			{
				int c = *it;
				CString sItem = m_lstDevices.GetItemText(r,c);
				sItem = sItem.MakeLower();//转小写
				if (sItem.Find(sKey) != -1)
				{
					bFind = true;
					break;
				}
			}
		}

		//不含有关键字,就删除该行
		if ( !bFind)
		{
			m_lstDevices.DeleteItem(r);
		}
	}

	UpdateData(FALSE);
}
bool GitAdminDir::IsAdminDirPath(const CString& path) const
{
	if (path.IsEmpty())
		return false;
	bool bIsAdminDir = false;
	CString lowerpath = path;
	lowerpath.MakeLower();
	int ind1 = 0;
	while ((ind1 = lowerpath.Find(_T("\\.git"), ind1))>=0)
	{
		int ind = ind1++;
		if (ind == (lowerpath.GetLength() - 5))
		{
			bIsAdminDir = true;
			break;
		}
		else if (lowerpath.Find(_T("\\.git\\"), ind)>=0)
		{
			bIsAdminDir = true;
			break;
		}
	}

	return bIsAdminDir;
}
Example #10
0
CString GetSIPURI(CString str, bool isSimple, bool isLocal)
{
	CString rab = str;
	rab.MakeLower();
	int pos = rab.Find(_T("sip:"));
	if (pos==-1)
	{
		str=_T("sip:")+str;
	}
	if (!isLocal) {
		pos = str.Find(_T("@"));
		if (accountSettings.accountId && pos==-1) {
			str.Append(_T("@")+accountSettings.account.domain);
		}
	}
	if (str.GetAt(str.GetLength()-1)=='>')
	{
		str = str.Left(str.GetLength()-1);
		if (!isSimple) {
			if (!isLocal || !accountSettings.accountId) {
				AddTransportSuffix(str);
			}
		}
		str += _T(">");
	} else {
		if (!isSimple) {
			if (!isLocal || !accountSettings.accountId) {
				AddTransportSuffix(str);
			}
		}
		str = _T("<") + str + _T(">");
	}
	return str;
}
void CXTPSyntaxEditColorThemesManager::LoadTheme(const CString& strThemeName,
												const CString& strThemeFilename)
{
	// delete old theme
	CXTPSyntaxEditColorTheme* pTheme = NULL;
	if (m_mapThemes.Lookup(strThemeName, pTheme) && pTheme)
	{
		delete pTheme;
		// delete its name
		for (int i = 0; i < m_arThemeNames.GetSize(); i++)
		{
			if (!m_arThemeNames.GetAt(i).CompareNoCase(strThemeName))
			{
				m_arThemeNames.RemoveAt(i);
				break;
			}
		}
	}

	// create and load new theme
	pTheme = new CXTPSyntaxEditColorTheme(this);
	pTheme->Load(strThemeFilename);

	m_mapThemes[strThemeName] = pTheme;
	m_arThemeNames.Add(strThemeName);

	CString strTFNameLower = strThemeFilename;
	strTFNameLower.MakeLower();
	m_mapFileToTheme[strTFNameLower] = strThemeName;
}
Example #12
0
int CGitIndexFileMap::IsUnderVersionControl(const CString &gitdir, const CString &path, bool isDir,bool *isVersion, bool isLoadUpdateIndex)
{
    try
    {
        if (path.IsEmpty())
        {
            *isVersion = true;
            return 0;
        }

        CString subpath = path;
        subpath.Replace(_T('\\'), _T('/'));
        if(isDir)
            subpath += _T('/');

        subpath.MakeLower();

        CheckAndUpdate(gitdir, isLoadUpdateIndex);

        SHARED_INDEX_PTR pIndex = this->SafeGet(gitdir);

        if(pIndex.get())
        {
            if(isDir)
                *isVersion = (SearchInSortVector(*pIndex, subpath, subpath.GetLength()) >= 0);
            else
                *isVersion = (SearchInSortVector(*pIndex, subpath, -1) >= 0);
        }

    } catch(...)
    {
        return -1;
    }
    return 0;
}
bool CDirectoryTreeCtrl::HasSharedSubdirectory(CString strDir)
{
	CString str;

	strDir.MakeLower();
	for (POSITION pos = m_lstShared.GetHeadPosition(); pos != NULL;)
	{
		str = m_lstShared.GetNext(pos);
		str.MakeLower();

		if (str.Find(strDir) == 0 && strDir != str)
			return DirectoryExists(str);
	}

	return false;
}
Example #14
0
// returns NULL if error, else usable (local) path...
//
static LPCSTR Skins_ModelNameToSkinPath(LPCSTR psModelFilename)
{
	static CString str;
			str = psModelFilename;
			str.MakeLower();
 	while  (str.Replace('\\','/')){}	

	// special case for anything in the "objects" dir...
	//
	int i = str.Find("models/objects/");
	if (i>=0)
	{
		str = str.Left(i+strlen("models/objects/"));
		str+= "skins";
		return (LPCSTR) str;
	}

	// or anything else...
	//
	i = str.Find("models/");
	if (i>=0)
	{
		str = str.Left(i+strlen("models/"));
		str+= "characters/skins";		
		return (LPCSTR) str;
	}

	return NULL;
}
bool CNumEncoder::DecodeFromString(CString Str)
{
	Str = Str.MakeLower();

	Clear();
	bool InNumber = false;
	int ToRead = 0;
	CString Temp = "";

	for(int i=0; i<Str.GetLength(); i++)
	{
		char Ch = GetChar(i, Str);
		if(!InNumber)
		{
			ToRead = Ch;
			InNumber = true;
			Temp = "";
		}
		else
		{
			Temp += (char)('0' + Ch);
			ToRead--;

			if(ToRead==0)
			{
				m_Numbers.Add(atoi(Temp));
				InNumber = false;
			}
		}
	}
	return true;
}
Example #16
0
long ExtObject::cCompareText(LPVAL params)
{
	CString l = params[0].GetString();

	// Case sensitive?
	if (params[1].GetBool()) {
		return l == text;
	}
	// Case insensitive
	else {
		CString r = text;
		l.MakeLower();
		r.MakeLower();
		return l == r;
	}
}
Example #17
0
void CWndStyleEditor::OnBnClickedSelectPic()
{
	if(NULL == SQRGUIStyleManager::GetInst()->GetActiveStyle())
		return;
	// TODO: Add your control notification handler code here
	CString FileName = GetFileName(true, L"GUI Texture (*.tex *.dds)|*.tex;*.dds||");
	
	SQRGUIStyle* pStyle = SQRGUIStyleManager::GetInst()->GetActiveStyle();
	
	CString CurPath = utf8_to_utf16(pStyle->GetTexturePath()).c_str();
	CurPath.MakeLower();
	wstring Str = FileName.GetBuffer();
	wstring TexStr = Str.substr(Str.rfind(L"\\") + 1, Str.size());
	CString TexPath = Str.substr(0, Str.rfind(L"\\") + 1).c_str();

	if(m_pStyleStruct!=NULL &&
		Str.size()>0 &&
		m_pStyleStruct->m_TexString!=utf16_to_utf8(TexStr).c_str() &&
		TexPath == CurPath )
	{
		m_pStyleStruct->m_TexString = utf16_to_utf8(TexStr).c_str();
		m_pStyleStruct->Release();
		CGraphic::GetInst()->CreateTexture(L"",  
			(SQRGUIStyleManager::GetInst()->GetActiveStyle()->GetTexturePath()+utf16_to_utf8(TexStr)).c_str(),
			&(m_pStyleStruct->pTexture) );
		m_TextureEdit.SetWindowText(TexStr.c_str());
		RefreshMaskList();
	}
}
Example #18
0
//********************************************
// ReadFile
// Redirection
//********************************************
int CTexture::ReadFile(char *filename,
											 unsigned int width,
											 unsigned int height,
											 unsigned int depth)
{
	// Cleanup
	Free();

	// Storage
	m_FileName = filename;

	// Extension
	CString string = filename;
	string.MakeLower();
	TRACE("CTexture::ReadFile : file : %s\n",filename);
	CString extension = string.Right(4);

	// Redirection BMP
	if(extension == ".bmp")
		return ReadFileBMP(filename);


	// Redirection RAW
	if(extension == ".raw")
		return ReadFileRAW(filename,width,height,depth);

	// Unrecognized file format
	CString message;
	message.Format("CTexture::ReadFile : invalid file redirection : %s\n",filename);
	AfxMessageBox(string);

	return 0;
}
Example #19
0
/**
*	\remarks	Loads a .dll / stores the HMODULE in a map
*
*	\details	-	When a module (Action*.dll) is loaded it is stored in a map
*				-	Subsequent loads return the mapped pointer, instead of calling
*					LoadLibrary()
*				-	Modules stay loaded until CBldActionDllManager::UnLoadDlls()
*					is called (when the sequence is complete CBldSequencer::Done())
*/
HMODULE CBldActionDllManager::LoadDll(LPCTSTR lpszModuleName)
{
	//create map if not loaded
	if (!g_theDllManager.m_DllMap)
		g_theDllManager.m_DllMap = new CMapStringToPtr (MAX_LOADED_DLLS);

	//if no map || map is full, just use ::AfxLoadLibrary
	if (!g_theDllManager.m_DllMap ||
		 g_theDllManager.m_iLoaded >= MAX_LOADED_DLLS)
	{
		return ::AfxLoadLibrary(lpszModuleName);
	}

	HMODULE hDll = NULL;
	CString sDll = lpszModuleName;
	sDll.MakeLower();

	//if already in map, return module
	if (g_theDllManager.m_DllMap->Lookup(sDll, (void*&)hDll))
		return hDll;

	//not in map, load it and add it to map
	hDll = ::AfxLoadLibrary(sDll);
	if (hDll)
	{
		g_theDllManager.m_DllMap->SetAt(static_cast<LPCTSTR>(sDll), hDll);
		g_theDllManager.m_iLoaded++;
	}

	return hDll;

} //static CBldActionDllManager::LoadDll()
Example #20
0
int CWebBase::ConvertData(CString strReponseHead,CString &strError,CString &strData)
{
	int nStringLen = -1;
	strReponseHead.MakeLower();
	//是被压缩过的, 要解压
	if(strReponseHead.Find("gzip" ) != -1) 
	{                        
		nStringLen = strData.GetLength();
		if( gzuncompress(strData, nStringLen ) != 0 )
		{
			strError = "解压失败";
			return -5;
		}
	}
	if (g_iUtfFlag == 1)
	{
		ConvertUtf8ToGBK(m_strWorkBuf);
		return 0;
	}
	if( strReponseHead.Find("utf-8") != -1 && strReponseHead.Find("jpeg" ) == -1 )
	{                        
		ConvertUtf8ToGBK( strData );
	}
	return 0;
}
Example #21
0
engine_t CMediaFormats::GetEngine(CString path) const
{
    path.Trim().MakeLower();

    if (!m_fRtspFileExtFirst && path.Find(_T("rtsp://")) == 0) {
        return m_iRtspHandler;
    }

    CString ext = CPath(path).GetExtension();
    ext.MakeLower();
    if (!ext.IsEmpty()) {
        if (path.Find(_T("rtsp://")) == 0) {
            if (ext == _T(".ram") || ext == _T(".rm") || ext == _T(".ra")) {
                return RealMedia;
            }
            if (ext == _T(".qt") || ext == _T(".mov")) {
                return QuickTime;
            }
        }

        for (size_t i = 0; i < GetCount(); i++) {
            const CMediaFormatCategory& mfc = GetAt(i);
            if (mfc.FindExt(ext)) {
                return mfc.GetEngineType();
            }
        }
    }

    if (m_fRtspFileExtFirst && path.Find(_T("rtsp://")) == 0) {
        return m_iRtspHandler;
    }

    return DirectShow;
}
Example #22
0
bool CCommonAppUtils::AddClipboardUrlToWindow( HWND hWnd )
{
    if (IsClipboardFormatAvailable(CF_UNICODETEXT))
    {
        CClipboardHelper clipboard;
        clipboard.Open(hWnd);
        HGLOBAL hglb = GetClipboardData(CF_UNICODETEXT);
        if (hglb)
        {
            LPCWSTR lpstr = (LPCWSTR)GlobalLock(hglb);
            CString sUrl = lpstr;
            GlobalUnlock(hglb);

            sUrl.Trim();
            CString sLowerCaseUrl = sUrl;
            sLowerCaseUrl.MakeLower();
            // check for illegal chars: they might be allowed in a regular url, e.g. '?',
            // but not in an url to an svn repository!
            if (sLowerCaseUrl.FindOneOf(L"\n\r?;=+$,<>#") >= 0)
                return false;

            if ((sLowerCaseUrl.Find(L"http://")==0) ||
                (sLowerCaseUrl.Find(L"https://")==0) ||
                (sLowerCaseUrl.Find(L"svn://")==0) ||
                (sLowerCaseUrl.Find(L"svn+ssh://")==0) ||
                (sLowerCaseUrl.Find(L"file://")==0))
            {
                ::SetWindowText(hWnd, (LPCTSTR)sUrl);
                return true;
            }
        }
    }
    return false;
}
Example #23
0
/**
 * @brief Check if any of filefilter rules match to filename.
 *
 * @param [in] szFileName Filename to test.
 * @return TRUE unless we're suppressing this file by filter
 */
BOOL FileFilterHelper::includeFile(LPCTSTR szFileName)
{
	if (m_bUseMask)
	{
		if (m_pMaskFilter == NULL)
		{
			_RPTF0(_CRT_ERROR, "Use mask set, but no filter rules for mask!");
			return TRUE;
		}

		// preprend a backslash if there is none
		CString strFileName = szFileName;
		strFileName.MakeLower();
		if (strFileName[0] != _T('\\'))
			strFileName = _T('\\') + strFileName;
		// append a point if there is no extension
		if (strFileName.Find(_T('.')) == -1)
			strFileName = strFileName + _T('.');

		char * name_utf = UCS2UTF8_ConvertToUtf8(strFileName);
		bool match = m_pMaskFilter->Match(strlen(name_utf), name_utf);
		UCS2UTF8_Dealloc(name_utf);
		return match;
	}
	else
	{
		if (!m_fileFilterMgr || !m_currentFilter)
			return TRUE;
		return m_fileFilterMgr->TestFileNameAgainstFilter(m_currentFilter, szFileName);
	}
}
Example #24
0
// Assumes that lpSearch is lower-case when bCaseSensitive == FALSE
// If pUseRegex is not NULL, a regular expression search will be
// performed, otherwise a simple substring matching.
bool StrMatchText(LPCTSTR lpEntryData, LPCTSTR lpSearch,
	BOOL bCaseSensitive, const boost::basic_regex<TCHAR>* pUseRegex)
{
	ASSERT(lpEntryData != NULL);
	if((lpEntryData == NULL) || (lpEntryData[0] == 0)) return false;

	ASSERT((lpSearch != NULL) && (lpSearch[0] != 0));

	// #ifndef _WIN64
	if(pUseRegex != NULL)
	{
		try
		{
			return boost::regex_match(lpEntryData, *pUseRegex,
				boost::regex_constants::match_any);
		}
		catch(...) { return false; }
	}
	// #else
	// #pragma message("No regular expression support in x64 library.")
	// UNREFERENCED_PARAMETER(pUseRegex);
	// #endif

	if(bCaseSensitive == FALSE)
	{
		CString strEntryData = lpEntryData;
		strEntryData = strEntryData.MakeLower();
		return (strEntryData.Find(lpSearch) != -1);
	}

	return (_tcsstr(lpEntryData, lpSearch) != NULL);
}
Example #25
0
bool CMountPoints::IsMountPoint(CString path)
{
	if (path.GetLength() < 3 || path[1] != _T(':') || path[2] != _T('\\'))
	{
		// Don't know how to make out mount points on UNC paths ###
		return false;
	}

	ASSERT(path.GetLength() >= 3);
	ASSERT(path[1] == _T(':'));
	ASSERT(path[2] == _T('\\'));

	if (!m_va.IsSupported())
		return false;

	if (path.Right(1) != _T('\\'))
		path+= _T("\\");

	path.MakeLower();

	CString volume= m_drive[path[0] - _T('a')];
	path= path.Mid(3);

	return IsVolumeMountPoint(volume, path);
}
Example #26
0
BOOL CommandLine::IsSwitch(const CString & strParameterString,
	CString & strSwitchName,
	CString & strSwitchValue)
{
	strSwitchName.Empty();
	strSwitchValue.Empty();

	CString strPrefix = kPrefix;
	if (strParameterString.Find(strPrefix) != 0)
		return FALSE;

	const INT nSwitchStart = strPrefix.GetLength();
	const INT nEqualsPosition = strParameterString.Find(
		kDelimeter, nSwitchStart);

	if (nEqualsPosition == -1) 
	{
		strSwitchName = strParameterString.Mid(nSwitchStart);
	} 
	else 
	{
		strSwitchName = strParameterString.Mid(
			nSwitchStart, nEqualsPosition - nSwitchStart);
		strSwitchValue = strParameterString.Mid(nEqualsPosition + 1);
	}

	strSwitchName.MakeLower();

	return TRUE;
}
Example #27
0
// Lookup a function name
void CExpression::LookupPluginExpression(int oid, CString fname, ExpDot* pDot)
{
	CRunObjType* pType = pRuntime->pOid(oid);

	pDot->fname = fname;

	fname.MakeLower();

	vector<CString>* pvNames = pType->pPlugin->pvExpNames;

	// Check against all expression names
	for (int i = 0; i < pvNames->size(); i++) {

		// Name matches
		CString n = pvNames->at(i);
		if (n == fname) {

			// Get corresponding expression routine
			pDot->expRoutine = pType->pPlugin->pvExpRoutines->at(i);
			return;
		}
	}

	// Not found: calling unnamed expression routine
	pDot->unnamedExp = true;

	/*
	// Not found; error
	CString msg = "Error:  expression \"" + fname + "\" not found in object \"";
	msg += pType->Name;
	msg += "\"";
	throw runtime_error((const char*)msg);
	*/
}
Example #28
0
void CSharedDirsTreeCtrl::RemoveSharedDirectory(CString strDir, bool bSubDirectories){
	if (strDir.Right(1) == "\\"){
		strDir = strDir.Left(strDir.GetLength()-1);
	}
	strDir.MakeLower();
	POSITION pos1, pos2;
	for (pos1 = m_strliSharedDirs.GetHeadPosition();( pos2 = pos1 ) != NULL;)
	{
		m_strliSharedDirs.GetNext(pos1);
		CString str = m_strliSharedDirs.GetAt(pos2);
		str.MakeLower();
		if (str.CompareNoCase(strDir) == 0)
			m_strliSharedDirs.RemoveAt(pos2);
		else if (bSubDirectories && str.Find(strDir) == 0)
			m_strliSharedDirs.RemoveAt(pos2);
	}
}
Example #29
0
bool CScraper::GetButtonState(CString button_state_as_string) {
	CString button_state_lower_case = button_state_as_string.MakeLower();
	return (button_state_lower_case.Left(4) == "true" 
		|| button_state_lower_case.Left(2) == "on" 
		|| button_state_lower_case.Left(3) == "yes" 
		|| button_state_lower_case.Left(7) == "checked" 
		|| button_state_lower_case.Left(3) == "lit");
}
Example #30
0
CString CParsedHeaders::FindHeader (CString HeaderName)
{
	HeaderName.MakeLower();
	CString tmp;

	for (int i = 0; i < m_Headers.size(); i++)
	{
		tmp = m_Headers[i].Name;
		tmp.MakeLower();

		if (tmp == HeaderName)
		{
			return m_Headers[i].Value;
		}
	}
	return "";	//Not found
}