Example #1
0
void CDataPool::OnSaveCommand(const CString& szName, BOOL bSaveRoot/* = FALSE*/)
{
	if( szName.GetLength() == 0 ) return;
	
	CString useName = szName;

	if (bSaveRoot)
	{
		useName = GetRootWindowName(szName);
	}
	CString testXML;
	CEGUI::Window* pWindow = WindowManager::getSingleton().getWindow(useName.GetString());

	//先刷新窗口定义
	GetRightEventList()->UpdateWindowEventDefine();

	WriteXMLHead(testXML, useName);
	WriteXMLContent(testXML,pWindow,"\t");
	WriteXMLEnd(testXML, useName);

	CFileDialog dlg(FALSE, useName, useName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Layout文件(*.layout.xml)|*.layout.xml||", AfxGetMainWnd());
	if(IDOK == dlg.DoModal())
	{
		//layout文件
		CString szFileName = dlg.GetFileName();
		CString szFullPath = dlg.GetPathName();
		//CString szLayoutXml = szFullPath + "\\" + useName;
		//szLayoutXml += ".layout.xml";
		FILE* pfileb =fopen(szFullPath.GetString() , "w");
		fwrite(testXML.GetString(), testXML.GetLength(),1, pfileb);
		fclose(pfileb);

		//lua文件
		testXML = "";
		szFullPath.Replace(szFileName,"");
		szFileName.Replace(".layout.xml","");
		CString szLua = szFullPath + "\\" + szFileName;
		szLua += ".lua";
		GenLuaText(testXML,useName,szFileName);

		//判断是否存在文件,提示用户
		pfileb = fopen(szLua, "r");
		if (pfileb)
		{
			CString szMsg = "脚本文件:\n";
			szMsg += szLua;
			szMsg += "\n已经存在,是否覆盖??";
			if( MessageBox(NULL, szMsg, "提示", MB_YESNO) == IDNO )
			{
				fclose(pfileb);
				return;
			}
		}
		pfileb = fopen(szLua, "w");
		fwrite(testXML.GetString(), testXML.GetLength(),1, pfileb);
		fclose(pfileb);
	}
	

}
void CSkyBoxDlg::OnBnClickedLoadskybox()
{
	// TODO: Add your control notification handler code here
	CString str;
	NameTxt.GetWindowTextA(str);
	if(str==mT(""))
	{
		MessageBox(mT("Set SkyBox Name first"),mT("Skybox"),0);
		return;
	}
	CFileDialog fd(true,0,0,OFN_EXPLORER,mT("Image Files |*.*||"));
	if(fd.DoModal()==IDOK)
	{
		core::string path=fd.GetPathName().GetString();
		int i=path.findlast('\\');
		if(i!=-1){
			path=path.substr(0,i+1);
		}
		core::string ext=fd.GetFileExt().GetString();
		scene::SkyBoxManager::getInstance().loadSkyFromFolder(path,ext,str.GetString());
		SkyInfo ifo;
		ifo.name=str.GetString();
		ifo.path=path;
		ifo.ext=ext;
		m_skiesInfo[ifo.name]=ifo;
		RefreshList();
	}
}
Example #3
0
	CString Directory::CreateTempFileWithUniqueName (const CString & strFolderPathRoot, CString Prefix)
	{
        TCHAR pBuffer [MAX_PATH+1];
        memset (pBuffer, 0, sizeof (TCHAR) * (MAX_PATH+1));

		/*unRet = */GetTempFileName( strFolderPathRoot.GetString(), Prefix.GetString(), 0,pBuffer);

		return CString(pBuffer);
	}
Example #4
0
void* CDelBOM::RunThread(void *arg)
{
	CDelBOM* pDel = (CDelBOM*) arg;

	ACL_SCAN_DIR *scan = acl_scan_dir_open(pDel->m_sPath.GetString(), 1);
	if (scan == NULL)
	{
		CString msg;
		msg.Format("Open path %s error", pDel->m_sPath.GetString());
		MessageBox(NULL, msg, "Open path", 0);
		::PostMessage(pDel->m_hWnd, pDel->m_nMsgDeleted, 0, 0);
		return NULL;
	}

	while (true)
	{
		const char* pFile = acl_scan_dir_next_file(scan);
		if (pFile == NULL)
			break;

		// 过滤掉非纯文本的文件
		if (acl_strrncasecmp(pFile, ".c", 2) &&
			acl_strrncasecmp(pFile, ".cpp", 4) &&
			acl_strrncasecmp(pFile, ".cxx", 4) &&
			acl_strrncasecmp(pFile, ".h", 2) &&
			acl_strrncasecmp(pFile, ".hpp", 4) &&
			acl_strrncasecmp(pFile, ".hxx", 4) &&
			acl_strrncasecmp(pFile, ".java", 5) &&
			acl_strrncasecmp(pFile, ".txt", 4) &&
			acl_strrncasecmp(pFile, ".php", 4) &&
			acl_strrncasecmp(pFile, ".html", 5) &&
			acl_strrncasecmp(pFile, ".js", 3) &&
			acl_strrncasecmp(pFile, ".css", 4) &&
			acl_strrncasecmp(pFile, ".d", 2) &&
			acl_strrncasecmp(pFile, ".py", 3) &&
			acl_strrncasecmp(pFile, ".perl", 5) &&
			acl_strrncasecmp(pFile, ".cs", 3) &&
			acl_strrncasecmp(pFile, ".as", 3))
		{
			acl_msg_info(">>skip file: %s", pFile);
			continue;
		}
		CString filePath = acl_scan_dir_path(scan);
		filePath += "\\";
		filePath += pFile;
		if (pDel->DeleteBOM(filePath) == true)
			acl_msg_info(">>modify file %s", filePath.GetString());
		else
			acl_msg_info(">>skip file %s", filePath.GetString());
	}

	acl_scan_dir_close(scan);
	::PostMessage(pDel->m_hWnd, pDel->m_nMsgDeleted, 0, 0);
	acl_msg_info(">>scan over, msg: %d", pDel->m_nMsgDeleted);
	return NULL;
}
void CProfile::_WriteElement(CFile& file, CString strSection, CString strEntry, CString strValue)
{
    CString str;
    str.Format("<element section=\"%s\" entry=\"%s\" value=\"%s\"></element>\r\n",
               strSection.GetString(),
               strEntry.GetString(),
               strValue.GetString());

    file.Write(str, str.GetLength());
}
Example #6
0
void CImagePack::setCurInfo( const tagHistoryInfo& _info )
{
	GetDlgItem(IDC_FILEHOSTORY)->SetWindowText(_info.strFilePath);
	GetDlgItem(IDC_FILEEDIT)->SetWindowText(_info.strFileName);
	m_listType.SetCurSel(_info.nDataType);
	CString strTemp;
	strTemp.Format("%d",_info.nMaxWidth);
	m_MaxWEdit.SetWindowText(strTemp.GetString());
	strTemp.Format("%d",_info.nMaxHeight);
	m_MaxHEdit.SetWindowText(strTemp.GetString());
	strTemp.Format("%d",_info.nSpace);
	m_SpaceEdit.SetWindowText(strTemp.GetString());
}
void CDlgSAPrefs2::OnOK()
{
	CString			text = "";

	m_FrameDelay.GetWindowText(text);
	if (strtoul(text.GetString(), 0, 10)>MAX_FRAMEDELAY)
	{
		OH_MessageBox_Interactive("Invalid Frame Delay", "ERROR", MB_OK);
		return;
	}
	preferences.SetValue(k_prefs_frame_delay, strtoul(text.GetString(), 0, 10));

	m_ClickDelay.GetWindowText(text);
	if (strtoul(text.GetString(), 0, 10)>MAX_CLICKDELAY)
	{
		OH_MessageBox_Error_Warning("Invalid Click Delay");
		return;
	}
	preferences.SetValue(k_prefs_click_delay, strtoul(text.GetString(), 0, 10));

	m_SwagDelay1.GetWindowText(text);
	if (strtoul(text.GetString(), 0, 10)>MAX_SWAGDELAY1)
	{
		OH_MessageBox_Interactive("Invalid Betsize Delay (Select to Delete)", "ERROR", MB_OK);
		return;
	}
	preferences.SetValue(k_prefs_swag_delay_1, strtoul(text.GetString(), 0, 10));

	m_SwagDelay2.GetWindowText(text);
	if (strtoul(text.GetString(), 0, 10)>MAX_SWAGDELAY2)
	{
		OH_MessageBox_Interactive("Invalid Betsize Delay (Delete to Entry)", "ERROR", MB_OK);
		return;
	}
	preferences.SetValue(k_prefs_swag_delay_2, strtoul(text.GetString(), 0, 10));

	m_SwagDelay3.GetWindowText(text);
	if (strtoul(text.GetString(), 0, 10)>MAX_SWAGDELAY3) 
	{
		OH_MessageBox_Interactive("Invalid Betsize Delay (Entry to Confirm)", "ERROR", MB_OK);
		return;
	}
	preferences.SetValue(k_prefs_swag_delay_3, strtoul(text.GetString(), 0, 10));

	preferences.SetValue(k_prefs_engage_autoplayer, m_Autoplayer_Upon_Connection.GetCheck()==BST_CHECKED ? true : false);
	preferences.SetValue(k_prefs_restore_position_and_focus, m_Restore_Position_And_Focus.GetCheck()==BST_CHECKED ? true : false);
	preferences.SetValue(k_prefs_use_auto_replay, m_Use_Auto_Replay.GetCheck()==BST_CHECKED ? true : false);
	preferences.SetValue(k_prefs_swag_use_comma, m_SwagUseComma.GetCheck()==BST_CHECKED ? true : false);
	
	CSAPrefsSubDlg::OnOK();
}
Example #8
0
void CIntuitiveEditorDoc::OnFileSaveAs()
{
	if (GetProjectMgr()->isProjectLoaded() == false)
		return;

	std::vector<std::string> vecFilterExtensions;
	std::stringstream sFilters;
	std::string projectDir = GetProjectMgr()->getProjectDir();
	std::string projectName = GetProjectMgr()->getProjectName();

  // TODO: Get save systems
	//for (std::map<std::string, CSaveSystem*>::iterator it = CSaveSystemManager::getInstance()->begin();
			 //it != CSaveSystemManager::getInstance()->end();
			 //it++)
	//{
		//sFilters << (*it).second->getName().c_str() << " (*." << (*it).second->getExt().c_str() << ")|*." << (*it).second->getExt().c_str() << "|";
		//vecFilterExtensions.push_back((*it).second->getExt());
	//}

	CFileDialog FileDlg(FALSE, NULL, projectName.c_str(),
											OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, sFilters.str().c_str());
	FileDlg.m_ofn.lpstrInitialDir = projectDir.c_str();

	if(FileDlg.DoModal() == IDOK )
	{
		std::string sProjectFile = "";
		std::string sProjectFilePath = "";
		std::string sExt = vecFilterExtensions[FileDlg.m_ofn.nFilterIndex - 1];

		CString str = FileDlg.GetFileTitle();

		{
			CT2CA converter(str.GetString());
			sProjectFile = converter;
			sProjectFile += '.' + sExt;
		}

		str = FileDlg.GetPathName();

		{
			CT2CA converter(str.GetString());
			sProjectFilePath = converter;
			sProjectFilePath += '.' + sExt;
		}

		GetProjectMgr()->saveProject(sProjectFile, sProjectFilePath, sExt);
	}

	else
		return;
}
Example #9
0
bool EndlessISO::UnpackSquashFS(const CString & image, const CString & destination, UnpackProgressCallback callback, HANDLE cancelEvent)
{
    FUNCTION_ENTER;

    // TODO: assumes the squashfs contains exactly one file with the correct name
    const CString destinationDir = CSTRING_GET_PATH(destination, L'\\');

    auto extractor = SevenZip::SevenZipExtractor(pImpl->sevenZip, image.GetString());
    extractor.SetCompressionFormat(SevenZip::CompressionFormat::SquashFS);
    auto cb = ProgressCallback(callback, cancelEvent);
    auto ret = extractor.ExtractArchive(destinationDir.GetString(), &cb);
    IFFALSE_RETURN_VALUE(ret, "ExtractArchive returned false", false);

    return true;
}
Example #10
0
VOID CDataPool::WriteWindowPropertyToText(CString & text,CEGUI::Window* pWindow, const CString& gap)
{
	if(pWindow)
	{
		////如果模板不再,那么现创建这种类型的窗口模板
		//CString szTemplateName = pWindow->getType().c_str();
		//szTemplateName += "_Template";
		//if (WindowManager::getSingleton().getWindow(szTemplateName.c_str()) == NULL)
		//{
		//	WindowManager::getSingleton().createWindow(pWindow->getType(), szTemplateName);
		//}
		std::ofstream file ;
		file.open ("C:\\TempWindow.bin", std::ios::out) ;
		if (!file.is_open ()) 
		{
			return ;
		}
		pWindow->writePropertiesXML(file,gap.GetString());
		file.close();
		FILE* pfile = fopen("C:\\TempWindow.bin", "rb");
		fseek(pfile, 0L, SEEK_END);
		size_t fsize = ftell(pfile);
		fseek(pfile, 0L, SEEK_SET);
		char* szRead = new char[fsize + 1];
		if (pfile)
		{
			size_t pos = fread(szRead,fsize+1,1,pfile);
			szRead[fsize] = 0;
			text += szRead;
			fclose(pfile);
		}
		delete[] szRead;
	}
}
Example #11
0
	void loadReference()
	{
		m_lang.clear();
		CString fileName = ReferenceFileName();
		//  Check if this user has customized the colors
		boost::filesystem::path binFolder;
		GetProgramFolder(binFolder);
		boost::filesystem::path file = binFolder / stringToPath(fileName.GetString());
		if (!clib::filesystem::exists(file))
		{
			ATLASSERT(!(_T("Unable to locate ") + fileName));
		}
		restore(m_lang, file.string().c_str());
		std::sort(m_lang.begin(), m_lang.end());
		int row = 0;
		for(CLanguageReferenceVector::iterator itr = m_lang.begin(); itr != m_lang.end(); ++itr)
		{
			std::_tstring name = itr->GetName();
			std::transform(name.begin(), name.end(), name.begin(), ::tolower);
			m_langNameIndex[name].m_cat = itr->GetCategoryID();
			m_langNameIndex[name].m_row = row;
			m_langCatNameIndex[itr->GetCategoryID()][name].m_cat = itr->GetCategoryID();
			m_langCatNameIndex[itr->GetCategoryID()][name].m_row = row;
			++row;
		}
	}
// CDlgSAPrefs8 message handlers
BOOL CDlgSAPrefs8::OnInitDialog() {
	CString text = "";
  CSAPrefsSubDlg::OnInitDialog();
  // Starting with 3 to avoid confusion with old values (on off)
  // and defaulting to off
	switch (preferences.replay_record()) {
    case kShootReplyFramesOnMyTurn:
      m_RecordMyTurn.SetCheck(BST_CHECKED);
      break;
     case kShootReplyFramesOnEveryChangeWhilePlaying:
      m_RecordEveryChangePlaying.SetCheck(BST_CHECKED);
      break;
    case kShootReplyFramesOnEveryChange:
      m_RecordEveryChange.SetCheck(BST_CHECKED);
      break;
    default:
      // kShootReplyFramesNever
      m_RecordNever.SetCheck(BST_CHECKED);
      break;
  }
	text.Format("%d", preferences.replay_max_frames());
	m_MaxFrames.SetWindowText(text.GetString());
	m_MaxFramesSpin.SetRange(1, 1000);
	m_MaxFramesSpin.SetPos(preferences.replay_max_frames());
	m_MaxFramesSpin.SetBuddy(&m_MaxFrames);
  return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
void CManageAccountDlg::OnBnClickedUseprivilegecheck()
{
	_ConnectionPtr m_pConTmp;
	m_pConTmp.CreateInstance("ADODB.Connection");
	m_pConTmp->Open(g_strDatabasefilepath.GetString(),"","",adModeUnknown);
	CString strSql;

	if(m_usePrivilegeCheck.GetCheck()==BST_UNCHECKED)
	{
		 strSql.Format(_T("update Userlogin set USE_PASSWORD = 0"));
	
	}
	else
	{
		 strSql.Format(_T("update Userlogin set USE_PASSWORD = -1"));
	
	}

	try
	{

	m_pConTmp->Execute(strSql.GetString(),NULL,adCmdText);
	if(m_pConTmp->State) 
		m_pConTmp->Close(); 
}
catch(_com_error *e)
{
	AfxMessageBox(e->ErrorMessage());

}
}
Example #14
0
VOID CDataPool::OnDeleteWindow(const CString& name)
{
	//清空窗口对应的数据
	Window* pWin = WindowManager::getSingleton().getWindow(name.GetString());
	DeleteWindowEvent(pWin);
	g_leftTreeWindow->DeleteItemFromName(name);
}
void CGraphicView::saveLabelInfo(int nItem)
{
    if(g_GraphicModelevel==1)
        return;
    if(nItem<0)
        return;
    if(nItem>=(int)m_RelayLabelLst.size())
        return;
    m_pCon.CreateInstance(_T("ADODB.Connection"));
    m_pCon->Open(g_strDatabasefilepath.GetString(),_T(""),_T(""),adModeUnknown);

    Label_information label;
    label=m_RelayLabelLst.at(nItem);
    CRect rcItem;
    label.plabelCtrl->GetWindowRect(&rcItem);
    ScreenToClient(&rcItem);
    int nLeft,nTop;
    nLeft=rcItem.left-XStart;
    nTop=rcItem.top-YStart;
    try
    {


        CString strSql;
        strSql.Format(_T("update Screen_Label set Point_X=%i,Point_Y=%i where Serial_Num =%i and Tstat_id=%i and  Cstatic_id=%i"),
                      nLeft,nTop,label.nSerialNum,label.tstat_id,label.cstatic_id);
        m_pCon->Execute(strSql.GetString(),NULL,adCmdText);
    }
    catch(_com_error *e)
    {
        AfxMessageBox(e->ErrorMessage());
    }
    if(m_pCon->State)
        m_pCon->Close();
}
Example #16
0
BOOL CAddonUpdaterApp::InitInstance()
{
	// InitCommonControlsEx() is required on Windows XP if an application
	// manifest specifies use of ComCtl32.dll version 6 or later to enable
	// visual styles.  Otherwise, any window creation will fail.
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// Set this to include all the common control classes you want to use
	// in your application.
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();


	AfxEnableControlContainer();

	// Create the shell manager, in case the dialog contains
	// any shell tree view or shell list view controls.
	CShellManager *pShellManager = new CShellManager;

	if (!GetWOWPath().IsEmpty())
	{
		CAddonUpdaterDlg dlg;
		m_pMainWnd = &dlg;
		INT_PTR nResponse = dlg.DoModal();
		if (nResponse == IDOK)
		{
			// TODO: Place code here to handle when the dialog is
			//  dismissed with OK
		}
		else if (nResponse == IDCANCEL)
		{
			// TODO: Place code here to handle when the dialog is
			//  dismissed with Cancel
		}
	}
	else
	{
		MessageBox(NULL, _T("δÕÒµ½Ä§ÊÞÊÀ½ç°²×°Â·¾¶¡£"), _T("´íÎó"), MB_ICONEXCLAMATION | MB_OK);
	}

	// Delete the shell manager created above.
	if (pShellManager != NULL)
	{
		delete pShellManager;
	}

	SHFILEOPSTRUCT op = {0};
	op.wFunc = FO_DELETE;
	CString strPath = theApp.GetTempPath();
	strPath.AppendChar(_T('\0'));
	op.pFrom = strPath.GetString();
	op.fFlags = FOF_NOCONFIRMATION;
	SHFileOperation(&op);

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
Example #17
0
void GcEditorTextureListBox::SetTextureInfo(CString strFilePath, float fSartTime, float fEndTime)
{
    TextureListInfo::TextureInfo* info = new TextureListInfo::TextureInfo();
    info->SetTextureName( strFilePath.GetString() );
    info->SetStartTime( fSartTime );
    info->SetEndTime( fEndTime );
    GetTextureInfos()->Add( info );
}
void DrawTimeFrequencyGrid::DrawLabel( CString label, float xCoord, float yCoord )
{
	pRenderTarget->SetAntialiasMode( D2D1_ANTIALIAS_MODE_PER_PRIMITIVE );
	float xLength = 5.0f * fontSize;
//	float vCenter = 1.0f + fontSize/2.0f;

	// Draw background shape
	D2D1_ROUNDED_RECT roundedRect = D2D1::RoundedRect(
            D2D1::RectF(xCoord+5.0f, yCoord+4.0f, xCoord + xLength, yCoord + 17.0f), 3.0f, 3.0f );	
	pRenderTarget->FillRoundedRectangle(roundedRect, pTextBackgroundBrush);
    	pRenderTarget->DrawRoundedRectangle(roundedRect, pTextBackgroundBrush, 1.f);

	int len = wcslen( label.GetString() );
	pRenderTarget->DrawTextW( label.GetString(), (UINT32) len, pTextFormat, 
				D2D1::RectF(xCoord+5.0f, yCoord, xCoord + xLength, yCoord + 20.0f), pLabelBrush );

}
Example #19
0
void CDataPool::GenLuaText(CString& textLua,const CString& szWinName,const CString& szSystemName)
{
	//获取基本函数
	GetRightEventList()->GenSystemFunction(textLua, szSystemName);
	//找到这个窗口,然后遍历所有子窗口函数
	Window* pWindow = WindowManager::getSingleton().getWindow(szWinName.GetString());
	WriteWindowLuaFunction(textLua, pWindow);
}
Example #20
0
void CDataPool::OnReloadScript()
{
	//加载全局函数
	char szExePath[MAX_PATH];
	GetModuleFileName(NULL, szExePath,MAX_PATH);
	std::string ss = szExePath;
	CString szScriptPath = ss.substr(0,ss.find_last_of('\\')).c_str();
	szScriptPath += "/editor_global.lua";
	m_scriptModule.DoFile(szScriptPath.GetString());
}
Example #21
0
void CWndImageList::UpdateImageList()
{
	SQRWnd* pEditWnd = m_pWndGroup->GetEditWnd();
	if( pEditWnd == NULL )
		return;

	IMAGE_PARAM IP ( SM_BS_BK, m_nImageType );	
	WND_IMAGE_LIST* pImageList = pEditWnd->GetWndBkImage( IP );
	if( pImageList == NULL )
		return;

	m_pWndGroup->Check();
	int n1 = GetItemCount();
	int n2 = pImageList->GetImageCount();
	for( int i = 0; i < GetItemCount(); i++ )
	{
		IMAGE& Image = pImageList->GetImage( i );
		CString szImageName = Image.pTexture ? gbk_to_utf16(Image.pTexture->GetName()).c_str() : L"";
		CString itemText = GetItemText(i, 0);
		if(itemText == szImageName )
			continue;
		Image.dwColor = 0xffffffff;
		SafeRelease( Image.pTexture );
		HRESULT hr = pEditWnd->GetGraphic()->CreateTexture( L"", utf16_to_gbk(itemText.GetString() ).c_str(), &Image.pTexture);
		if (FAILED(hr))
			OutputDebugString(itemText);

		if ( Image.pTexture )
		{
			Image.texName = utf16_to_gbk(itemText.GetString() ).c_str();
		}
		// 对于 tree 和 list 需要即时更新
		if ( pEditWnd->GetClassName() == string( "CListCtrl" ))
		{
			SQRListCtrl* pListCtrl = (SQRListCtrl*)pEditWnd;
			pListCtrl->UpdateItemImage();
		}
	}
	IMAGE& Image = pImageList->GetImage( m_nEditItem );
	m_ImageProp->ResetImageProp( &Image, m_pWndGroup );
	m_pWndGroup->ReCheck();
}
Example #22
0
void QueryBookDlg::OnQuery()
{
	m_cListCtrl.DeleteAllItems();
	vector<Book> books;
	if (!m_dbUtil.isOpen)
	{
		m_dbUtil.OpenDB();
	}
	string strBookName;
	int nIndex = m_cComBox.GetCurSel();
	//wchar_t szName[64] = { 0 };
	CString strName;
	m_cEditName.GetWindowText(strName);
	//wsprintf(szName, _T("%s"), strName);
	wstring wstrName = strName.GetString();
	strBookName = m_stringConvert.ws2s(wstrName);
	//根据书名或者作者进行查询
	if (nIndex == 0 || nIndex == -1)
	{
		m_dbUtil.SelectBookByName(strBookName, books);
	}
	else if (nIndex == 1)
	{
		m_dbUtil.SelectBookByAuthor(strBookName, books);
	}
	vector<Book>::iterator vecIter;
	int i = 0, j = 0;
	int number = m_cListCtrl.GetItemCount();
	wstring wstrTemp;
	for (vecIter = books.begin(); vecIter != books.end(); vecIter++)
	{
		wchar_t chId[4] = { 0 };
		wsprintf(chId, _T("%d"), i + 1);
		m_cListCtrl.InsertItem(i, chId);
		m_cListCtrl.SetItemText(i, j++, chId);
		wstrTemp = m_stringConvert.s2ws(vecIter->GetBookName());
		m_cListCtrl.SetItemText(i, j++, wstrTemp.c_str());
		wstrTemp = m_stringConvert.s2ws(vecIter->GetAuthor());
		m_cListCtrl.SetItemText(i, j++, wstrTemp.c_str());
		wstrTemp = m_stringConvert.s2ws(vecIter->GetISBN());
		m_cListCtrl.SetItemText(i, j++, wstrTemp.c_str());
		wstrTemp = m_stringConvert.s2ws(vecIter->GetPub());
		m_cListCtrl.SetItemText(i, j++, wstrTemp.c_str());
		wchar_t wstrTotal[4] = { 0 };
		wsprintf(wstrTotal, _T("%d"), vecIter->GetTotalNum());
		m_cListCtrl.SetItemText(i, j++, wstrTotal);
		wchar_t wstrLeft[4] = { 0 };
		wsprintf(wstrLeft, _T("%d"), vecIter->GetLeftNum());
		m_cListCtrl.SetItemText(i, j++, wstrLeft);
		i ++;
		j = 0;
	}

}
Example #23
0
void CChatSelector::SendMessagePacket(CChatItem &ci, const CString &strMessage)
{
	uint16	uMessageLen = strMessage.GetLength();
	Packet	*pPacket = new Packet(OP_MESSAGE, uMessageLen + 2);

	memcpy2(pPacket->m_pcBuffer, &uMessageLen, 2);							//<messagelen 2>
	memcpy2(pPacket->m_pcBuffer + 2, strMessage.GetString(), uMessageLen);	//(<messagechar 1>)*messagelen
	g_App.m_pUploadQueue->AddUpDataOverheadOther(pPacket->m_dwSize);
#ifdef OLD_SOCKETS_ENABLED
	ci.m_pClient->m_pRequestSocket->SendPacket(pPacket, true, true);
#endif //OLD_SOCKETS_ENABLED
}
Example #24
0
CString CGenethonDoc::handlePyError() {
    CString retVal = CString();

    PyObject* excType, *excValue, *excTraceback;
    PyErr_Fetch(&excType, &excValue, &excTraceback);
    PyErr_NormalizeException(&excType, &excValue, &excTraceback);

    CString callBacks = CString();
    CString work = CString();
    PyTracebackObject* ptraceback = (PyTracebackObject*)excTraceback;
    if (ptraceback != NULL) {
        work.Format("File: %s\nLine no: %d\n", PyUnicode_AsUTF8(PyObject_Str(((PyTracebackObject*)ptraceback)->tb_frame->f_code->co_filename)), ((PyTracebackObject*)ptraceback)->tb_lineno);
        callBacks.Append(work.GetString());
        // Advance to the last frame (python puts the most-recent call at the end)
        while (ptraceback->tb_next != NULL) {
            ptraceback = ptraceback->tb_next;
            work.Format("File: %s\nLine no: %d\n", PyUnicode_AsUTF8(PyObject_Str(((PyTracebackObject*)ptraceback)->tb_frame->f_code->co_filename)), ((PyTracebackObject*)ptraceback)->tb_lineno);
            callBacks.Append(work.GetString());
        }
        // At this point I have access to the line number via traceback->tb_lineno,
        // but where do I get the file name from?
        int line = ptraceback->tb_lineno;
    }
    retVal.Format("Error type: %s\n%s\nError: %s",
                  PyUnicode_AsUTF8(PyObject_Str(excType)),
                  callBacks.GetString(),
                  PyUnicode_AsUTF8(PyObject_Str(excValue))
                 );
    // Now you have two options, restoring the exception or disposing it.
    PyErr_Restore(excType, excValue, excTraceback);

    //---->

    Py_XDECREF(excType);
    Py_XDECREF(excValue);
    Py_XDECREF(excTraceback);

    return retVal;

}
void MusicConfigLoader::AddMusicTrack(const CString& cszId, unsigned int uiLen, const CString& cszFilename,
                                      std::set<CString>& setTags)
{
   ATLTRACE(_T("music track: id=%s, len=%u, file=%s, %u tags\n"),
      cszId.GetString(), uiLen, cszFilename.GetString(), setTags.size());

   // add music info
   MusicDirector::MusicInfo musicInfo;
   musicInfo.m_cszFilename = cszFilename;
   musicInfo.m_dtLastPlayed = DateTime::MinValue();
   musicInfo.m_tsDuration = TimeSpan(0, 0, uiLen);

   m_mapMusicIdToInfo.insert(std::make_pair(cszId, musicInfo));

   // add id to all appropriate danger levels
   for (const CString& cszTag : setTags)
   {
      if (cszTag == c_pszDangerLevelSafe)    m_aDangerLevelMusicIds[MusicDirector::dangerLevelSafe].insert(cszId);
      if (cszTag == c_pszDangerLevelNormal)  m_aDangerLevelMusicIds[MusicDirector::dangerLevelNormal].insert(cszId);
      if (cszTag == c_pszDangerLevelDungeon) m_aDangerLevelMusicIds[MusicDirector::dangerLevelDungeon].insert(cszId);
   }
}
Example #26
0
BOOL CWellDvr34::SetIDEx(const CString& strID)
{
	char uID[20] = {0};
	BOOL bret = TRUE;
	int ulen = 0;

	string sId = WS2S(strID.GetString());

	strcpy(uID, sId.c_str());
	ulen = strID.GetLength();

	return SetValue(SET_ID, uID, ulen);
}
Example #27
0
BOOL CWellDvr34::SetMachinID(const CString& MachiID)
{
	char uMachinID[50] = {0};
	char ulen = 0;

	string sMId = WS2S(MachiID.GetString());

	strcpy(uMachinID, sMId.c_str());
	ulen = MachiID.GetLength();

	return SetValue(SET_MACHINE_ID,uMachinID,ulen);
	
}
Example #28
0
CString CDataPool::GetRootWindowName(const CString& szName)
{
	Window* pWindow = WindowManager::getSingleton().getWindow(szName.GetString());
	if (pWindow)
	{
		while (pWindow->getParent() && pWindow->getParent() != System::getSingleton().getGUISheet())
		{
			pWindow = pWindow->getParent();
		}
		return pWindow->getName().c_str();
	}
	return "";
}
Example #29
0
void CDataPool::OnPropertyChange(const CString &szName, const CString& szValue, CEGUI::Window* pSpecialWindow/* = NULL*/)
{
	try
	{
		CEGUI::Window* pWin = pSpecialWindow ? pSpecialWindow : m_pCurrentSelectWindow;
		if (pWin)
		{
			//需要转化成utf8
			if(szName == "Text" || szName == "Tooltip" || szName == "Name")
			{
				if (szName == "Name")
				{
					CString szPath = GetParentTreePath(pWin);
					if (szPath.IsEmpty())
					{
						szPath = pWin->getName().c_str();
					}
					g_leftTreeWindow->onRenameSelectWindow(szValue,pWin->getName().c_str(), szPath);
					pWin->setName((CEGUI::utf8*)mbcs_to_utf8(szValue.GetString()));
					g_pEditorView->onRenameSelectedWindow(szValue,pWin);
				}
				else
				{
					pWin->setProperty(szName.GetString(), (CEGUI::utf8*)mbcs_to_utf8(szValue.GetString()));
				}
			}
			else
			{
				pWin->setProperty(szName.GetString(), szValue.GetString());
			}
		}
	}
	catch (CEGUI::Exception& e) 
	{
		MessageBox(AfxGetMainWnd()->GetSafeHwnd(), e.what(), "改变属性出错信息", MB_OK);
	}
	
}
Example #30
0
void CMy3D_DemoView::OnInitialUpdate()
{
    CView::OnInitialUpdate();

    // Get Filename from DocumentOpen Dialog
    CString csFileName = GetDocument()->GetFileName();

    // Init the osg class

    mOSG->InitOSG(csFileName.GetString());

    // Start the thread to do OSG Rendering
    mThreadHandle = (HANDLE)_beginthread(&cOSG::Render, 0, mOSG); 
}