void CEchoPlugin::Quit() { CIni ini; ini.SetIniFileName(m_strIni); ini.SetValue("EchoPlugin", "SysOut", m_bSysOut); ini.SetValue("EchoPlugin", "ShowEnterLeave", m_bEnterLeave); }
void CExport::PreviewDebug(CApplication* pApplication, int layoutid) { ProgressDlg.Start("Loading debug"); m_bScreensaver = false; application = pApplication; LayoutBlock.allocator = &g_allocator; eventBlock.allocator = &g_allocator; appBlock.allocator = &g_allocator; imageBlock.allocator = &g_allocator; hlslBlock.allocator = &g_allocator; menuBlock.allocator = &g_allocator; CPath path; path.SetToAppDataDirectory("Scirra"); CString OutPath = GetTempExeFile(path.GetFullPath()); CString iniPath; iniPath.Format("%sConstruct.ini", path.GetFullPath()); CIni ini; ini.SetPathName(iniPath); path.SetToCurrentDirectory(); ini.WriteString("Path", "Install", path.GetFullPath()); CString DataEXE; if (application->runtime == CApplication::rt_application) DataEXE.Format("%sData\\App_pd", path.GetFullPath()); else if (application->runtime == CApplication::rt_directx) DataEXE.Format("%sData\\DX9_pd", path.GetFullPath()); if (application->game_information.use_python) DataEXE += "s"; // script enabled DataEXE += ".exe"; // Copy runtime.exe to the target file CopyFile(DataEXE, OutPath, false); // File copied, assume 10% ProgressDlg.SetProgress(10); DoExport(true, OutPath, false, layoutid); // Execute temp ShellExecute(NULL, "open", OutPath, NULL, NULL, SW_SHOW); // Done ProgressDlg.Finish(); }
MySQL::MySQL() { config.SetSection("DB"); char * ip = config.ReadString("ip", "127.0.0.1"); uint32 port = config.ReadInteger("port", 3306); char * user = config.ReadString("user", "root"); char * pw = config.ReadString("pw", "spgame"); char * db = config.ReadString("db", "spgame"); connection = mysql_init(0); if(!mysql_real_connect(connection, ip, user, pw, db, port, 0, 0)) printf("Unable to connect to MySQL server\n"); }
void CEchoPlugin::Init() { int nLen = (int)QueryInformation(RMX_GET_CONFIG, 0, 0); if(nLen > 0){ char *buffer = new char[nLen+1]; if(QueryInformation(RMX_GET_CONFIG, nLen+1, (LPARAM)buffer) > 0){ m_strIni = buffer; CIni ini; ini.SetIniFileName(m_strIni); m_bSysOut = ini.GetValue("EchoPlugin", "SysOut", FALSE); m_bEnterLeave = ini.GetValue("EchoPlugin", "ShowEnterLeave", FALSE); } delete buffer; buffer = 0; } OnReloadCfg(); }
BOOL CVoiceSetup::OnInitDialog(void) { CDialog::OnInitDialog(); HRESULT hr = S_OK; /*hr = SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum); if(SUCCEEDED(hr)){ hr = cpEnum->GetCount(&ulCount); } while(SUCCEEDED(hr) && ulCount -- ){ cpVoiceToken.Release(); if(SUCCEEDED(hr)) hr = cpEnum->Next( 1, &cpVoiceToken, NULL ); if(SUCCEEDED(hr)) hr = cpVoice->SetVoice(cpVoiceToken); if(SUCCEEDED(hr)) hr = cpVoice->Speak( L"How are you?", SPF_DEFAULT, NULL); m_cbMaleVoice.AddString( } */ hr = SpInitTokenComboBox(GetDlgItem(IDC_MALE_VOICE)->m_hWnd, SPCAT_VOICES); if(FAILED(hr)){ AfxMessageBox("Error enumerating voices", MB_ICONSTOP); } hr = SpInitTokenComboBox(GetDlgItem(IDC_FEMALE_VOICE)->m_hWnd, SPCAT_VOICES); if(FAILED(hr)){ AfxMessageBox("Error enumerating voices", MB_ICONSTOP); } CFileFind finder; BOOL bFound = finder.FindFile(g_sSettings.GetWorkingDir() + "\\gfx\\char_*.bmp"); CString strChar, strTmp; while(finder.FindNextFile()){ strChar = finder.GetFileTitle(); strChar = strChar.Mid(5); m_cbMaleChar.AddString(strChar); m_cbFemChar.AddString(strChar); } CIni ini; ini.SetIniFileName(g_sSettings.GetIniFile()); int nCnt = ini.GetValue("Voice", "MaleCount", 0); for(int i = 0; i < nCnt; i++){ strTmp.Format("Male_%d", i); m_lbMales.AddString(ini.GetValue("Voice", strTmp, "")); } nCnt = ini.GetValue("Voice", "FemaleCount", 0); for(int i = 0; i < nCnt; i++){ strTmp.Format("Female_%d", i); m_lbFemales.AddString(ini.GetValue("Voice", strTmp, "")); } return TRUE; }
bool CActionEffectComboMgr::load(const string& fileName, bool reload) { m_bReloadMode = reload; if (!m_bReloadMode && isLoadDone()) return true; m_strCurrentFileName = chkFileNameExt(fileName, ".actcmb"); CIni kIni; if (!kIni.openActionEffect(m_strCurrentFileName)) { WriteConErr("[ERR-ActionEffectCmb] file=%s, load failed.\r\n", m_strCurrentFileName.c_str()); return false; } string strCurTitle = ""; CActionEffectCombo* pkCurActionEffectCombo = NULL; bool bNewTitle = false; // read first title string strTitle = ""; string strLine = ""; if (kIni.readTitle(strTitle, strLine)) { checkRepeat(getFullTitle(strTitle)); strCurTitle = strTitle; pkCurActionEffectCombo = addActionEffectCombo(strTitle); bNewTitle = true; } else { if (strLine.length() > 0) WriteConErr( "[ERR-ActionEffectCmb] file=%s expecting a title, line=%s\r\n", m_strCurrentFileName.c_str(), strLine.c_str()); return false; } while (strCurTitle != "" && pkCurActionEffectCombo != NULL && kIni.readLine(strLine)) { if (kIni.isTitle(strLine)) { // meaning that we have moved to the next title, string title; kIni.parseTitle(strLine, title); checkRepeat(getFullTitle(title)); strCurTitle = title; pkCurActionEffectCombo = addActionEffectCombo(title); bNewTitle = true; } else { if (bNewTitle) { parseLineFirst(pkCurActionEffectCombo, strLine, m_strCurrentFileName); bNewTitle = false; } else { parseLine(pkCurActionEffectCombo, strLine, m_strCurrentFileName); } } } //while return true; }
void CMyService::Run() { char szFilePath[_MAX_PATH] = {NULL}; ::GetModuleFileName(NULL, szFilePath, sizeof(szFilePath)); strcpy_s(szFilePath+strlen(szFilePath)-3,4,"log"); HANDLE hLogFile = CreateFile(szFilePath,GENERIC_WRITE | GENERIC_READ,FILE_SHARE_WRITE|FILE_SHARE_READ,NULL,OPEN_ALWAYS,0,NULL); strcpy_s(szFilePath+strlen(szFilePath)-3,4,"ini"); CServer server; CIni ini; ini.SetPathName(szFilePath); char szImagePath[MAX_PATH] = {NULL}; char szRecordPath[MAX_PATH] = {NULL}; char szPackagePath[MAX_PATH] = {NULL}; char szCustomLogPath[MAX_PATH] = {NULL}; char szIpAddress[256] = {NULL}; int nPort = 7788; ini.GetString(_T("PathSetting"),_T("ImagePath"),szImagePath,MAX_PATH); ini.GetString(_T("PathSetting"),_T("RecordPath"),szRecordPath,MAX_PATH); ini.GetString(_T("PathSetting"),_T("PackagePath"),szPackagePath,MAX_PATH); ini.GetString(_T("PathSetting"),_T("UserLogPath"),szCustomLogPath,MAX_PATH); if (!PathFileExistsA(szImagePath)) { SHCreateDirectoryExA(NULL,szImagePath,NULL); } if (!PathFileExistsA(szRecordPath)) { SHCreateDirectoryExA(NULL,szRecordPath,NULL); } if (!PathFileExistsA(szPackagePath)) { SHCreateDirectoryExA(NULL,szPackagePath,NULL); } if (!PathFileExistsA(szCustomLogPath)) { SHCreateDirectoryExA(NULL,szCustomLogPath,NULL); } server.SetPath(hLogFile,szImagePath,szRecordPath); server.SetOtherPath(szPackagePath,szCustomLogPath); system("cls"); printf("%s Version %d.%02d\n",m_szServiceName, m_iMajorVersion, m_iMinorVersion); server.WriteLogFile(FALSE,"\r\n%s Version %d.%02d",m_szServiceName, m_iMajorVersion, m_iMinorVersion); ini.GetString(_T("ServerSetting"),_T("ServerIP"),szIpAddress,256); nPort = ini.GetInt(_T("ServerSetting"),_T("ListenPort"),7788); BOOL bRet = server.Start(szIpAddress,nPort); while (!bRet && m_bIsRunning) { printf("Start server(%s:%d) failed ! Please check the ip address and the listen port is right.\n" ,szIpAddress,nPort); printf("Wait 60s to retry......\n"); server.WriteLogFile(TRUE,"Start server(%s:%d) failed ! Please check the ip address and the listen port is right." ,szIpAddress,nPort); server.WriteLogFile(TRUE,"Wait 60s to retry......"); Sleep(60000); ini.GetString(_T("ServerSetting"),_T("ServerIP"),szIpAddress,256); nPort = ini.GetInt(_T("ServerSetting"),_T("ListenPort"),7788); bRet = server.Start(szIpAddress,nPort); } printf("Start server(%s:%d) success...\n",szIpAddress,nPort); server.WriteLogFile(TRUE,"Start server(%s:%d) success...",szIpAddress,nPort); while (m_bIsRunning) { Sleep(1000); } server.Shutdown(); printf("The server(%s:%d) closed.\n",szIpAddress,nPort); server.WriteLogFile(TRUE,"The server(%s:%d) closed.",szIpAddress,nPort); CloseHandle(hLogFile); }
void CPlayerView::AddToPlayList( const CString& strFileName ) { CString strExt( strFileName ); CString strDir( strFileName ); CString strCurrentDir; int nPos; nPos = strExt.ReverseFind( '.' ); if ( nPos > 0 ) { strExt = strExt.Mid( nPos + 1 ); } nPos = strDir.ReverseFind( _T( '\\' ) ); if ( nPos > 0 ) { strDir = strDir.Left( nPos ); } char lpszCurDir[ MAX_PATH + 1 ] = {'\0',}; // Get current directory _getcwd( lpszCurDir, sizeof( lpszCurDir ) ); if ( 0 == strExt.CompareNoCase( _T( "M3U" ) ) ) { // go to the directory if ( 0 == _tchdir( strDir ) ) { // open the playlist FILE* pFile = CDexOpenFile( CUString( strFileName ), _W( "rt" ) ); if ( NULL != pFile ) { char lpszLine[ 8192 ] = {'\0',}; // read the lines in the playlist file while ( NULL != fgets( lpszLine, sizeof( lpszLine ), pFile ) ) { if ( '\n' == lpszLine[ strlen( lpszLine ) -1 ] ) { lpszLine[ strlen( lpszLine ) -1 ] = '\0'; } // skip extended info if ( '#' != lpszLine[0] ) { CString strEntry( lpszLine ); int nPos = 0; if ( strDir.Find( _T( ":\\" ) ) < 0 ) { if ( 0 == ( nPos = strEntry.Find( _T( ".\\" ) ) ) ) { strEntry = strDir + strEntry.Mid( 1 ); } else { strEntry = strDir + _T( "\\" ) + strEntry; } } AddStringToPlayList( strEntry ); } } // close the playlist file fclose( pFile ); } } } else if ( 0 == strExt.CompareNoCase( _T( "PLS" ) ) ) { CIni plsIni; int nNumEntries = 0; CString strEntry; CString strNumber; int i = 0; // go to the directory if ( 0 == _tchdir( strDir ) ) { plsIni.SetIniFileName( CUString( strFileName ) ); nNumEntries = plsIni.GetValue( _T( "playlist" ), _T( "NumberOfEntries" ), nNumEntries ); for ( i = 1; i <= nNumEntries; i++ ) { strNumber.Format( _T( "File%d"), i ); strEntry = plsIni.GetValue( CUString( _W( "playlist" ) ), CUString( strNumber ), _W( "" ) ); if ( !strEntry.IsEmpty() ) { int nPos = 0; if ( strDir.Find( _T( ":\\" ) ) < 0 ) { if ( 0 == ( nPos = strEntry.Find( _T( ".\\" ) ) ) ) { strEntry = strDir + strEntry.Mid( 1 ); } else { strEntry = strDir + _T( "\\" ) + strEntry; } } AddStringToPlayList( strEntry ); } } } } else { AddStringToPlayList( strFileName ); } // switch back to the current directory chdir( lpszCurDir ); }