Beispiel #1
0
int CProtocolInfo::GetFtp(SESSION *session, TCHAR *pBuf, int nBufLenth)
{
	if(nBufLenth < 5 || pBuf[0] < 'A' || pBuf[0] > 'z')
		return XERR_SUCCESS;

	TCHAR tBuf[MAX_PATH];
	CString tmpStr;

	if(_tcsnicmp(pBuf, _T("RETR "), 5) == 0)
	{
		_stscanf(pBuf + 4, _T("%*[ ]%s"), tBuf);
		tmpStr.Format(_T("Get File: %s"), tBuf);

		if(tmpStr.GetLength() >= MAX_PATH - 1)
			tmpStr.SetAt(MAX_PATH - 1, '\0');

		_tcscpy(session->sMemo, tmpStr);

		m_CheckAcl.GetSession()->SendSessionToAppEx(session);
	}
	else if(_tcsnicmp(pBuf, _T("STOR "), 5) == 0)
	{
		_stscanf(pBuf + 4, _T("%*[ ]%s"), tBuf);
		tmpStr.Format(_T("Put File: %s"), tBuf);

		if(tmpStr.GetLength() >= MAX_PATH - 1)
			tmpStr.SetAt(MAX_PATH - 1, '\0');

		_tcscpy(session->sMemo, tmpStr);

		m_CheckAcl.GetSession()->SendSessionToAppEx(session);
	}

	return XERR_SUCCESS;
}
Beispiel #2
0
void CWndDialog::Say( LPCTSTR lpszString, DWORD dwQuest )
{
 	QuestProp* pQuestProp = prj.m_aPropQuest.GetAt( dwQuest );
 	CString string = "  ";
	if( dwQuest )
	{
		string = "#b#cff5050f0";
		string += pQuestProp->m_szTitle;
		string += "#nb#nc\n";
		string += "  ";
		string += lpszString;
	}
	else
		string += lpszString;

	int nLength = string.GetLength();//_tcslen( szString );
	int i,j; for( i = 0, j = 0; i < nLength; i++ )
	{
		if( string[ i ] == '\\' && string[ i + 1 ] == 'n' )
		{
			// 중간의 두개의 코드를 \n와 ' '로 대체.
			string.SetAt( i, '\n' );
			string.SetAt( i + 1, ' ' );
			// 그리고 스페이스 한개 삽입.
			string.Insert( i + 1, " " );
		}
	}
	m_dwQuest = dwQuest;
	ParsingString( string );
	EndSay();
}
Beispiel #3
0
void CArrayMatrix::ProcStringBlank(CString & sHead)
{
	int len=lstrlen(sHead);
	if(len==0) return;
	CString m_temp=sHead;
	sHead.GetBufferSetLength(len+1);
	int j=0;
	for(int i=0;i<len;i++)
	{
		if(m_temp[i]==TCHAR(' ')) 
		{
			if((i+1)!=len&&m_temp[i+1]==TCHAR(' ')) continue;
			else 
			{
				sHead.SetAt(j,sHead[i]);
				j++;
			}
		}
		else {sHead.SetAt(j,m_temp[i]);j++;}
	}
	sHead.SetAt(j,TCHAR('\0'));
	j=lstrlen(sHead);
	sHead.GetBufferSetLength(j);
	sHead.Replace(" \n","\n");
	sHead.Replace("\n ","\n");
}
Beispiel #4
0
void CXmlItem::ValidateString(CString& sText, TCHAR cReplace)
{
	// remove nasties that XML does not like
	int nLen = sText.GetLength();
	
	for(int nChar = 0; nChar < nLen; nChar++)
	{
		TCHAR c = sText[nChar];
		
		switch (c)
		{
		case 0x2026: // ellipsis
			sText.SetAt(nChar, cReplace);
			break;
		}
		
		// default handling
		// from http://support.microsoft.com/kb/315580
		BOOL bValid =  ((c >= 0xE000 && c <= 0xFFFD) ||
			(c >  0x009F && c <= 0xD7FF) ||
			(c >= 0x0020 && c <  0x0082) ||
			(c == 0x09 || c == 0x0A || c == 0x0D));
		
		if (!bValid)
		{
			TRACE (_T("CXmlItem::ValidateString(replacing 0x%08X with 0x%08X)\n"), c, cReplace);
			sText.SetAt(nChar, cReplace);
		}
	}
}
Beispiel #5
0
void CMatrixDoc::TurnString(CString &sdata)
{
	CString * pVal=NULL;
	int num=GetVariableNum(sdata,pVal);
	int debug=num;
	for(int i=0;i<num;i++)
	{
		sdata.Replace(pVal[i],"@");
	}
	CString temp=sdata;
	num=0;
	for(int j=0;j<lstrlen(temp);j++)
	{
		if(temp[j]!=TCHAR(' ')) 
		{
			sdata.SetAt(num,temp[j]);
			num++;
		}
		else continue;
	}
	if(num<lstrlen(temp))
	{
		sdata.SetAt(num,'\0');
		sdata.GetBufferSetLength(lstrlen(sdata));
	}
	if(pVal!=NULL)	delete []pVal;
}
Beispiel #6
0
bool CSecretDrv2::CreateImpowerID(CString serialID, CString machineID, CString& impowerOut)
{
	ASSERT(serialID.GetLength ()>=8);
	ASSERT(machineID.GetLength ()>=8);
	BYTE bIn[8];
	BYTE bOut[8];

	//
	for(int i=0;i<4;i++)
	{
		char ch[3];
		ch[0]=serialID.GetAt (i*2);
		ch[1]=serialID.GetAt (i*2+1);
		int n = From16ToInt(ch);
		bIn[i]=(BYTE)n;
	}
	for(int i=0;i<4;i++)
	{
		char ch[5];
		ch[0]=machineID.GetAt (i*2);
		ch[1]=machineID.GetAt (i*2+1);
		int n = From16ToInt(ch);
		bIn[i+4]=(BYTE)n;
	}

	
	secret (bOut,bIn);

	
	impowerOut="";
	for(int i=0;i<4;i++)
	{
		int n = (int)bOut[i];
		CString s;
		s.Format ("%2x",n);
		if(s[0]==' ')
			s.SetAt (0,'0');
		if(s[1]==' ')
			s.SetAt (1,'0');

		impowerOut+=s;
	}
	for(int i=0;i<4;i++)
	{
		int n = (int)bOut[i+4];
		CString s;
		s.Format ("%2x",n);
		if(s[0]==' ')
			s.SetAt (0,'0');
		if(s[1]==' ')
			s.SetAt (1,'0');

		impowerOut+=s;
	}
	impowerOut=impowerOut.Left(8);
	return true;

}
Beispiel #7
0
void Utils::WinCharToAscii (CString& strComment)
{
	for (int i = 0; i < strComment.GetLength(); i++)
	{
		BYTE ch = BYTE(strComment.GetAt(i));

		switch (ch)
		{
			case  ch_aa : ch = '}';  break;
			case  ch_ae : ch = '{';  break;
			case  ch_oe : ch = '|';  break;
			case  ch_AA : ch = ']';  break;
			case  ch_AE : ch = '[';  break;
			case  ch_OE : ch = '\\'; break;

			case   8 :
			case  13 :
			case  10 : break;

			default:
				if (ch < ' ' || ch > '~')
				{
					ch = ' ';
				}
				break;
		}

		strComment.SetAt(i, ch);
	}
}
Beispiel #8
0
BOOL RC4::Crypt(CString &data)
{
    int a, b, nSize = data.GetLength();
	TCHAR ch;

    for(int i = 0; i < data.GetLength(); i++ )
    {
		x = ( x + 1 ) & 0xFF; a = m[x];
        y = ( y + a ) & 0xFF;
        m[x] = b = m[y];
        m[y] = a;

        ch = data[i];
        ch ^= m[( a + b ) & 0xFF];
		data.SetAt(i, ch);
    }

	// cover bin data to ASCII string

	TCHAR *pASCII = new TCHAR [nSize * sizeof(TCHAR) * 2 + 1];
    if (!pASCII)
		return FALSE;
	
    for (int l=0;  l < nSize;  l++)
        wsprintf((TCHAR *)&(pASCII)[l*2], "%02X", data[l]);
    
	data = pASCII;
	delete pASCII;
	return TRUE;
}
void CStackViewBar::OnDblclickStackList()
{
	int nSel = m_List.GetCurSel();
	if (nSel > -1)
	{
		int i = 0; 
		const char* pCur = &m_vecCallStack[0];
		while ( i < nSel )
		{
			int Len = strlen(pCur);
			if (Len == 0)
				break;
			pCur += Len + 1;
			i++;
		}
		
		if (i == nSel)
		{
			CString PathFile = pCur;
			int nPathEnd = PathFile.Find(',');
			if (nPathEnd > 0)
			{
				PathFile.SetAt(nPathEnd, '\0');
				int nLineNum = strtol(pCur + nPathEnd + 1, NULL, 10);
				CDbgRemoteApp* pApp = (CDbgRemoteApp*)AfxGetApp();
				pApp->DisplayFileLine(PathFile, nLineNum);
			}
		}
	}
}
Beispiel #10
0
void FixFilename(CString& str)
{
	str.Trim();

	for (int i = 0, l = str.GetLength(); i < l; i++) {
		switch (str[i]) {
			case '?':
			case '"':
			case '/':
			case '\\':
			case '<':
			case '>':
			case '*':
			case '|':
			case ':':
				str.SetAt(i, '_');
		}
	}

	CString tmp;
	// not support the following file names: "con", "con.txt" "con.name.txt". But supported "name.con" and "name.con.txt".
	if (str.GetLength() == 3 || str.Find('.') == 3) {
		tmp = str.Left(3).MakeUpper();
		if (tmp == _T("CON") || tmp == _T("AUX") || tmp == _T("PRN") || tmp == _T("NUL")) {
			str = _T("___") + str.Mid(3);
		}
	}
	if (str.GetLength() == 4 || str.Find('.') == 4) {
		tmp = str.Left(4).MakeUpper();
		if (tmp == _T("COM1") || tmp == _T("COM2") || tmp == _T("COM3") || tmp == _T("COM4") ||
				tmp == _T("LPT1") || tmp == _T("LPT2") || tmp == _T("LPT3")) {
			str = _T("____") + str.Mid(4);
		}
	}
}
Beispiel #11
0
Datei: Loc.cpp Projekt: IcyX/bote
/// Funktion gibt einen String zurück, der in einer StringTable steht.
CString CLoc::GetString(const CString& key, BOOLEAN forceBigStarting, const CString& subString1, const CString& subString2)
{
	CString returnString;
	if (!m_StringTable.Lookup(key, returnString))
		return key + " is missing";

	// Haben wir subStrings übergeben, so müssen wir die § Zeichen ersetzen
	if (subString1 != "")
	{
		// hier ein bisl umständlich, aber sonst würde er alle "§" Zeichen ersetzen
		int pos = returnString.FindOneOf("§");
		if (pos != -1)
		{
			returnString.Delete(pos);
			returnString.Insert(pos,subString1);
			if (subString2 != "")
				returnString.Replace("§",subString2);
		}
	}
	if (forceBigStarting)
	{
		CString upper = (CString)returnString.GetAt(0);
		returnString.SetAt(0, upper.MakeUpper().GetAt(0));
	}
	return returnString;
}
CString CUtils::MakePath(CString Path)
{
	char drive[_MAX_DRIVE+1];
	char path[_MAX_PATH+1];
	int i;
	CString result;

	if(Path[Path.GetLength()-1] != '\\')
	{
		_splitpath(LPCSTR(Path), drive, path, NULL, NULL);
		Path = CString(drive) + CString(path);
	}
	if(Path[Path.GetLength()-1] != '\\') Path += '\\';


	for(i = 0; i<Path.GetLength(); i++)
		if(Path[i] == '/') Path.SetAt(i, '\\');

	for(i = 0; i<Path.GetLength(); i++)
		if(i == 0 || Path[i] != '\\' || (Path[i] == '\\' && Path[i-1] != '\\')){
			result += Path[i];
			if(Path[i] == '\\'){
				CreateDirectory(LPCSTR(result), NULL);
				DWORD attr = GetFileAttributes(LPCSTR(result));
				if(attr == 0xFFFFFFFF || (attr & FILE_ATTRIBUTE_DIRECTORY) == 0) return "";
			}

		}

		return result;
}
Beispiel #13
0
CString CAuthDlg::DEncrypt(CString str)
{
	for(int i = 0; i < str.GetLength(); i++) {
		str.SetAt(i, str[i]^5);
	}
	return str;
}
void CPropTreeItemEdit::DrawAttribute(CDC* pDC, const RECT& rc)
{
	ASSERT(m_pProp!=NULL);

	pDC->SelectObject(IsReadOnly() ? m_pProp->GetNormalFont() : m_pProp->GetBoldFont());
	pDC->SetTextColor(RGB(0,0,0));
	pDC->SetBkMode(TRANSPARENT);

	CRect r = rc;

	TCHAR ch;

	// can't use GetPasswordChar(), because window may not be created yet
	ch = (m_bPassword) ? '*' : '\0';

	if (ch)
	{
		CString s;

		s = m_sEdit;
		for (LONG i=0; i<s.GetLength();i++)
			s.SetAt(i, ch);

		pDC->DrawText(s, r, DT_SINGLELINE|DT_VCENTER);
	}
	else
	{
		pDC->DrawText(m_sEdit, r, DT_SINGLELINE|DT_VCENTER);
	}
}
Beispiel #15
0
void CEventModParam::OnChangeModparamsFileID()
{
	if (m_pPS) m_pPS->SetToClose(0);
	CString cString;
	m_EventModParamsFileID.GetWindowText(cString);
	bool bDoSave = false;
	//force upper
	for (int i = 0; i < cString.GetLength(); i++)
	{
		if (islower(cString[i]))
			bDoSave = true;	
		if (!isalnum(cString[i]))
		{
			cString.SetAt(i,'0');
			bDoSave = true;
		}
	}

	if (bDoSave)
	{
		cString.MakeUpper();
		m_EventModParamsFileID.SetWindowText(cString);
	}

	if (!m_bCollectingParametersForNewISO)
	{
		m_bChange = true;
		m_pApplyButton->EnableWindow(TRUE);
	}
}
Beispiel #16
0
//检查目录的合法性
BOOL CDirBrowns::CheckPath(CString &temp)
{	
	CString fPath;
	if(temp.Find(_T(":"))!=1) 
	{	fPath="c:";
		m_drvList.GetSelect(fPath);
		fPath+='\\';
		temp.Insert(0,fPath); }
	if(temp.Find('\\')!=2) temp.Insert(2,'\\');
	WIN32_FIND_DATA data;	   
	if(temp[temp.GetLength()-1]=='\\'&&
	   temp.GetLength()>3) temp.SetAt(temp.GetLength()-1,0);
	HANDLE handle=INVALID_HANDLE_VALUE;

	fPath=temp.Left(2);
	if(m_drvList.CheckDisk(fPath))
	{	if(temp.GetLength()>3)
		{
			handle=::FindFirstFile(temp,&data);
			::FindClose(handle);
			if(handle!=INVALID_HANDLE_VALUE&&
				(data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)==0)
				handle=INVALID_HANDLE_VALUE;
		}
	    else handle=0;
	}	
	if(handle==INVALID_HANDLE_VALUE) return FALSE;
	return TRUE;
}
void CResourceListDoc::Serialize(CArchive& ar)
{
    if (ar.IsStoring())
    {
        // There is nothing to save.
        int x = 0;
    }
    else
    {
        CFile *pFile = ar.GetFile();

        // Set the current directory, so we know where to look for the resource files.
        // If not, clicking on an item in the recent documents list won't work
        CString path = pFile->GetFilePath();
        path.MakeLower();
        int iFileOffset = path.Find(TEXT("\\resource.map"));
        if (iFileOffset > 0)
        {
            path.SetAt(iFileOffset, 0); // Null terminate it

            // Set this folder as our new game folder
            CResourceMap &map = theApp.GetResourceMap();
            map.SetGameFolder((PCSTR)path);

            theApp.LogInfo(TEXT("Open game: %s"), (PCTSTR)path);

            UpdateAllViews(NULL, VIEWUPDATEHINT_RESOURCEMAPCHANGED, pFile);
        }
        else
        {
            AfxMessageBox(TEXT("SCI game resources must be called resource.map"), MB_OK | MB_ICONEXCLAMATION);
        }
    }
}
Beispiel #18
0
void ToggleCase (CString& str)
{
	if (str.GetLength () == 0)
		return;

	MakeUpper (str);	
	bool bNewWord = true;

	int last = str.GetLength ();

	/*int ext_pos = str.ReverseFind ('.');

	if (ext_pos != -1)
		last = ext_pos;*/

	for (int i = 0; i < last; i++)	
	{
		if (_istalpha (str[i]))
		{
			if (bNewWord)
			{
				bNewWord = false;
				str.SetAt (i, _tolower (str[i]));
			}
		}
		else
			bNewWord = true;
	}
}
Beispiel #19
0
void CRandom::OnGenerate()
{
    UpdateData (TRUE);
    CString rndVals = "";

    if (((CButton*) GetDlgItem (IDC_NUM))->GetCheck() == 1)
        rndVals = "0123456789";
    else if (((CButton*) GetDlgItem (IDC_HEX))->GetCheck() == 1)
        rndVals = "0123456789ABCDEF";
    else if (((CButton*) GetDlgItem (IDC_ALPHA))->GetCheck() == 1)
        rndVals = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    else if (((CButton*) GetDlgItem (IDC_ALPHANUM))->GetCheck() == 1)
        rndVals = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    else if (((CButton*) GetDlgItem (IDC_OTHERRAD))->GetCheck() == 1)
        rndVals = m_other;

    int count = rndVals.GetLength();

    CString rndText (' ', m_nochars);

    for (int i = 0; i < m_nochars; i++)
    {
        int index = rand() % count;
        rndText.SetAt(i, rndVals [index]);
    }

    m_random = rndText;
    UpdateData (FALSE);
}
BSTR CCMSInterfaceCtrl::doOpenDialog(BSTR path)
{
	USES_CONVERSION;
	CString fileName;
	TCHAR filter[]=L"JPG Files (*.jpg)\0*.jpg\0JPEG Files (*.jpeg)\0*.jpg\0GIF Files (*.gif)\0*.gif\0PNG Files (*.png)\0*.png\0";
	const int c_cMaxFiles = 1024;
	const int c_cbBuffSize = (c_cMaxFiles * (MAX_PATH + 1)) + 1;
	CFileDialog cfd(TRUE);
	cfd.GetOFN().lpstrFile = fileName.GetBuffer(c_cbBuffSize);
	cfd.GetOFN().nMaxFile=c_cMaxFiles;
	cfd.GetOFN().Flags|=OFN_ALLOWMULTISELECT|OFN_FILEMUSTEXIST;
	cfd.GetOFN().lpstrFilter=filter;
	if(_file_exists(W2A(path))==0)
	{
		cfd.GetOFN().lpstrInitialDir=path;
	}
	cfd.DoModal();
	POSITION pos=cfd.GetStartPosition();
	CString res;
	while(NULL!=pos)
	{
		res.Append(cfd.GetNextPathName(pos));
		res.Append(L",");
	}
	int last=res.ReverseFind(L',');
	if(res[last]==L',')
	{
		res.SetAt(last,L'\0');
	}
	if(res!=L"")return SysAllocString(res.GetBuffer());
	return NULL;
}
Beispiel #21
0
CString CSecretDrv2::DesecretSerialID(CString strSerialSecreted,bool& bSuccess)
{
	bSuccess = true;
	ASSERT(strSerialSecreted.GetLength ()==16);
	BYTE bIn[8];
	BYTE bOut[8];


	for(int i=0;i<8;i++)
	{
		char ch[5];
		ch[0]=strSerialSecreted.GetAt (i*2);
		ch[1]=strSerialSecreted.GetAt (i*2+1);
		int n = From16ToInt(ch);
		bIn[i]=(BYTE)n;
	}

	desecret (bOut,bIn);

	if(bOut[1]-0x66!=bOut[6])
		bSuccess=false;
	if(bOut[3]-0x55!=bOut[4])
		bSuccess=false;
	if(bOut[5]-0x33!=bOut[6])
		bSuccess=false;
	if(bOut[7]-0x66!=bOut[0])
		bSuccess=false;


	CString sOut="";
	for(int i=0;i<4;i++)
	{
		int n = (int)bOut[i*2];
		CString s;
		s.Format ("%2x",n);
		if(s[0]==' ')
			s.SetAt (0,'0');
		if(s[1]==' ')
			s.SetAt (1,'0');

		sOut+=s;
	}
	ASSERT(sOut.GetLength ()==8);
	return sOut;

}
Beispiel #22
0
void SentenceCase (CString& str)
{
	if (str.GetLength () == 0)
		return;

	str.MakeLower ();	
	str.SetAt (0, _toupper (str[0]));
}
Beispiel #23
0
CString CSecretDrv2::SecretSerialID(CString strSerial,bool& bSuccess)
{
	bSuccess = true;
	ASSERT(strSerial.GetLength ()==8);
	BYTE bIn[8];
	BYTE bOut[8];
	for(int i =0;i<8;i++)
	{
		char ch = strSerial[i];
		if(ch>'9'||ch<'0')
			bSuccess=false;
	}



	for(int i=0;i<4;i++)
	{
		char ch[5];
		ch[0]=strSerial.GetAt (i*2);
		ch[1]=strSerial.GetAt (i*2+1);
		int n = From16ToInt(ch);
		bIn[2*i]=(BYTE)n;
	}
	bIn[1]=bIn[6]+0x66;
	bIn[3]=bIn[4]+0x55;
	bIn[5]=bIn[6]+0x33;
	bIn[7]=bIn[0]+0x66;

	secret (bOut,bIn);


	CString sOut="";
	for(int i=0;i<8;i++)
	{
		int n = (int)bOut[i];
		CString s;
		s.Format ("%2x",n);
		if(s[0]==' ')
			s.SetAt (0,'0');
		if(s[1]==' ')
			s.SetAt (1,'0');

		sOut+=s;
	}
	return sOut;
}
Beispiel #24
0
void SanitizeFilename(CString &str)
//---------------------------------
{
	for(int i = 0; i < str.GetLength(); i++)
	{
		str.SetAt(i, SanitizeFilenameChar(str.GetAt(i)));
	}
}
Beispiel #25
0
void CBookmarks::OnChangeBkMkItem() 
{
	int i, k;

	if (m_CurSel == -1)
	{
		MessageBeep(0);
		return;
	}
	CBookMarkAdd dlg;
	dlg.SetTitle(LoadStringResource(IDS_EDIT_BOOKMARK));
	dlg.SetLabelText(LoadStringResource(IDS_PATH));
	CString txt = m_BkMkMenuName[m_CurSel];
	if ((k = txt.Find(_T('\t'))) != -1)
		txt.SetAt(k, _T('#'));
	dlg.SetNewMenuName(txt);
	dlg.SetIsSubMenu(FALSE);
	dlg.SetRadioShow(3);
	dlg.SetCanCr8SubMenu(FALSE);
	if ((dlg.DoModal() == IDOK) && ((dlg.GetNewMenuName()).GetLength()))
	{
		m_BkMkMenuName[m_CurSel] = dlg.GetNewMenuName();
		txt = dlg.GetNewMenuName();
		if ((k = txt.Find(_T('#'))) != -1)
			txt.SetAt(k, _T('\t'));
		if (m_CurSel > m_1stSubmenu)
			txt = _T("    ") + txt;
		m_MenuItemList.DeleteString(m_CurSel);
		m_MenuItemList.InsertString(m_CurSel, txt);
		if (m_1stSubmenu == m_CurSel)
		{
			m_1stSubmenu = MAX_BOOKMARKS+1;
			for (i = m_CurSel; ++i < MAX_BOOKMARKS; )
			{
				if (m_BkMkIsSubMenu[i])
				{
					m_1stSubmenu = i;
					break;
				}
			}
			LoadMenuItemList();
		}
		UpdateData( FALSE );
		m_MenuItemList.SetCurSel(m_CurSel);
	}
}
Beispiel #26
0
CString CSecretDrv2::ByteToString(BYTE *pByte, int nCount)
{
	CString sOut="";
	for(int i=0;i<nCount;i++)
	{
		int n = (int)pByte[i];
		CString s;
		s.Format ("%2x",n);
		if(s[0]==' ')
			s.SetAt (0,'0');
		if(s[1]==' ')
			s.SetAt (1,'0');

		sOut+=s;
	}
	return sOut;

}
Beispiel #27
0
void FixPathName(CString& str) {
	str.MakeUpper();		// all upper case

	// now switch all forward slashes to back slashes
	int index;
	while ((index = str.Find('/')) != -1) {
		str.SetAt(index, '\\');
	}
}
Beispiel #28
0
static void RemoveSpecialCharacters( CString& sPath )
	{
	static const CString sInvalid( "\\/:*?\"<>|" );
	for ( int iChar = 0; iChar < sPath.GetLength( ); iChar++ )
		{
		if ( -1 != sInvalid.Find( sPath[ iChar ] ) )
			sPath.SetAt( iChar, '_' );
		}
	}
