示例#1
0
int CSpecialApp::SplitCString1(CString strIn, CSimpleArray<CString>& vec_String, TCHAR division) 
{ 
	vec_String.RemoveAll(); 
	if (!strIn.IsEmpty()) 
	{ 
		int nCount = 0; 
		int nPos = -1; 
		nPos = strIn.Find(division); 
		CString strTemp = strIn; 
		while (nPos != -1) 
		{ 
			CString strSubString = strTemp.Left(nPos);  
			strTemp = strTemp.Right(strTemp.GetLength() - nPos-1);  
			nPos = strTemp.Find(division); 
			nCount++; 
			vec_String.Add(strSubString); 
		} 

		if (nCount == vec_String.GetSize()) 
		{ 
			CString str; 
			int nSize = strIn.ReverseFind(division); 
			str = strIn.Right(strIn.GetLength()-nSize-1); 
			vec_String.Add(str); 
		} 
	} 

	return vec_String.GetSize(); 
} 
示例#2
0
BOOL WriteRegMString( HKEY hkey, LPCTSTR pszSubKey, LPCTSTR pszValue, const CSimpleArray<CString> &ms )
{
	INT nLen = 0;
	for(int i=0; i<ms.GetSize(); ++i)
	{
		nLen += ms[i].GetLength() + 1;
	}
	nLen += (nLen==0 ? 2 : 1); 

	TCHAR *pbuf = new TCHAR[nLen];
	if( !pbuf )
		return FALSE;

	ZeroMemory(pbuf, sizeof(TCHAR)*nLen );

	TCHAR *p = pbuf;
	for(int i=0; i<ms.GetSize(); ++i)
	{
		const CString &str = ms[i];
		_tcscpy(p, str);

		p += str.GetLength() + 1;
	}

	BOOL bRet = ERROR_SUCCESS==SHSetValue(hkey, pszSubKey, pszValue, REG_MULTI_SZ, pbuf, nLen * sizeof(TCHAR));
	delete pbuf;

	return bRet;
}
示例#3
0
INT FixUpdateGarbage()
{
	CSimpleArray<CString> arrSubKeys;
	LPCTSTR szPathUpdates = _T("SOFTWARE\\Microsoft\\Updates");
	EnumRegKey(HKEY_LOCAL_MACHINE, szPathUpdates, _FixUpdateGarbage, (LPVOID)&arrSubKeys);	
	for(int i=0; i<arrSubKeys.GetSize(); ++i)
	{
		CString strSubKey;
		strSubKey.Format(_T("%s\\%s"), szPathUpdates, arrSubKeys[i]);
		RegDeleteKey(HKEY_LOCAL_MACHINE, strSubKey);
	}
	return arrSubKeys.GetSize();
}
示例#4
0
int CLDEditTxtFile::_LoadTxtFileWithItems(CSimpleArray<CString>& arrFileItems)
{
	int nRet = -1;
	USES_CONVERSION;
	char pszFilePath[MAX_PATH] = {0};
	StringCbPrintfA(pszFilePath, sizeof(pszFilePath), "%s", W2A(m_strTxtFile));
	FILE* pFile = NULL;
	//open file
	fopen_s(&pFile, const_cast<char*>(pszFilePath), "r");
	if (NULL == pFile)
		return nRet;

	char pszFileValue[1024] = {0};
	ZeroMemory(pszFileValue, sizeof(pszFileValue));
	arrFileItems.RemoveAll();

	while(NULL != fgets(pszFileValue, sizeof(pszFileValue), pFile))
	{
		if (NULL != m_pStop && TRUE == *m_pStop)
			return nRet;

		arrFileItems.Add(CString(pszFileValue));
		ZeroMemory(pszFileValue, sizeof(pszFileValue));
	}

	if (NULL != pFile)
		fclose(pFile);
	pFile = NULL;
	nRet = arrFileItems.GetSize();

	return nRet;
}
void CBkIgnoreDlg::NeedUpdateSoft(CSoftListItemData* datalist)
{
	if (datalist->m_bIgnore)
		datalist->m_bIgnore = FALSE;
	CSimpleArray<CSoftListItemData*> arrData;
	for (int i = 0; i < m_arrData.GetSize(); i++)
	{
		CSoftListItemData *pData = m_arrData[i];
		if (pData && pData->m_bIgnore)
			arrData.Add(pData);
	}
	m_arrData.RemoveAll();
	for (int i = 0; i < arrData.GetSize(); i++)
	{
		CSoftListItemData *pData = arrData[i];
		if (pData && pData->m_bIgnore)
			m_arrData.Add(pData);
	}

	int nIgnoreCount = m_arrData.GetSize();
	this->FormatRichText(
		IDC_CTL_UPDATE_IGNORE_TITLE, 
		BkString::Get(IDS_DLG_UPDATE_IGNORE_COUNT_FORMAT), 
		nIgnoreCount );

	m_necessList->SetItemCount(nIgnoreCount);
	if (nIgnoreCount == 0)
	{
		this->SetItemVisible(IDC_CTL_UPDATE_IGNORE_WND,FALSE);
		this->SetItemVisible(IDC_CTL_UPDATE_IGNORE_NONE,TRUE);

		this->EnableItem( IDC_UPDATE_CHECK_IGNORE_ALL, FALSE);
		this->EnableItem( IDC_CTL_UPDATE_IGNORE_SEL, FALSE);
	}
}
示例#6
0
//------------------------------------------------------------------------
//! Retrieves a font setting value for the view
//!
//! @param strName Name of setting
//! @return Value of the setting
//------------------------------------------------------------------------
LOGFONT CViewConfigSection::GetLogFontSetting(const CString& strName) const
{
	LOGFONT font = { 0 };

	CSimpleArray<CString> strArray;
	GetArraySetting(strName, strArray);
	if (strArray.GetSize() != 13)
		return font;

#if __STDC_WANT_SECURE_LIB__
	_tcscpy_s(font.lfFaceName, sizeof(font.lfFaceName) / sizeof(TCHAR), strArray[0]);
#else
	_tcsncpy(font.lfFaceName, strArray[0], sizeof(font.lfFaceName) / sizeof(TCHAR));
#endif
	font.lfHeight = _ttoi(strArray[1]);
	font.lfWidth = _ttoi(strArray[2]);
	font.lfEscapement = _ttoi(strArray[3]);
	font.lfOrientation = _ttoi(strArray[4]);
	font.lfWeight = _ttoi(strArray[5]);
	font.lfItalic = static_cast<BYTE>(_ttoi(strArray[6]));
	font.lfUnderline = static_cast<BYTE>(_ttoi(strArray[7]));
	font.lfStrikeOut = static_cast<BYTE>(_ttoi(strArray[8]));
	font.lfCharSet = static_cast<BYTE>(_ttoi(strArray[9]));
	font.lfOutPrecision = static_cast<BYTE>(_ttoi(strArray[10]));
	font.lfQuality = static_cast<BYTE>(_ttoi(strArray[11]));
	font.lfPitchAndFamily = static_cast<BYTE>(_ttoi(strArray[12]));
	return font;
}
示例#7
0
文件: MtlCom.cpp 项目: plus7/DonutG
bool MtlGetDropFileName(IDataObject *pDataObject, CSimpleArray<CString> &arrFileNames)
{
	if ( !MTL::MtlIsDataAvailable(pDataObject, CF_HDROP) )
		return false;

	FORMATETC formatetc = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
	STGMEDIUM stgmedium;
	HRESULT   hr		= pDataObject->GetData(&formatetc, &stgmedium);

	if (FAILED(hr) || stgmedium.hGlobal == NULL) {
		return false;
	}

	HDROP	  hDropInfo = (HDROP) stgmedium.hGlobal;

	UINT	  nFiles	= ::DragQueryFile(hDropInfo, (UINT) -1, NULL, 0);

	for (UINT iFile = 0; iFile < nFiles; iFile++) {
		TCHAR szFileName[_MAX_PATH];
		szFileName[0]	= 0;
		::DragQueryFile(hDropInfo, iFile, szFileName, _MAX_PATH);
		arrFileNames.Add( CString(szFileName) );
	}

	::DragFinish(hDropInfo); // required?

	::ReleaseStgMedium(&stgmedium);

	if (arrFileNames.GetSize() > 0)
		return true;
	else
		return false;
}
示例#8
0
void CEventManager::FireEvent(EventQueueItem_t *pEI)
{
    CListener *pListener;

    if (pEI->Flags & ET_BROADCAST)
    {
        int i;
        CSimpleArray<CListener *> FireOrder;

        // firing an event can cause a listener to be removed from the list
        // so we make a copy of the list, and then fire each one.

        for (i = 0 ; i < m_ListenerList.GetSize() ; i++)
            FireOrder.Add(m_ListenerList[i]);

        for (i = 0 ; i < FireOrder.GetSize() ; i++)
        {
            pListener = FireOrder[i];
            // only fire the event if it's still in the list! (if it's not then pListener is invalid..)
            if (m_ListenerList.Find(pListener) >= 0)
                pListener->OnEvent(pEI->EventID,pEI->pData);
        }
    }
    else
    {
        pEI->pFrom->OnEvent(pEI->EventID,pEI->pData);
    }
}
示例#9
0
void CDonutClipboardBar::OnUpdateClipboard()
{
	if (CMainOption::s_bIgnoreUpdateClipboard)
		return;

	clbTRACE( _T("OnUpdateClipboard\n") );
	CString 	strText = MtlGetClipboardText();
	if ( strText.IsEmpty() )
		return;

	CWebBrowser2	browser = DonutGetIWebBrowser2( GetTopLevelParent() );
	if ( !browser.IsBrowserNull() ) {
		CString strUrl = browser.GetLocationURL();

		if (strUrl == strText)
			return;
	}

	if ( _check_flag(CLPV_EX_FLUSH, m_dwExStyle) )
		m_box.ResetContent();

	CSimpleArray<CString>	arrExt;
	MtlBuildExtArray( arrExt, MtlGetWindowText(m_edit) );

	CSimpleArray<CString>	arrUrl;
	MtlBuildUrlArray(arrUrl, arrExt, strText);

	if (arrUrl.GetSize() == 0) {
		return;
	} else {
		if ( _check_flag(CLPV_EX_FLUSH, m_dwExStyle) )
			m_box.ResetContent();
	}

	for (int i = 0; i < arrUrl.GetSize(); ++i) {
		if (m_box.GetCount() == 0)
			m_box.AddString(arrUrl[i]);
		else
			m_box.InsertString(0, arrUrl[i]);
	}

	if ( _check_flag(CLPV_EX_DIRECT, m_dwExStyle) ) {
		for (int i = 0; i < arrUrl.GetSize(); ++i) {
			DonutOpenFile(m_hWnd, arrUrl[i], 0);
		}
	}
}
示例#10
0
bool GetListCheckedItems(CListViewCtrlEx &listCtrl, CSimpleArray<int> &arr)
{
	for(int i=0; i<listCtrl.GetItemCount(); ++i)
	{
		if( listCtrl.GetCheckState(i) )
		{
			T_VulListItemData *pItem = (T_VulListItemData*) listCtrl.GetItemData( i );
			if(pItem)
				arr.Add( pItem->nID );
		}
	}
	if(arr.GetSize()==0)
	{
		::MessageBox(NULL, _T("没有选择内容"), NULL, MB_OK);
	}
	return arr.GetSize()>0;
}
示例#11
0
int CLDEditTxtFile::GetAllItems(CSimpleArray<CString>& arrItems)
{
	arrItems.RemoveAll();
	arrItems = m_arrFileItem;

	return arrItems.GetSize();

}
示例#12
0
bool CVulEngine::RepairAll( HWND hWnd, const CSimpleArray<int> &arrVulIds, const CSimpleArray<int> &arrSoftVulIds )
{
	m_bRepairCanceled = FALSE;
	if(m_hThreadVulRepair!=NULL)
		_SafeTerminateThread( m_hThreadVulRepair );
	
	if(arrVulIds.GetSize()==0 && arrSoftVulIds.GetSize()==0)
	{
		return false;
	}
	
	m_arrRepairVulIds.RemoveAll();
	m_arrRepairVulSoftIds.RemoveAll();
	CopySimpleArray(arrVulIds, m_arrRepairVulIds);
	CopySimpleArray(arrSoftVulIds, m_arrRepairVulSoftIds);
	m_hThreadVulRepair = (HANDLE) CreateThread(NULL, 0, ThreadFunc_Repair, (void*)hWnd, 0, NULL);
	return true;
}
示例#13
0
 /**
  * called when all item processed
  */
 virtual void OnUploadComplete(const CSimpleArray<UploadInfo> &items, const CSimpleArray<UploadResult> &result)
 {
     printf("UploaderListenerImpl::UploadComplete\n");
     for (int i = 0; i < result.GetSize(); ++i)
     {
         UploadResult res = result[i];
         printf("file: %s\n", (CStringA)res.files.image.file);
     }
 }
