/* 010515 Carl Corcoran chKey is the $ or % or whatever that will be inserted. wszChars is a string that contains all the characters to be encoded. String="The" Encode(L'$', L"he"); Yields: T$68$65 */ void CCString::Encode(WCHAR chKey, PCWSTR wszChars) { CCString r = "";// Resulting string CCString t = ""; PWSTR wszSrcThis = this->wszString; PCWSTR wszSrcChars = wszChars; WCHAR ch; while(1) { ch = wszSrcThis[0]; if(ch == 0) break; wszSrcChars = wszChars; if(wcschr(wszChars, ch) != 0) { t.FormatW(L"%c%02.2x", chKey, ch); r += t; } else { r += ch; } wszSrcThis ++; } this->_CreateFromW(r); }
void _odsf(PCWSTR wszFunction, PCWSTR wszString, va_list argptr) { CCString s; CCString s2; s.FormatW(L"[ %-20.20s ] %s", wszFunction, wszString); s2.FormatvW(s, argptr); OutputDebugStringW(s2); OutputDebugStringW(L"\n"); return; }
void _odsf(PCWSTR wszFunction, PCWSTR wszString) { CCString sMsg; sMsg.FormatW(L"[ %-20.20s ] ", wszFunction); sMsg.cat(wszString); if(__g_bLogOpened == TRUE) { __g_Log._AddEntry(sMsg); } OutputDebugStringW(sMsg); OutputDebugStringW(L"\n"); }
HRESULT CMixerControl::SaveControl(XMLDoc* pDoc, XMLEl* pParent) { XMLEl* pThis = 0; HRESULT hr; CCString sValues; CCString sTemp; BOOL bFirst; if(FAILED(hr = XMLFindControl(pDoc, pParent, m_mc.dwControlID, CCString(m_mc.szName), m_Type, &pThis, TRUE))) { return hr; } // Save the values of this control. // We just go in order, separating values with a comma. bFirst = TRUE;// This will determine if we need to add a comma or not. int i = 0; switch(m_DataType) { case MIXDT_CUSTOM: { sValues.FromBinary(m_pRaw, m_mc.Metrics.cbCustomData); pThis->setAttribute(CCString(L"Values"), sValues.variant()); break; } case MIXDT_SIGNED: { MIXERCONTROLDETAILS_SIGNED* p = (MIXERCONTROLDETAILS_SIGNED*)m_pRaw; sValues.froml(p[0].lValue, 10); for(i=1;i<m_nRawItems;i++) { sValues.cat(L", "); sTemp.froml(p[i].lValue, 10); sValues.cat(sTemp); } pThis->setAttribute(CCString(L"Values"), sValues.variant()); break; } case MIXDT_UNSIGNED: { MIXERCONTROLDETAILS_UNSIGNED* p = (MIXERCONTROLDETAILS_UNSIGNED*)m_pRaw; sValues.fromul(p[0].dwValue, 10); for(i=1;i<m_nRawItems;i++) { sValues.cat(L", "); sTemp.fromul(p[i].dwValue, 10); sValues.cat(sTemp); } pThis->setAttribute(CCString(L"Values"), sValues.variant()); break; } case MIXDT_BOOLEAN: { MIXERCONTROLDETAILS_BOOLEAN* p = (MIXERCONTROLDETAILS_BOOLEAN*)m_pRaw; sValues = (p[0].fValue == TRUE) ? L"TRUE" : L"FALSE"; for(i=1;i<m_nRawItems;i++) { sTemp.FormatW(L", %s", (p[i].fValue == TRUE) ? L"TRUE" : L"FALSE"); sValues.cat(sTemp); } pThis->setAttribute(CCString(L"Values"), sValues.variant()); break; } default: { // } } SAFE_RELEASE(pThis); return hr; }