Ejemplo n.º 1
0
BOOL CSkinDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    m_skinList.AddString( _T( "Default" ) );

    // TODO: Add extra initialization here
    CFileInfoArray fia;
    fia.AddDir( "skins\\", "*.bmp", FALSE );
    int size = fia.GetSize();

    for ( int i = 0; i < size; i++ )
    {
        m_skinList.AddString( fia[i].GetFileTitle() );
    }

    m_skinList.SetCurSel( 0 );
    if ( m_skinList.SelectString( -1, m_skin ) == LB_ERR )
    {
        m_skin = "Default";
    }
    m_skinCtrl.SetBmp( m_skin );

    //SetWindowPos( NULL, 0, 0, 288, 256, SWP_NOMOVE | SWP_NOZORDER );
    //m_skinCtrl.SetWindowPos( NULL, 10, 10, 0, 0, SWP_NOSIZE | SWP_NOZORDER );
    //m_skinList.SetWindowPos( NULL, 10, 31, 186, 190, SWP_NOZORDER );
    //m_ok.SetWindowPos( NULL, 204, 10, 70, 25, SWP_NOZORDER );
    //m_cancel.SetWindowPos( NULL, 204, 39, 70, 25, SWP_NOZORDER );

    return TRUE;  // return TRUE unless you set the focus to a control
}
Ejemplo n.º 2
0
CString GetNDCRulFile(CString& sNDC,CString& sMobnum,DWORD& dwMaxLen)
{
	dwMaxLen=0;
	static CFileInfoArray dir;
	static BOOL bAdded=0;
	static CMapStringToString aNDCIndex;
	if(bAdded==0){
		bAdded=1;
		dir.AddDir(GetAppFolder()+"Sms/","*.rul",TRUE,0,FALSE);
		for(int i=0;i<dir.GetSize();i++){
			CString sItemPath=dir[i].GetFilePath();
			CString sContent;
			ReadFile(sItemPath,sContent);
			sContent.Replace("\r","");
			sContent+="\n";
			CString sLen=CDataXMLSaver::GetInstringPart("SmsMaxLength=","\n",sContent);
			CString sNDCs=CDataXMLSaver::GetInstringPart("SmsNdcList=","\n",sContent);
			CString sName=CDataXMLSaver::GetInstringPart("WndTitle=","\n",sContent);
			if(sNDCs!=""){
				CStringArray aNDCs;
				ConvertToArray(sNDCs,aNDCs,',');
				for(int j=0;j<aNDCs.GetSize();j++){
					CString sOld=aNDCIndex[aNDCs[j]];
					if(sOld!=""){
						sOld+="|";
					}
					sOld+=sItemPath+"\t"+sLen+"\t"+sName;
					aNDCIndex.SetAt(aNDCs[j],sOld);
				}
			}
		}
	}
	CString sNDCData=aNDCIndex[sNDC];
	if(sNDCData.Find("|")!=-1){
		// Выбор :(
		CStringArray aOperators;
		ConvertToArray(sNDCData,aOperators,'|');
		CStringArray aOperatorsNames;
		int i=0;
		for(i=0;i<aOperators.GetSize();i++){
			CStringArray aDats;
			ConvertToArray(aOperators[i],aDats,'\t');
			if(aDats.GetSize()>=3){
				aOperatorsNames.Add(aDats[2]);
			}
		}
		i=SelectFromMenu(aOperatorsNames,0);
		if(i>=0){
			sNDCData=aOperators[i];
		}else{
			return "000";
		}
	}
	if(sNDCData!=""){
		CStringArray aDats;
		ConvertToArray(sNDCData,aDats,'\t');
		if(aDats.GetSize()>=2){
			dwMaxLen=atol(aDats[1]);
			return aDats[0];
		}
	}
	// Доверяем гуглу?
	CString sRetFile=GetAppFolder()+"Sms/default.rul";
	if(isFileExist(sRetFile)){
		CString sContent;
		ReadFile(sRetFile,sContent);
		CString sCList=CDataXMLSaver::GetInstringPart("SmsCarriersList=","\n",sContent);
		CStringArray aCarriers;
		ConvertToArray(sCList,aCarriers,',');
		int i=SelectFromMenu(aCarriers,0);
		if(i>0){
			dwMaxLen=1000;
			sMobnum=sNDC+sMobnum;
			sNDC=Format("%i",i);
			return sRetFile;
		}
		if(i<0){
			return "000";
		}
	}
	return "";
}