示例#14
0
文件: MtlCom.cpp 项目: plus7/DonutG
void MtlInitVariantFromArray(CComVariant &v, CSimpleArray<BYTE> &arrSrc)
{
	int nSize = arrSrc.GetSize();

	// Set the correct type and make sure SafeArray can hold data
	_MtlCreateOneDimArray(v, (DWORD) nSize);

	// Copy the data into the SafeArray
	_MtlCopyBinaryData(v.parray, arrSrc.GetData(), (DWORD) nSize);
}
示例#15
0
//------------------------------------------------------------------------
//! Retrieves a integer-array setting value for the view
//!
//! @param strName Name of setting
//! @param values integer-array
//! @param strDelimiter The delimiter for splitting a single string into an array
//------------------------------------------------------------------------
void CViewConfigSection::GetArraySetting(const CString& strName, CSimpleArray<int>& values, const CString& strDelimiter) const
{
	CSimpleArray<CString> strArray;
	GetArraySetting(strName, strArray, strDelimiter);
	for (int i = 0; i < strArray.GetSize(); ++i)
	{
		int value = _ttoi(strArray[i]);
		values.Add(value);
	}
}
示例#16
0
文件: MtlCom.cpp 项目: plus7/DonutG
HDROP MtlCreateDropFile(CSimpleArray<CString> &arrFiles)
{
	if (arrFiles.GetSize() == 0)
		return NULL;

	//filename\0...\0filename\0...\0filename\0\0
	int 	nLen  = 0;
	int 	i;
	for (i = 0; i < arrFiles.GetSize(); ++i) {
		nLen += arrFiles[i].GetLength();
		nLen += 1;							// for '\0' separator
	}

	nLen	+= 1;				// for the last '\0'

	HDROP	hDrop = (HDROP) ::GlobalAlloc( GHND, sizeof (DROPFILES) + nLen * sizeof (TCHAR) );
	if (hDrop == NULL)
		return NULL;

	LPDROPFILES lpDropFiles;
	lpDropFiles 		= (LPDROPFILES) ::GlobalLock(hDrop);
	lpDropFiles->pFiles = sizeof (DROPFILES);
	lpDropFiles->pt.x	= 0;
	lpDropFiles->pt.y	= 0;
	lpDropFiles->fNC	= FALSE;

  #ifdef _UNICODE
	lpDropFiles->fWide	= TRUE;
  #else
	lpDropFiles->fWide	= FALSE;
  #endif

	TCHAR * 	psz   = (TCHAR *) (lpDropFiles + 1);

	for (i = 0; i < arrFiles.GetSize(); ++i) {
		::lstrcpy(psz, arrFiles[i]);
		psz += arrFiles[i].GetLength() + 1; 	// skip a '\0' separator
	}

	::GlobalUnlock(hDrop);
	return hDrop;
}
示例#17
0
//------------------------------------------------------------------------
//! Converts a string-array setting value into a delimited string
//!
//! @param values String-array
//! @param strDelimiter The delimiter for combining the values of an array to a string
//! @return The string-array combined into a single string
//------------------------------------------------------------------------
CString CViewConfigSection::ConvertArraySetting(const CSimpleArray<CString>& values, const CString& strDelimiter) const
{
	CString strValue;
	for (int i = 0; i < values.GetSize(); ++i)
	{
		if (!strValue.IsEmpty())
			strValue += strDelimiter;
		strValue += values[i];
	}
	return strValue;
}
示例#18
0
void CVulEngine::IgnoreVuls( CSimpleArray<int> &arr, bool bIgnore )
{
	if(m_pVulScan==NULL)
	{
		m_pVulScan = CreateVulFix();
	}
	for(int i=0; i<arr.GetSize(); ++i)
	{
		m_pVulScan->Ignore(arr[i], bIgnore);
	}
	m_pVulScan->PersistIgnored();
}
示例#19
0
void COfficeInfo<T_REGISTRY>::Init(const CSimpleArray<TOfficeVersion> &arrOfficeVersions)
{
	CObjGuard guard(m_objLock);

	ReloadOfficeInfo();	
	m_OfficeLangs.clear();
	for( int i = 0; i < m_arrVIFiles.GetSize(); i ++ )
	{
		const T_OfficeFileEntry &verfile = m_arrVIFiles[i];

		for(int j=0; j<arrOfficeVersions.GetSize(); ++j)
		{
			const TOfficeVersion &ver = arrOfficeVersions[j];

			// 如果符合区间
			if( ver.type==verfile.type )
			{
				// 检测office 的大版本
				int nOfficeVer = 0;
				if(!ver.strVFrom.IsEmpty())
					nOfficeVer = _ttoi(ver.strVFrom);
				else if(!ver.strVTo.IsEmpty())
					nOfficeVer = _ttoi(ver.strVTo);
				
				if( nOfficeVer!=0 && nOfficeVer==verfile.nOfficeVer && VersionInRange(verfile.lVersion, ver.strVFrom, ver.strVTo) )
				{
					DWORD dwLang = 0;
					dwLang = verfile.dwLangID;

					_TOfficeInfo _officeinfo = {ver.type, dwLang};				
					CString strVer = ver.strName;
					strVer.MakeLower();
					m_OfficeLangs[ strVer ] = _officeinfo;
					break;
				}
			}
		}
	}

#ifdef _DEBUG
	for( _TMapOfficeversionLang::iterator it=m_OfficeLangs.begin(); it!=m_OfficeLangs.end(); ++it )
	{
		ATLTRACE( L"[Init<%d>] ver:%s, lang:%d, type:%d",
			T_REGISTRY,
			it->first,
			it->second.dwLang,
			it->second.nOfficeType );
	}
#endif

	m_Inited = TRUE;
}
示例#20
0
//------------------------------------------------------------------------
//! Retrieves a color setting value for the view
//!
//! @param strName Name of setting
//! @param colorDefval Default value to return if no value was found
//! @return Value of the setting
//------------------------------------------------------------------------
COLORREF CViewConfigSection::GetColorSetting(const CString& strName, const COLORREF colorDefval) const
{
	CSimpleArray<CString> strArray;
	GetArraySetting(strName, strArray);
	if (strArray.GetSize() != 3)
		return colorDefval;

	int r = _ttoi(strArray[0]);
	int g = _ttoi(strArray[1]);
	int b = _ttoi(strArray[2]);

	return RGB(r, g, b);
}
示例#21
0
//------------------------------------------------------------------------
//! Converts an integer-array setting value into a delimited string
//!
//! @param values Integer-array
//! @param strDelimiter The delimiter for combining the values of an array to a string
//! @return The string-array combined into a single string
//------------------------------------------------------------------------
CString CViewConfigSection::ConvertArraySetting(const CSimpleArray<int>& values, const CString& strDelimiter) const
{
	CString strValue;
	CString strArray;
	for (int i = 0; i < values.GetSize(); ++i)
	{
		if (!strArray.IsEmpty())
			strArray += strDelimiter;
		strValue.Format(_T("%d"), values[i]);
		strArray += strValue;
	}
	return strArray;
}
示例#22
0
BOOL HasIgnored(int nID,CSimpleArray<int>& arrayIgnoredID)
{
	BOOL bFind = FALSE;
	for (int i = 0; i < arrayIgnoredID.GetSize();i++)
	{	
		if (nID == arrayIgnoredID[i])
		{
			bFind = TRUE;
			goto Exit0;
		}
	}
Exit0:
	return bFind;
}
示例#23
0
//------------------------------------------------------------------------
//! Adds a profile to the official list of column configuration profiles
//!
//! @param strProfile Name of the profile
//------------------------------------------------------------------------
void CViewConfigSectionProfiles::AddProfile(const CString& strProfile)
{
	// Add the strProfile to the list if not already there
	CSimpleArray<CString> profiles;
	GetProfiles(profiles);
	for (int i = 0; i < profiles.GetSize(); ++i)
		if (profiles[i] == strProfile)
			return;

	CString noconst(strProfile);
	profiles.Add(noconst);

	WriteSetting(m_ViewName, _T("CurrentProfiles"), ConvertArraySetting(profiles, _T(", ")));
}
示例#24
0
//------------------------------------------------------------------------
//! Retrieves a rectangle setting value for the view
//!
//! @param strName Name of setting
//! @param rectDefval Default value to return if no value was found
//! @return Value of the setting
//------------------------------------------------------------------------
CRect CViewConfigSection::GetRectSetting(const CString& strName, const CRect& rectDefval) const
{
	CSimpleArray<CString> strArray;
	GetArraySetting(strName, strArray);
	if (strArray.GetSize() != 4)
		return rectDefval;

	CRect rect(0, 0, 0, 0);
	rect.left = _ttoi(strArray[0]);
	rect.top = _ttoi(strArray[1]);
	rect.right = _ttoi(strArray[2]);
	rect.bottom = _ttoi(strArray[3]);
	return rect;
}
示例#25
0
bool GetListCheckedItems(CListViewCtrlEx &listCtrl, CSimpleArray<int> &arr, BOOL *pIsRadio)
{
	if(pIsRadio) *pIsRadio = FALSE;
	for(int i=0; i<listCtrl.GetItemCount(); ++i)
	{
		if( listCtrl.GetCheckState(i, pIsRadio) )
		{
			T_VulListItemData *pItem = (T_VulListItemData*) listCtrl.GetItemData( i );
			if(pItem)
				arr.Add( pItem->nID );
		}
	}
	return arr.GetSize()>0;
}
示例#26
0
int CLDEditTxtFile::WriteItemsToFile(CString strFile, CSimpleArray<CString> arrItems)
{
	int nRet = -1;
	USES_CONVERSION;

	CBkProcPrivilege privilege;

	if (!privilege.EnableShutdown())
		return -1;

	char pszFilePath[MAX_PATH] = {0};
	CString strDesFile = strFile;
	StringCbPrintfA(pszFilePath, sizeof(pszFilePath), "%s_tmp", W2A(strFile));
	
	DWORD dwFileAttr = ::GetFileAttributes(strFile);
//	dwFileAttr &= ~FILE_ATTRIBUTE_READONLY;
	::SetFileAttributes(strFile, FILE_ATTRIBUTE_NORMAL);
	FILE* pFile = NULL;
	//open file
	fopen_s(&pFile, const_cast<char*>(pszFilePath), "w+b");
	if (NULL == pFile)
	{
		::SetFileAttributes(strFile, dwFileAttr);
		return nRet;
	}
	//write file
	int nCount = arrItems.GetSize();
	for (int i = 0; i < nCount; i++)
	{
		if (NULL != m_pStop && TRUE == *m_pStop)
			break;

		CString strValue = arrItems[i];
		if (TRUE == strValue.IsEmpty())
			continue;
		fputs(CW2A(strValue.GetBuffer(-1)), pFile);
		if (strValue.Right(1) != "\n")
			fputs("\r\n", pFile);
		strValue.ReleaseBuffer(-1);
	}
	if (NULL != pFile)
		fclose(pFile);
	pFile = NULL;

	MoveFileEx(CString(pszFilePath), strDesFile, MOVEFILE_REPLACE_EXISTING);
	::SetFileAttributes(strDesFile, dwFileAttr);
	nRet = 0;

	return nRet;
}
示例#27
0
int RepairCOMVul(const CSimpleArray<LPTVulSoft>& arr)
{
	int count = 0;
	for(int i=0; i<arr.GetSize(); ++i)
	{
		LPTVulSoft pItem = arr[i];
		int state = GetSoftItemState(pItem->state, pItem->nDisableCom);
		if(state==VUL_DISABLE_COM)
		{
			++count;
			theEngine->m_pSoftVulScan->EnableVulCOM( pItem->nID, FALSE );
		}
	}
	return count;
}
示例#28
0
void CDonutClipboardBar::OpenClipboardUrl()
{
	CString 	strText = MtlGetClipboardText();
	if ( strText.IsEmpty() )
		return;

	CSimpleArray<CString>	arrExt;
	MtlBuildExtArray( arrExt, GetExtsList() );

	CSimpleArray<CString>	arrUrl;
	MtlBuildUrlArray(arrUrl, arrExt, strText);

	for (int i = 0; i < arrUrl.GetSize(); ++i) {
		DonutOpenFile(m_hWnd, arrUrl[i], 0);
	}
}
示例#29
0
//------------------------------------------------------------------------
//! Removes a profile from the official list of column configuration profiles
//!
//! @param strProfile Name of the profile
//------------------------------------------------------------------------
void CViewConfigSectionProfiles::DeleteProfile(const CString& strProfile)
{
	if (strProfile.IsEmpty())
		return;

	// Remove any settings
	RemoveSection(JoinSectionName(m_ViewName, strProfile));

	// Remove the strProfile from the list
	CSimpleArray<CString> profiles;
	GetProfiles(profiles);
	for (int i = 0; i < profiles.GetSize(); ++i)
		if (profiles[i] == strProfile)
			profiles.RemoveAt(i);
	WriteSetting(m_ViewName, _T("CurrentProfiles"), ConvertArraySetting(profiles, _T(", ")));
}
示例#30
0
//------------------------------------------------------------------------
//! Retrieves the section name of the currently active configuration profile
//!
//! @return Current section name
//------------------------------------------------------------------------
const CString& CViewConfigSectionProfiles::GetSectionName() const
{
	if (m_CurrentSection == m_ViewName)
	{
		CString strProfile = ReadSetting(m_ViewName, _T("ActiveProfile"), _T(""));
		if (strProfile.IsEmpty())
		{
			CSimpleArray<CString> profiles;
			GetProfiles(profiles);
			if (profiles.GetSize()>0)
				strProfile = profiles[0];
		}
		m_CurrentSection = JoinSectionName(m_ViewName, strProfile);
	}
	return m_CurrentSection;
}