CVec2PropertyDescription::CVec2PropertyDescription(CSerializer* pSerializer) : super(NULL) { SetType(eRPT_Vec2F); SetMaxCount(VEC_COUNT); SetFixed(true); CPropertyDescriptionBase* pFloatProperty = CComponentProxyManager::GetInstance()->CreateProperty(eRPT_Float, NULL); SetTemplateProperty(pFloatProperty); TString InitValue = _T("0,0"); if (pSerializer != NULL) { InitValue.clear(); for (size_t i = 0; i < VEC_COUNT; ++i) { float fValue = 0; (*pSerializer) >> fValue; InitValue.append(wxString::Format(_T("%f"),fValue)); if (i != VEC_COUNT - 1) { InitValue.append(_T(",")); } CPropertyDescriptionBase* pChild = AddChild(NULL); pChild->InitializeValue(fValue); } ResetChildName(); }
bool CheckExceptionMessage(const char* msg, TString& err) { static const char* badMsg[] = { // Операция успешно завершена [cp1251] "\xce\xef\xe5\xf0\xe0\xf6\xe8\xff\x20\xf3\xf1\xef\xe5\xf8\xed\xee\x20\xe7\xe0\xe2\xe5\xf0\xf8\xe5\xed\xe0", "The operation completed successfully", "No error"}; err.clear(); if (msg == nullptr) { err = "Error message is null"; return false; } if (IsSpace(msg)) { err = "Error message is empty"; return false; } for (auto& i : badMsg) { if (strstr(msg, i) != nullptr) { err = "Invalid error message: " + TString(msg); return false; } } return true; }
CVec4PropertyDescription::CVec4PropertyDescription(CSerializer* pSerializer) : super(NULL) { SetType(eRPT_Vec4F); SetMaxCount(VEC_COUNT); CFloatPropertyDescription* pFloatProperty = down_cast<CFloatPropertyDescription*>(CComponentProxyManager::GetInstance()->CreateProperty(eRPT_Float, NULL)); pFloatProperty->SetSpinStep(0.1f); SetTemplateProperty(pFloatProperty); TString InitValue = _T("0,0,0,0"); if (pSerializer != NULL) { InitValue.clear(); for (uint32_t i = 0; i < VEC_COUNT; ++i) { float fValue = 0; (*pSerializer) >> fValue; InitValue.append(wxString::Format(_T("%f"),fValue)); if (i != VEC_COUNT - 1) { InitValue.append(_T(",")); } CPropertyDescriptionBase* pChild = InsertChild(NULL); pChild->InitializeValue(fValue); } ResetChildName(); }
//------------------------------------------------------------------------------ // bool ParamsReader::readParameters() //------------------------------------------------------------------------------ void ParamsReader::readParameters() { TRACE("ParamsReader::readParameters -->"); TString t; for (bool tokenRead = file_reader->firstLine(t); tokenRead ; tokenRead = file_reader->nextLine(t)) { token_list.push_back(t); t.clear(); } TRACE("ParamsReader::readParameters <--"); }
void DumpFile( LPTSTR lpFilename ){ BUFFER buf; if( LoadFileData(lpFilename, buf) ) { m_wndList.DeleteAllItems(); TString str; int item = 0; unsigned idx = 0; unsigned siz = buf.size(); while( idx < siz ) { int loop = 16; if( int(siz - idx) < 16 ){ loop = int(siz - idx); } str.Format(_T("%08X"), idx); m_wndList.InsertItem(item, (LPTSTR)str); for( int i=0; i<loop; i++ ){ str.Format(_T("%02X"), buf.at(idx+i)); m_wndList.SetItem(item, i+1, (LPTSTR)str); } str.clear(); for( int i=0; i<loop; i++ ){ if( ::isgraph(int(buf.at(idx+i))) ) str.AppendFormat(_T("%c"), buf.at(idx+i)); else str.AppendFormat(_T(" ")); } m_wndList.SetItem(item, 17, (LPTSTR)str); idx += 16; item += 1; } } }