예제 #1
0
BOOL CCmdColor::execute(CString& params)
{
	//Decode parameters
	CStringList paramStrList;
	CScriptParser::StringSplit(paramStrList, params, CString(' '));

	//Need at least 3 params for r, g, b
	const int kNumParams = 3;
	if(paramStrList.GetCount() < kNumParams)
	{
		return FALSE;
	}

	float channels[kNumParams];
	POSITION pos = paramStrList.GetHeadPosition();
	for(int i = 0; i < kNumParams; ++i)
	{
		CString paramStr = paramStrList.GetNext(pos);
		channels[i] = (float)wcstod(paramStr, NULL);
	}

	CStateManager::GetInstance()->SetColor(CColor(channels[0], channels[1], channels[2]));

	return TRUE;
}
예제 #2
0
int CTyBase::GetStr_From_ReplacRule(CString srcStr,CString& dstStr, CStringList& ruleList)
{
	int ret = -1;
	dstStr = srcStr;
	char vsrcStr[33],vdstStr[33];
	char * token;
	char seps[] =  ",";
	int len;

	BOOL bFind = false;

	POSITION pos = ruleList.GetHeadPosition();

	CString str;
	char buf[256];
	memset(buf,0,sizeof(char)*256);

	while (pos != NULL)
	{
		str = ruleList.GetNext(pos);
		if (strlen(str) <= 0) 
			continue;

		strcpy(buf,str);
		switch (str[0])
		{
		case '0':
			{
				memset(vsrcStr,0,sizeof(char)*33);
				memset(vdstStr,0,sizeof(char)*33);

				token = strtok( buf, seps );
				token = strtok( NULL, seps );
				ASSERT(strlen(token) < 32);
				len = min(32,strlen(token));
				strncpy(vsrcStr,token,len);

				token = strtok( NULL, seps );
				ASSERT(strlen(token) < 32);
				len = min(32,strlen(token));
				strncpy(vdstStr,token,len);
				
				if (dstStr.Find(vsrcStr) >= 0)
				{
					dstStr.Replace(vsrcStr,vdstStr);
					bFind = true;
					ret = 1;
				}
			}
			break;
		default:
			break;
		}

		if (bFind)
			break;
	}

	return ret;
}
예제 #3
0
BOOL CCmdVertex2::execute(CString &params)
{
	// Decode parameters
	CStringList paramStrList;
	CScriptParser::StringSplit(paramStrList, params, CString( ' ' ));

	// Need at least 2 params for x, y
	const int numParams = 2;
	if(paramStrList.GetCount() < numParams)
	{
		return FALSE;
	}

	int coords[numParams];
	POSITION pos = paramStrList.GetHeadPosition();
	for(int i = 0; i < numParams; i++)
	{
		CString paramStr = paramStrList.GetNext(pos);
		coords[i] = (int)(wcstod(paramStr, NULL) + 0.5f);
	}

	//TODO: Change this the following to store a vertex2
	//CRasterizer::Instance()->DrawPoint(coords[0], coords[1]);

	return TRUE;
}
예제 #4
0
void CBibitemView::OnDblclkListFields(NMHDR* pNMHDR, LRESULT* pResult) 
{
	if (m_SelField != -1) {
		// Open URL
		CField *fi = (CField*)m_ListFields.GetItemData(m_SelField);
		if (fi) {
			if (!fi->GetValue().IsEmpty() && 
				(fi->GetName().CompareNoCase(STR_LOCALURL) == 0 || 
				fi->GetName().CompareNoCase(STR_URL) == 0)) {
				CString val = fi->GetValue();
				CStringList lst;
				SplitSepString(val, &lst);
				POSITION p = lst.GetHeadPosition();
				while (p) {
					if (ShellExec(lst.GetNext(p))) {
						if (p)
							// Wait some time if there are other files to show
							Sleep(500);
					} else
						MessageBeep(MB_ICONEXCLAMATION);
				}
			} else
				// Or show edit dialog
				OnFieldlistPopupEdit();
		}
	}
	
	*pResult = 0;
}
예제 #5
0
int CSetProgsAdvDlg::SaveData()
{
	if (m_ToolsValid)
	{
		// Remove all registry values which are no longer in the list
		CStringList values;
		if (m_regToolKey.getValues(values))
		{
			for (POSITION pos = values.GetHeadPosition(); pos; )
			{
				CString ext = values.GetNext(pos);
				if (m_Tools.find(ext) == m_Tools.end())
				{
					CRegString to_remove(m_regToolKey.m_path + L'\\' + ext);
					to_remove.removeValue();
				}
			}
		}

		// Add or update new or changed values
		for (auto it = m_Tools.cbegin(); it != m_Tools.cend() ; ++it)
		{
			CString ext = it->first;
			CString new_value = it->second;
			CRegString reg_value(m_regToolKey.m_path + L'\\' + ext);
			if (reg_value != new_value)
				reg_value = new_value;
		}
	}
	return 0;
}
예제 #6
0
파일: web.cpp 프로젝트: AlexVangelov/ar168l
void WebGetOptionsList(CString strInput, CStringList& strList)
{
	POSITION pos;
	int iPos;
	CString strName, strItem;

	iPos = strInput.Find(' ');
	strItem = strInput.Mid(iPos + 6);
	iPos = strItem.Find(' ');
	if (iPos != -1)
	{
		strName = strItem.Left(iPos);
	}
	else
	{
		strName = strItem;
	}
#ifndef __GNUC__
	for (pos = strList.GetHeadPosition(); pos != NULL;)
#else
  for (pos = strList.begin(); pos != strList.end(); ++pos)
#endif
	{
		strItem = strList.GetNext(pos);
		if (!strItem.Compare(strName))
		{
			return;
		}
	}
	strList.AddTail(strName);
}
예제 #7
0
BOOL CWindowPage::OnInitDialog()
{
    CPropertyPage::OnInitDialog();

    TRANSLATE(*this, IDD);

    m_wndSpinTextLen.SetRange32(1, TT_STRLEN);

    //convert font to LOGFONT
    ConvertFont(m_Font, m_lf);

    ShowFont();

    CStringList strings;
    GetLanguageFiles(strings);
    strings.AddHead(_T(""));

    for(POSITION pos=strings.GetHeadPosition();pos!=NULL;)
        m_wndLanguages.AddString(strings.GetNext(pos));

    if(!m_szLanguage.IsEmpty())
        m_wndLanguages.SelectString(-1, m_szLanguage);

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #8
0
BOOL CWizDlg::OnCommand(WPARAM wParam, LPARAM lParam) 
{ 
	if ( wParam>=100 &&  wParam<=100+25 )     // file history
    {
        if ( wParam-100 == popup.GetMenuItemCount()-1 ) // Click on 1st item
        {                       
            CString s1("");            
            POSITION pos = Recents.GetHeadPosition();
            while (pos)
            {         
                s1+=Recents.GetNext(pos)->GetPath();		
                s1+="\x0D\x0A";                            
            }            
            export_text(s1,&wnd);           
            return 1;            
        }        
        del_pos = Recents.GetHeadPosition();		
        for ( int x=1; x<wParam-99; x++)
            Recents.GetNext(del_pos);						

        if ( ctrl ) // delete it
        {               
            if ( wnd.isOpened() &&  wParam-100 == 0 )   { del_pos=NULL; return 1; }
            Recents.RemoveAt(del_pos);            
            Load_menu();
            del_pos=NULL;          
        } else
             wnd.RedFile((char*)(LPCTSTR)(Recents.GetAt(del_pos))->GetPath(),0);                
            load_menu_ch();		
    }
	if ( wParam>=150 && wParam<=150+50+5 )    // Bookm menu
	{
        if ( wParam-150 == bookm.GetMenuItemCount()-1 ) // Click on 1st item
        {            
            CStringList lst;
            CString s1("");
            
            Recents.GetHead()->load_menu_bm(lst);
            POSITION p=lst.GetHeadPosition();
            while (p)
            { s1+=lst.GetNext(p); s1+="\x0D\x0A";}
             Recents.GetHead()->add_memo(s1);            
            return 1;            
        }        
        if ( ctrl ) // delete it
        {   
            Recents.GetHead()->del_at(wParam-150);            
            load_menub();
            check_bookm();

        } else
        {
            Recents.GetHead()->jmp_to(wParam-150); //>first_bookm();		
            wnd.Seek_to((Recents.GetHead())->cur_pos);		
        }
    }	
	return CDialog::OnCommand(wParam, lParam);
}
예제 #9
0
파일: web.cpp 프로젝트: AlexVangelov/ar168l
CString WebUpdateOption(CString strInput)
{
	CString strOutput, strItem, strTemp;
	CStringList strList;
	POSITION pos1, pos2;

	WebGetStringList(strInput, 7, strList);

	strOutput = _T("<OPTION");
#ifndef __GNUC__
	for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
  for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
	{
		pos2 = pos1;
		strItem = strList.GetNext(pos1);
		strTemp = strItem.Left(6);
		if (!strTemp.CompareNoCase(_T("value=")))
		{
			strItem = strItem.Right(strItem.GetLength()-6);
			strItem = RemoveQuote(strItem);
			strOutput += _T(" value=");
			strOutput += strItem;
			strList.RemoveAt(pos2);
		}
		else if (!strItem.CompareNoCase(_T("selected")))
		{
			strList.RemoveAt(pos2);
		}
	}
#ifndef __GNUC__
	for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
  for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
	{
		strOutput += _T(' ');
		strItem = strList.GetNext(pos1);
		strOutput += strItem;
	}
	strOutput += _T('>');
	return strOutput;
}
예제 #10
0
LONG CuDlgReplicationServerPageAssignment::OnLoad (WPARAM wParam, LPARAM lParam)
{
	LPCTSTR pClass = (LPCTSTR)wParam;
	ASSERT (lstrcmp (pClass, _T("CaReplicationServerDataPageAssignment")) == 0);
	CTypedPtrList<CObList, CStringList*>* pListTuple;
	CaReplicationServerDataPageAssignment* pData = (CaReplicationServerDataPageAssignment*)lParam;
	ASSERT (pData);
	if (!pData)
		return 0L;
	pListTuple = &(pData->m_listTuple);
	CStringList* pObj = NULL;
	POSITION p, pos = pListTuple->GetHeadPosition();
	try
	{
		// For each column:
		const int LAYOUT_NUMBER = 5;
		for (int i=0; i<LAYOUT_NUMBER; i++)
			m_cListCtrl.SetColumnWidth(i, pData->m_cxHeader.GetAt(i));

		int nCount;
		while (pos != NULL)
		{
			pObj = pListTuple->GetNext (pos);
			ASSERT (pObj);
			ASSERT (pObj->GetCount() == 5);
			nCount = m_cListCtrl.GetItemCount();
			p = pObj->GetHeadPosition();
			m_cListCtrl.InsertItem  (nCount,    (LPCTSTR)pObj->GetNext(p));
			m_cListCtrl.SetItemText (nCount, 1, (LPCTSTR)pObj->GetNext(p));
			m_cListCtrl.SetItemText (nCount, 2, (LPCTSTR)pObj->GetNext(p));
			m_cListCtrl.SetItemText (nCount, 3, (LPCTSTR)pObj->GetNext(p));
			m_cListCtrl.SetItemText (nCount, 4, (LPCTSTR)pObj->GetNext(p));
		}
		m_cListCtrl.SetScrollPos (SB_HORZ, pData->m_scrollPos.cx);
		m_cListCtrl.SetScrollPos (SB_VERT, pData->m_scrollPos.cy);
	}
	catch (CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
	}
	return 0L;
}
예제 #11
0
BOOL RegistryKey::WriteFile()
{
	if (mFileName == "") return FALSE;

    POSITION pos;
    CString key;
    CString val;
	CString data;
	AutoBuf buf(1000);	
	CStringList slist;
    for( pos = mKeyValPairs->GetStartPosition(); pos != NULL; ) {
        mKeyValPairs->GetNextAssoc(pos, key, val);
		String::insertSort(slist, key);
	}

    for (pos = slist.GetHeadPosition(); pos != NULL; ) {
        CString key = slist.GetAt(pos);
		if (mKeyValPairs->Lookup(key, val)) {
			if (key.GetLength() && val.GetLength()) {
				sprintf(buf.p, "%s: %s\r\n", key, val);
				data += buf.p;
			}
		}
		slist.GetNext(pos);
	}


//    for( pos = mKeyValPairs->GetStartPosition(); pos != NULL; ) {
//        mKeyValPairs->GetNextAssoc(pos, key, val);
//        if (key.GetLength() && val.GetLength()) {
//            sprintf(buf.p, "%s: %s\r\n", key, val);
//			data += buf.p;
//        }
//    }
	if (data == "") return FALSE;

	CFile cfile;
	CFileException e;
	if (cfile.Open(mFileName, 
		CFile::modeCreate
		//        |CFile::modeNoTruncate
		|CFile::modeWrite
		//        |CFile::typeText
		|CFile::shareDenyNone,
		&e) == FALSE) {
		return FALSE;
	}

	cfile.Write(data, data.GetLength());
	cfile.Flush();
	cfile.Close();
	return TRUE;


}
예제 #12
0
void CPage::SetKeywords(CStringList &stringList)
{
   AFX_MANAGE_STATE(AfxGetStaticModuleState());

   m_slKeywords.RemoveAll();

   POSITION position = stringList.GetHeadPosition();
   while (position)
   {
      CString string = stringList.GetNext(position);
      m_slKeywords.AddTail(string);
   }
}
예제 #13
0
void CLibraryDictionary::ProcessPhrase(CLibraryFile& oFile, const CString& strPhrase, bool bAdd,
	bool bCanUpload)
{
	if ( strPhrase.IsEmpty() )
		return;

	CStringList oKeywords;
	CQueryHashTable::MakeKeywords( strPhrase, oKeywords );
	for ( POSITION pos = oKeywords.GetHeadPosition(); pos; )
	{
		ProcessWord( oFile, oKeywords.GetNext( pos ), bAdd, bCanUpload );
	}
}
예제 #14
0
static CString GetNthItem (CStringList& listStr, int nItem)
{
	CString strItem;
	int nStart = 0;
	POSITION pos = listStr.GetHeadPosition();
	while (pos != NULL)
	{
		strItem = listStr.GetNext (pos);
		nStart++;
		if (nStart == nItem)
			break;
	}
	return strItem;
}
예제 #15
0
void CSoundUtils::RegisterTGitSounds()
{
	// create the event labels
	CRegString eventlabelerr = CRegString(_T("AppEvents\\EventLabels\\TGit_Error\\"));
	eventlabelerr = CString(MAKEINTRESOURCE(IDS_ERR_ERROR));
	CRegString eventlabelwarn = CRegString(_T("AppEvents\\EventLabels\\TGit_Warning\\"));
	eventlabelwarn = CString(MAKEINTRESOURCE(IDS_WARN_WARNING));
	CRegString eventlabelnote = CRegString(_T("AppEvents\\EventLabels\\TGit_Notification\\"));
	eventlabelnote = CString(MAKEINTRESOURCE(IDS_WARN_NOTE));

	CRegString appscheme = CRegString(_T("AppEvents\\Schemes\\Apps\\TortoiseGitProc\\"));
	appscheme = _T("TortoiseGit");

	CString apppath = CPathUtils::GetAppDirectory();

	CRegistryKey schemenamekey = CRegistryKey(_T("AppEvents\\Schemes\\Names"));
	CStringList schemenames;
	schemenamekey.getSubKeys(schemenames);
	// if the sound scheme has been modified but not save under a different name,
	// the name of the sound scheme is ".current" and not under the names list.
	// so add the .current scheme to the list too
	schemenames.AddHead(_T(".current"));
	POSITION pos;
	for (pos = schemenames.GetHeadPosition(); pos != NULL;)
	{
		CString name = schemenames.GetNext(pos);
		if ((name.CompareNoCase(_T(".none"))!=0)&&(name.CompareNoCase(_T(".nosound"))!=0))
		{
			CString errorkey = _T("AppEvents\\Schemes\\Apps\\TortoiseGitProc\\TGit_Error\\") + name + _T("\\");
			CRegString errorkeyval = CRegString(errorkey);
			if (((CString)(errorkeyval)).IsEmpty())
			{
				errorkeyval = apppath + _T("TortoiseGit_Error.wav");
			}
			CString warnkey = _T("AppEvents\\Schemes\\Apps\\TortoiseGitProc\\TGit_Warning\\") + name + _T("\\");
			CRegString warnkeyval = CRegString(warnkey);
			if (((CString)(warnkeyval)).IsEmpty())
			{
				warnkeyval = apppath + _T("TortoiseGit_Warning.wav");
			}
			CString notificationkey = _T("AppEvents\\Schemes\\Apps\\TortoiseGitProc\\TGit_Notification\\") + name + _T("\\");
			CRegString notificationkeyval = CRegString(notificationkey);
			if (((CString)(notificationkeyval)).IsEmpty())
			{
				notificationkeyval = apppath + _T("TortoiseGit_Notification.wav");
			}
		}
	}
}
예제 #16
0
void CBibitemView::UpdateMissing()
{
	m_lstMissingFields.ResetContent();
	CStringList mf;
	if (m_TmpItem->GetMissingFields(&mf)) {
		POSITION p = mf.GetHeadPosition();
		while (p) {
			m_lstMissingFields.AddString(mf.GetNext(p));
		}
		m_lstMissingFields.EnableWindow();
	} else {
		m_lstMissingFields.AddString(AfxLoadString(IDS_STRING_NOMISSING));
		m_lstMissingFields.EnableWindow(FALSE);
	}
}
예제 #17
0
void CxDlgRoleSec::FillDatabases()
{
	if (!m_pParam->m_bCreate)
		return;
	CStringList listObj;
	m_cCheckListBoxDatabase.ResetContent();
	m_pParam->GetDatabases (listObj);

	POSITION pos = listObj.GetHeadPosition();
	while (pos != NULL)
	{
		CString strObj = listObj.GetNext (pos);
		m_cCheckListBoxDatabase.AddString (strObj);
	}
}
예제 #18
0
//ÅÅÐò½Ó¿Úº¯Êý(bAsc=TRUEÉýÐò)
void SortList(CStringList &KeyList, CStringList &ValList, BOOL bAsc)
{
	int Count = KeyList.GetCount();

	_rec *r = new _rec[Count*sizeof(_rec)];

	POSITION posKey = KeyList.FindIndex(0);
	POSITION posVal = ValList.FindIndex(0);

	int i=0;
	while(posKey && posVal)
	{
		CString Key = KeyList.GetNext(posKey);
		CString Val = ValList.GetNext(posVal);
		r[i].key = Key;
		r[i].val = Val;		
		i++;
	}

	//ÅÅÐòº¯Êý
	_Sort(r,Count,bAsc);

	KeyList.RemoveAll();
	ValList.RemoveAll();

	for(int j=0; j<Count; j++)
	{
		CString s1 = r[j].key;
		CString s2 = r[j].val;

		KeyList.AddTail(r[j].key);
		ValList.AddTail(r[j].val);
	}

	delete[] r;
}
예제 #19
0
// 把点号代入替换规则获取新的点号
int CTyBase::GetDot_From_ReplaceRule(BYTE srcNode, BYTE srcLine, BYTE srcRtu, WORD srcDot, BYTE& dstNode, BYTE& dstLine, BYTE& dstRtu, WORD& dstDot, CStringList& ruleList)
{
	int ret = -1;
	int opt;
	int vNode1,vLine1,vRtu1,vDot1;
	int vNode2,vLine2,vRtu2,vDot2;
	dstNode = srcNode;
	dstLine = srcLine;
	dstRtu = srcRtu;
	dstDot = srcDot;

	POSITION pos = ruleList.GetHeadPosition();
	CString str;
	BOOL bFind = false;
	while (pos != NULL)
	{
		str = ruleList.GetNext(pos);
		if (strlen(str) <= 0) 
			continue;

		switch (str[0])
		{
		case '2':
			{
				int count = sscanf(str,"%d,%d,%d,%d,%d,%d,%d,%d,%d",&opt,&vNode1,&vLine1,&vRtu1,&vDot1,&vNode2,&vLine2,&vRtu2,&vDot2);
				if (count == 9)
				{
					if  ((vNode1 == -1) ||(vNode1 == srcNode)) dstNode = vNode2;
					if  ((vLine1 == -1)||(vLine1 == srcLine)) dstLine = vLine2;
					if  ((vRtu1 == -1) ||(vRtu1 == srcRtu)) dstRtu = vRtu2;
					if  ((vDot1 == -1) ||(vDot1 == srcDot)) dstDot = vDot2;
					
					bFind = TRUE;

					ret = 1;
				}
			}
			break;
		default:
			break;
		}

		if (bFind)
			break;
	}
	
	return ret;
}
예제 #20
0
int CFuncList::SubtractThisList(CStringList& rList)
{
   POSITION rPos = rList.GetHeadPosition(); 
   while (rPos) {
      POSITION tPos = rPos;
      CString tName = rList.GetNext(rPos);
      POSITION fPos = GetHeadPosition();
      while (fPos) {
         if (tName == GetNext(fPos)) {
            rList.RemoveAt(tPos);
            break;
         }
      }
   }
   return (int)GetCount();
}
예제 #21
0
void CWizDlg::load_menub(POSITION ps)
{
	CStringList bList;
	bookm.DestroyMenu();
	bookm.CreatePopupMenu();        				
	Recents.GetHead()->load_menu_bm(bList);	

	UINT itm=150;		
	POSITION p=bList.GetHeadPosition();
	while (p)
		bookm.AppendMenu(MF_STRING,itm++,bList.GetNext(p));		

    bookm.AppendMenu(MF_SEPARATOR,itm++);		
    bookm.AppendMenu(MF_STRING,itm++,"Store bookmarks list in memo");
    bookm.EnableMenuItem(itm-1, ( bList.IsEmpty() )? MF_GRAYED:0);
}
예제 #22
0
// takes a list of strings and converts it to a string like "apples,peaches,pears" 
void ListToString (const CStringList & thelist, const char delim, CString & str)
  {
  int iCount = 0;

  str.Empty ();

  if (thelist.IsEmpty ())
    return;

  for (POSITION pos = thelist.GetHeadPosition (); pos; )
    {
    str += thelist.GetNext (pos);
    if (++iCount < thelist.GetCount ())
      str += delim;
    } // end of getting each one

  } // end of ListToString
예제 #23
0
void CSetProgsAdvDlg::LoadData()
{
	if (!m_ToolsValid)
	{
		m_Tools.clear();

		CStringList values;
		if (m_regToolKey.getValues(values))
		{
			for (POSITION pos = values.GetHeadPosition(); pos != NULL; )
			{
				CString ext = values.GetNext(pos);
				m_Tools[ext] = CRegString(m_regToolKey.m_path + _T("\\") + ext);
			}
		}

		m_ToolsValid = true;
	}
}
예제 #24
0
void CSetSavedDataPage::OnBnClickedLoghistclear()
{
	CRegistryKey reg(_T("Software\\TortoiseGit\\History"));
	CStringList histlist;
	reg.getSubKeys(histlist);
	for (POSITION pos = histlist.GetHeadPosition(); pos != NULL; )
	{
		CString sHist = histlist.GetNext(pos);
		if (sHist.Left(6).CompareNoCase(_T("commit"))==0)
		{
			CRegistryKey regkey(_T("Software\\TortoiseGit\\History\\")+sHist);
			regkey.removeKey();
		}
	}

	m_btnLogHistClear.EnableWindow(FALSE);
	m_tooltips.DelTool(GetDlgItem(IDC_RESIZABLEHISTCLEAR));
	m_tooltips.DelTool(GetDlgItem(IDC_RESIZABLEHISTORY));
}
예제 #25
0
파일: FGFilterLAV.cpp 프로젝트: 1ldk/mpc-hc
CString CFGFilterLAV::GetVersion(LAVFILTER_TYPE filterType /*= INVALID*/)
{
    CStringList paths;

    if (filterType == INVALID) {
        paths.AddTail(GetFilterPath(SPLITTER));
        paths.AddTail(GetFilterPath(VIDEO_DECODER));
        paths.AddTail(GetFilterPath(AUDIO_DECODER));
    } else {
        paths.AddTail(GetFilterPath(filterType));
    }

    QWORD uiVersionMin = UINT64_MAX;
    QWORD uiVersionMax = 0ui64;
    CString strVersionMin, strVersionMax;
    POSITION pos = paths.GetHeadPosition();
    while (pos) {
        CString& path = paths.GetNext(pos);

        QWORD version = FileVersionInfo::GetFileVersionNum(path);
        if (version) {
            if (version < uiVersionMin) {
                uiVersionMin = version;
                strVersionMin = FileVersionInfo::FormatVersionString(version);
            }
            if (version > uiVersionMax) {
                uiVersionMax = version;
                strVersionMax = FileVersionInfo::FormatVersionString(version);
            }
        }
    }

    CString version;
    if (uiVersionMin != UINT64_MAX) {
        version = strVersionMin;
        if (uiVersionMax != uiVersionMin) {
            version.AppendFormat(_T(" - %s"), strVersionMax);
        }
    }

    return version;
}
예제 #26
0
CString GetValueFromList(const CString strName,CStringList& strList)
{
	POSITION pos=NULL;
	pos=strList.GetHeadPosition();
	int nIndex=0;
	CString strItem=_T("");
	CString strValue=_T("");
	while(pos!=NULL)
	{
		strItem=strList.GetNext(pos);
		nIndex=strItem.Find("=");
		strValue=strItem.Left(nIndex);
		if (strValue==strName)
		{
			strValue=strItem.Right(strItem.GetLength()-nIndex-1);
			return strValue;
		}
	}
	return "";	
}
예제 #27
0
// String matching
static CString FindUniqueSubstring(const CStringList &list, const CString &value, bool initial = false, bool exact = false)
{
	// Compare lower case strings for case insensitivity
	CString substring = value;
	substring.MakeLower();
	CString match;
	for (POSITION pos = list.GetHeadPosition(); pos;)
	{
		CString entry = list.GetNext(pos);
		entry.MakeLower();
		int found = entry.Find(substring);
		if ((initial ? found == 0 : 0 <= found)
			&& (!exact || (entry.GetLength() == substring.GetLength())))
		{
			if (!match.IsEmpty()) return _T("");
			match = entry;
		}
	}
	return match;
}
예제 #28
0
//Parse script into commands and parameters
void CScriptParser::ParseScript(CString &script)
{
	//Strip off Windows return characters
	script.Remove('\r');

	//Separate script into separate lines in a list
	CStringList commandLineList;
	CScriptParser::StringSplit(commandLineList, script, CString('\n'));

	//For each command line, split out keyword and parameters
	POSITION pos;
	for(pos = commandLineList.GetHeadPosition(); pos != NULL;)
	{
		CommandLine command;

		CString line = commandLineList.GetNext(pos);
		int firstSpacePos = line.Find(' ');
		if(firstSpacePos != -1 && firstSpacePos != 0)
		{
			command.keyword = line.Left(firstSpacePos);
			command.params = line.Right(line.GetLength() - firstSpacePos - 1);
		}
		else
		{
			command.keyword = line;
			command.params.Empty();
		}
		m_CommandLines.AddTail(command);
	}

	// Debug
	/*
	for( pos = m_CommandLines.GetHeadPosition(); pos != NULL; )
	{
		CommandLine cmdLine = m_CommandLines.GetNext( pos );
		CString str = CString("keyword: \"") + cmdLine.keyword + CString("\"");
		str = str + CString("\nparams: \"") + cmdLine.params + CString("\"");
		AfxMessageBox(str);
	}
	*/
}
예제 #29
0
BOOL CWizWelcomePage::OnInitDialog()
{
    CNGWizardPage::OnInitDialog();

    VERIFY(font1.CreateFont(
        24,                        // nHeight
        0,                         // nWidth
        0,                         // nEscapement
        0,                         // nOrientation
        FW_BOLD,                 // nWeight
        FALSE,                     // bItalic
        FALSE,                     // bUnderline
        0,                         // cStrikeOut
        ANSI_CHARSET,              // nCharSet
        OUT_DEFAULT_PRECIS,        // nOutPrecision
        CLIP_DEFAULT_PRECIS,       // nClipPrecision
        ANTIALIASED_QUALITY,           // nQuality
        DEFAULT_PITCH | FF_SWISS,  // nPitchAndFamily
        _T("Arial")));                 // lpszFacename

    m_wndTitle.SetFont(&font1);

    CStringList languages;
    GetLanguageFiles(languages);

    for(POSITION pos=languages.GetHeadPosition();pos!=NULL;)
        m_wndLanguage.AddString(languages.GetNext(pos));

    if(!m_szLanguage.IsEmpty())
        m_wndLanguage.SelectString(-1, m_szLanguage);
    else
        m_wndLanguage.SetCurSel(0);

    m_wndLanguage.EnableWindow(m_bLanguage);

    TRANSLATE(*this, IDD);

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #30
0
BOOL NEWS_MONITOR(char *server, int port, CStringList &lstGroups, char *uid, char *pwd, 
				  int timeout, char *connaddr, char *custpath, char *szReturn)
{
	DWORD dwBeginTime = 0, dwEndTime = 0;

	dwBeginTime = ::GetTickCount();

	CNNTPConnection nntp(timeout);

	if(!nntp.Connect(server, uid, pwd, port))
	{
		sprintf(szReturn, "error=%s", nntp.m_strErrorMsg);
		return FALSE;
	}

	int nArticles = 0;
	POSITION pos = lstGroups.FindIndex(0);
	while(pos)
	{
		int n = 0;
		CString strGroup = lstGroups.GetNext(pos);
		if(!nntp.Group((LPCTSTR)strGroup, n))
		{
			sprintf(szReturn, "error=%s", nntp.m_strErrorMsg);
			return FALSE;
		}

		nArticles += n;
	}

	nntp.Disconnect();

	dwEndTime = ::GetTickCount();

	sprintf(szReturn, "Articles=%d$roundTripTime=%ld$", 
				nArticles, dwEndTime - dwBeginTime);

	return TRUE;
}