示例#1
0
// D: convert a string list of attribute values into a STRING2STRING 
//    representation
STRING2STRING StringToS2SHash(string sString, string sSeparator, 
                              string sEquals) {
    // extract the pairs
    TStringVector vsPairs = 
        PartitionString(sString, (char *)sSeparator.c_str());
    // form the hash
    STRING2STRING s2s;
    for(unsigned int i = 0; i < vsPairs.size(); i++) {
        string sAttr, sValue;
        SplitOnFirst(vsPairs[i], (char *)sEquals.c_str(), sAttr, sValue);        
        s2s.insert(STRING2STRING::value_type(Trim(sAttr), Trim(sValue)));
    }
    // finally, return the constructed hash
    return s2s;
}
示例#2
0
BOOL CPartitionType::OnInitDialog()
{
    CString str, type;
    CDialog::OnInitDialog();

    SET_TEXT(IDC_PARTITION_NAME, m_sDevice);

    CComboBox   *cbList = (CComboBox *)GetDlgItem(IDC_PARTTION_TYPE_LIST);
    for (unsigned int i=0;  i < 0x100; i++) {
        type = PartitionString(i);
        str.Format("%2.2X ", i);
        if (type.CompareNoCase("UNKNOWN")) {
            str += type;
        }
        cbList->AddString(str);
    }

    m_cPartType = m_Part->Entry->Mbr.PartitionType;
    cbList->SetCurSel((int) m_cPartType);

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
示例#3
0
void CPartitionType::OnOK()
{
    CString str;
    CComboBox *cbList = (CComboBox *)GetDlgItem(IDC_PARTTION_TYPE_LIST);
    m_cPartType = (UCHAR) cbList->GetCurSel();
    if (m_cPartType != m_Part->Entry->Mbr.PartitionType) {
        if (Ext2SetPartitionType(m_Part, m_cPartType)) {
            str.Format("Succeed to set partition type to %2.2X: %s",
                       m_cPartType, PartitionString(m_cPartType));
            AfxMessageBox(str, MB_OK | MB_ICONINFORMATION);
        } else {
            AfxMessageBox("Failed to set the partition type!",
                          MB_OK | MB_ICONWARNING);
            m_cPartType = 0;
            return;
        }
    } else {
        AfxMessageBox("Same partition type to the previous. Nothing is changed !",
                      MB_OK | MB_ICONWARNING);
    }

    CDialog::OnOK();
}