Пример #1
0
CStringVector SplitString( const CString& strString, LPCTSTR szSplitter )
{
    CStringVector arrStrings;

    int curPos = 0;
    CString resToken = strString.Tokenize(szSplitter, curPos);

    while (resToken != _T(""))
    {
        arrStrings.push_back(resToken);
        resToken = strString.Tokenize(szSplitter, curPos);
    };     

    return arrStrings;
}
Пример #2
0
int				
PokerData::SetUserAvatar(int nUserId, _String &sAvatarFileName, int nAvatarId /*= -1*/, bool bIsPrivateAvatar /*= true*/){
	if( nUserId <= 0 ) return 0;
	SetUserAvatarProc proc;
	proc.m_nAvatarId		= nAvatarId;
	proc.m_nUserId			= nUserId;
	proc.m_bIsPrivateAvatar	= bIsPrivateAvatar;

	int nRet = 0;
	if( m_pDataMan->ExecuteProc(&proc) && proc.m_nSuccess == 0 ){
		int nAvatarIdNew	= proc.m_nAvatarIdNew;
		nRet				= nAvatarIdNew;
		if( nAvatarId != nAvatarIdNew ){
			sAvatarFileName = GetAvatarFileName(nAvatarIdNew);

			// Update new avatars file name. {{
			PokerAvatar avatarNew;
			avatarNew.m_nId				= nAvatarIdNew;
			avatarNew.m_sAvatarFileName = sAvatarFileName;
			CStringVector arrDirtyFields;
			arrDirtyFields.push_back(_T("AVATAR_FILE_NAME"));
			if( m_pDataMan->SaveRecord(&avatarNew, &arrDirtyFields) ){
				/*
				PokerAvatar* pAvatarInfoNew			= new PokerAvatar();
				pAvatarInfoNew->m_nId				= proc.m_nAvatarIdNew;
				pAvatarInfoNew->m_nPrivateUserId	= nUserId;
				pAvatarInfoNew->m_sAvatarFileName	= sAvatarFileName;
				pAvatarInfoNew->m_recStatus			= 0;
				m_listAvatars.Add(pAvatarInfoNew);
				*/
				}
			// }}
			}
		else
			sAvatarFileName = GetAvatarFileName(nAvatarId);
		nAvatarIdNew = proc.m_nAvatarIdNew;
		}
	return nRet;
	}
Пример #3
0
// Получить пути к дочерним веткам реестра
CStringVector GetChildRegKeys( LPCTSTR szPath )
{
    HKEY hKey;
    if ( RegOpenKey(HKEY_LOCAL_MACHINE, szPath, &hKey) != ERROR_SUCCESS )
        return CStringVector();

    DWORD dwLargestKeySize = 0;
    if ( RegQueryInfoKey(hKey, 0,0,0,0,&dwLargestKeySize,0,0,0,0,0,0) != ERROR_SUCCESS )
        dwLargestKeySize = 1024;
    LPTSTR szKeyBuf = new TCHAR[dwLargestKeySize+2];

    CStringVector arrKeys;

    DWORD i=0;
    while ( RegEnumKey(hKey, i++, szKeyBuf, dwLargestKeySize+1) == ERROR_SUCCESS )
    {
        arrKeys.push_back(szKeyBuf);
    }

    RegCloseKey(hKey);
    delete[] szKeyBuf;

    return arrKeys;
}
Пример #4
0
// line 1 - TOOL (start of tool definition)
// line 2 - tool material (1-HSS, 2-CARBIDE, 3-COATED CAR, 4-CERAMIC, 5-BORZON, 10-UNKNOWN)
// line 3 - tool comment
// line 4 - tool name (geometry reference for backplot)
// line 5 - tool manufacturer
// line 6 - chuck designation
// line 7 - tool_no, tool_type, rad_type, dia, crad, thds, tip_angle,
//         dia_off, len_off, feed, plunge, retract, rpm, coolant, n_flutes
// line 8 - Drilling attributes (see tool_type in line 7 above)
// line 8 - cycle, peck1, peck2, peck_clr, chip_brk, dwell, shldr_angle, root_dia (tap), bore_shift
// line 8 - Milling attributes (see tool_type in line 7 above)
// line 8 - cut_able, rgh_x, rgh_z, fin_x, fin_z, tip_dia, root_dia (thd mill), thd_angle
// line 9 - pilot_dia, flute_len, oa_len, shldr_len, arbor_dia, hldr_dia, hldr_len, spindle_ccw, sfm, fpt, metric
HRESULT CDBStepNC::LoadMasterCAMTool(CString filename)
{
    CString contents = ReadAFile(filename);
    if(contents.GetLength()< 1)
        return E_INVALIDARG;
    CStringVector lines = CStringVector::Tokenize(contents, "\n");
    CStringVector columns;
    columns.push_back("toolid");
    columns.push_back("name");
    columns.push_back("tooltypeid");
    columns.push_back("materialid");
    columns.push_back("number_of_teeth");
    columns.push_back("hand_of_cut");
    columns.push_back("coolant_through_tool");
    columns.push_back("cutting_edge_length");
    columns.push_back("flute_length");
    columns.push_back("overall_length");
    columns.push_back("shoulder_length");
    columns.push_back("tip_diameter");
    columns.push_back("tool_tip_half_angle");
    columns.push_back("sfm");
    columns.push_back("fpt");
    columns.push_back("metric");

    CStringVector values;
    values.resize(16);
    for(int i=40, j=1; i< lines.size(); i+=10, j++)
    {
        CStringVector items1 = CStringVector::Tokenize(lines[i+1]," ");
        CStringVector items2 = CStringVector::Tokenize(lines[i+2]," ");
        CStringVector items3 = CStringVector::Tokenize(lines[i+3]," ");
        CStringVector items7 = CStringVector::Tokenize(lines[i+7]," ");
        CStringVector items8 = CStringVector::Tokenize(lines[i+8]," ");
        CStringVector items9 = CStringVector::Tokenize(lines[i+9]," ");
        values[0] =StrFormat("%d", j); //                  toolid
        values[1]=lines[i+3].Mid(lines[i+3].Find("-")+1).Trim();	// name
        values[2]=items7[3].Trim();	// tooltypeid
        values[3]=items2[2].Trim();	// materialid
        values[4]= items7[16].Trim();             //  number_of_teeth
        values[5]= (items9[9] ==1) ? "LEFT" : "RIGHT";    //  hand_of_cut
        values[6]= items7[15];             //  coolant_through_tool
        values[7]= items9[3];             //  cutting_edge_length
        values[8]= items9[3];             //  flute_length
        values[9]= items7[10];             //  overall_length
        values[10]= items9[5];             //  shoulder_length
        values[11]= items7[5];             //  tip_diameter
        values[12]= items7[8];             //  tool_tip_half_angle
        values[13]= items9[10];             //  sfm
        values[14]= items9[11];             //  fpt
        values[15]= items9[12].Trim();             //  metric
        InsertRow("milling_cutter", columns, values);
    }
    return S_OK;
}