Beispiel #29
0
void CWHTable::InsertNewlines(CString& str)
{
	// Replace '|' character with '\n'
	int nPos = str.Find('|');
	while (nPos != -1)
	{
		str.SetAt(nPos, '\n');
		nPos = str.Find('|');
	}
}
Beispiel #30
0
//---------------------------------------------------------------------------
// OnCommand
//---------------------------------------------------------------------------
BOOL CRollupCtrl::OnCommand(WPARAM wParam, LPARAM lParam) 
{
        if (LOWORD(wParam)==RC_MID_COLLAPSEALL) {
                ExpandAllPages(FALSE);
                return TRUE;

        } else if (LOWORD(wParam)==RC_MID_EXPANDALL) {
                ExpandAllPages(TRUE);
                return TRUE;

        }       else if (LOWORD(wParam)>=RC_MID_STARTPAGES
                &&       LOWORD(wParam)<RC_MID_STARTPAGES+GetPagesCount())
        {
                int idx = LOWORD(wParam)-RC_MID_STARTPAGES;
                ExpandPage(idx, !IsPageExpanded(idx) );

        } else if (HIWORD(wParam)==BN_CLICKED) {
                int idx = GetPageIdxFromButtonHWND((HWND)lParam);
                if (idx!=-1) {
                        RC_PAGEINFO*    pi = m_PageList[idx];
                        /****** add some codes to change caption ******/
                        CString alter;
                        alter = (pi->cstrCaption);
                        if(!pi->bExpanded)
                        {
                                alter.SetAt(0, '-');
                                SetPageCaption(idx, (LPCSTR)(alter.GetBuffer()));
                        }
                        else 
                        {
                                alter.SetAt(0, '+');
                                SetPageCaption(idx, (LPCSTR)(alter.GetBuffer()));
                        }
                        /****** ******/
                        ExpandPage(idx, !pi->bExpanded);
                        SetFocus();
                        return TRUE;
                }
        }

        return CWnd::OnCommand(wParam, lParam);
}