void CLanguage::EncodeTab( CUString& strModify ) const { int nPos; while ( ( nPos = strModify.Find( _W( "\t" ) ) ) >= 0 ) { strModify = strModify.Left( nPos ) + _W( "\\t" ) + strModify.Right( strModify.GetLength() - nPos -1 ); } while ( ( nPos = strModify.Find( _W( "\n" ) ) ) >= 0 ) { strModify = strModify.Left( nPos ) + _W( "\\n" ) + strModify.Right( strModify.GetLength() - nPos -1 ); } while ( ( nPos = strModify.Find( _W( "\r" ) ) ) >= 0 ) { strModify = strModify.Left( nPos ) + _W( "\\r" ) + strModify.Right( strModify.GetLength() - nPos -1 ); } }
void COpenFileDlg::AddRecursiveFiles( const CUString& strDir,int nItem ) { CFileFind fileFind; CUString pathAndFileType = strDir + CUString( _W( "\\*.*" )); BOOL bStop=FALSE; CUStringConvert strCnv; // Iterate through the items in the listbox and populate the listconrol. if (fileFind.FindFile( strCnv.ToT( pathAndFileType ) ) ) { do { bStop=(fileFind.FindNextFile()==0); CUString strFileName = CUString( fileFind.GetFileName() ); CUString strFileRoot = CUString( fileFind.GetRoot() ); CUString strFileType; if ( TRUE == fileFind.IsDirectory() && FALSE == fileFind.IsDots() && TRUE == m_bRecursiveDir ) { AddRecursiveFiles( strDir + CUString( _W( "\\" ) ) + strFileName, nItem ); } if (fileFind.IsDirectory()==FALSE && fileFind.IsDots()==FALSE) { int nPos=strFileName.ReverseFind( _T( '.' ) ); if (nPos>0) { CUString strExt; strExt = strFileName.Right(strFileName.GetLength()-nPos-1); strFileType = strExt; strExt.MakeUpper(); if ( CompareExt( strExt ) == TRUE ) { CUString strFileSize; CUString strFileDate; CTime fileTime; // Get the data/time stamp of this file fileFind.GetLastWriteTime( fileTime ); // Format date time string strFileDate.Format( _W( "%4d/%02d/%02d %02d:%02d" ), fileTime.GetYear(), fileTime.GetMonth(), fileTime.GetDay(), fileTime.GetHour(), fileTime.GetMinute() ); strFileSize.Format( _W( "%10.2f" ), fileFind.GetLength() / ( 1024.0 * 1024.0 ) ); CUStringConvert strCnv; m_ctrlRequestedFiles.InsertItem( nItem, strCnv.ToT( strFileName )); m_ctrlRequestedFiles.SetItemText( nItem, FILE_OPEN_TYPE, strCnv.ToT( strFileType ) ); m_ctrlRequestedFiles.SetItemText( nItem, FILE_OPEN_DATE ,strCnv.ToT( strFileDate ) ); m_ctrlRequestedFiles.SetItemText( nItem, FILE_OPEN_PATH, strCnv.ToT( strFileRoot ) ); m_ctrlRequestedFiles.SetItemText( nItem, FILE_OPEN_SIZE, strCnv.ToT( strFileSize ) ); m_ctrlRequestedFiles.SetItemData( nItem, (DWORD)fileTime.GetTime() ); nItem++; } } } } while (bStop!=TRUE); } m_bSortAscending=TRUE; }
BOOL ISndStreamWinAmp::OpenStream( const CUString& strFileName ) { DWORD i = 0; BOOL bFound = FALSE; LTRACE2( _T( "ISndStreamWinAmp::OpenStream( %s )" ), strFileName ); int nPos = 0; CUString strExt( _T( "wav" ) ); g_bFinished = FALSE; g_bInitialized = FALSE; g_bOutOpened = FALSE; g_eFinished.ResetEvent(); FlushFIFO( ); nPos = strFileName.ReverseFind('.'); if ( nPos >= 0 ) { strExt = strFileName.Right( strFileName.GetLength() - nPos - 1 ); strExt.MakeLower(); } // Set the buffer size SetBufferSize( 9000 ); SetFileName( strFileName ); int nRet = 0; // loop through the available plugings for ( i=0; i < gs_vWinAmpProps.size(); i++ ) { m_WinAmpProp = gs_vWinAmpProps[i]; // m_WinAmpProp.pModule->Init( ); // check if the module can handle the file format if ( ( nRet = m_WinAmpProp.pModule->IsOurFile( (LPSTR)GetDosFileName( strFileName ) ) ) ) { bFound = TRUE; break; } /* if ( ( 0 == strExt.CompareNoCase( _T( "flac" ) ) ) && ( 0 == strExt.CompareNoCase( m_WinAmpProp.strExt ) ) ) { bFound = TRUE; break; } */ CUString strPluginExt( m_WinAmpProp.pModule->FileExtensions, CP_UTF8 ); strPluginExt.MakeLower(); // check first on extention if ( strPluginExt.Find( strExt ) >=0 ) { bFound = TRUE; break; } // m_WinAmpProp.pModule->Quit( ); } if ( !bFound ) { LTRACE2( _T( "ISndStreamWinAmp::OpenStream Failed, no proper plugin found!" ) ); return FALSE; } if ( 0 == m_WinAmpProp.pModule->UsesOutputPlug ) { LTRACE2( _T( "ISndStreamWinAmp::OpenStream; Failed, does not use Output Plugin " ) ); return FALSE; } LTRACE2( _T( "ISndStreamWinAmp::OpenStream found proper plugin ( %s )" ) , m_WinAmpProp.pModule->description ); // setup proper function calls m_WinAmpProp.pModule->SetInfo = SetInfo; m_WinAmpProp.pModule->SAAddPCMData = SAAddPCMData; m_WinAmpProp.pModule->SAGetMode = SAGetMode; m_WinAmpProp.pModule->SAAdd = SAAdd; m_WinAmpProp.pModule->VSAAddPCMData = VSAAddPCMData; m_WinAmpProp.pModule->VSAGetMode = VSAGetMode; m_WinAmpProp.pModule->VSAAdd = VSAAdd; m_WinAmpProp.pModule->VSASetInfo = VSASetInfo; m_WinAmpProp.pModule->dsp_isactive = dsp_isactive; m_WinAmpProp.pModule->dsp_dosamples = dsp_dosamples; m_WinAmpProp.pModule->EQSet = EQSet; m_WinAmpProp.pModule->SAVSADeInit = WMIN_SAVSADeInit; m_WinAmpProp.pModule->SAVSAInit = WMIN_SAVSAInit; m_WinAmpProp.pModule->outMod = &g_OutModule; g_OutModule.version = OUT_VER; g_OutModule.description = g_lpszOutModuleName; g_OutModule.id = 33; g_OutModule.Config = OutConfig; g_OutModule.About = OutAbout; g_OutModule.Init = OutInit; g_OutModule.Quit = OutQuit; g_OutModule.Open = OutOpen; g_OutModule.Close = OutClose; g_OutModule.Write = OutWrite; g_OutModule.CanWrite = OutCanWrite; g_OutModule.IsPlaying = OutIsPlaying; g_OutModule.Pause = OutPause; g_OutModule.SetVolume = OutSetVolume; g_OutModule.SetPan = OutSetPan; g_OutModule.Flush = OutFlush; g_OutModule.GetOutputTime = OutGetOutputTime; g_OutModule.GetWrittenTime = OutGetWrittenTime; SetChannels( 2 ); SetSampleRate( 44100 ); SetBitRate( 176000 * 8 ); // m_dwSamples=wfInfo.samples; m_dwTotalFileSize = 1000; m_dwCurrentFilePos = 0; // start the decoding thread if ( 0 != m_WinAmpProp.pModule->Play( (LPSTR)GetDosFileName( strFileName ) ) ) { return FALSE; } // Wait till output device has been opened by the // input plugin while ( FALSE == g_bOutOpened ) { ::Sleep( 5 ); } SetChannels( g_nNumChannels ); SetSampleRate( g_nOutSampleRate ); SetBitRate( g_nBitRate ); g_bInitialized = TRUE; // return Success return TRUE; }