Example #1
0
//-----------------------------------------------------------------------------
// ストレスファイルの削除
//-----------------------------------------------------------------------------
void RemoveAll(LPCTSTR path) {
	WIN32_FIND_DATA data;
	TCHAR wc[MAX_PATH];
	PathAppend(lstrcpy(wc, path), _T("*.*"));

	HANDLE hFind = FindFirstFile(wc, &data);
	if (hFind == INVALID_HANDLE_VALUE) {
		return;
	}

	do {
		if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
			TCHAR fname[MAX_PATH];
			PathAppend(lstrcpy(fname, path), data.cFileName);
			_tprintf(_T("削除 '%s' ... "), fname);

			if (DeleteFile(fname)) {
				_tprintf(_T("done\n"));
			} else {
				_tprintf(_T("error %d\n"), GetLastError());
			}
		}
	} while (FindNextFile(hFind, &data));

	FindClose(hFind);
}
Example #2
0
/**
 * @brief Create link files for registry menu.
 * CreateLink - uses the shell's IShellLink and IPersistFile interfaces to
 *  create and store a shortcut to the specified object.
 * @param [in] lpszPathObj Address of a buffer containing the path of the
 *   object.
 * @param [in] lpszPathLink Address of a buffer containing the path where the
 *   shell link is to be stored.
 * @return The result of calling the member functions of the interfaces.
 */
STDAPI CreateLink(LPCTSTR lpszPathObj, LPCTSTR lpszPathLink)
{
	HRESULT hres;
	IShellLink *psl;

	// Get a pointer to the IShellLink interface.
	hres = CoCreateInstance(CLSID_ShellLink, NULL,
		CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
	if (SUCCEEDED(hres))
	{
		IPersistFile *ppf;
		// Set the path to the shortcut target
		psl->SetPath(lpszPathObj);
		// Query IShellLink for the IPersistFile interface for saving the
		// shortcut in persistent storage.
		hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf);
		if (SUCCEEDED(hres))
		{
			// Create the dir before saving the file because IPersistFile::Save won't
			if (LPTSTR tmp = StrRChr(lpszPathLink, 0, _T('\\')))
			{
				*tmp = _T('\0'); //Remove filename
				CreateDirectory(lpszPathLink, 0);
				*tmp = _T('\\');
			}
			// Save the link by calling IPersistFile::Save.
			hres = ppf->Save(static_cast<T2W>(lpszPathLink), TRUE);
			ppf->Release();
		}
		psl->Release();
	}
	return hres;
}
Example #3
0
void CTestWndWindow::InitWindow()
{
	m_pTagLayout = static_cast<CTagLayoutUI*>(m_pm.FindControl(_T("TabContainer")));
	m_webBrowser = static_cast<CWebBrowserUI*>(m_pm.FindControl(_T("webBrowser")));
	m_webBrowser->DoCreateControl();
	m_webBrowser->Navigate2(L"www.baidu.com");
}
Example #4
0
//##############################################################################
//# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
//##############################################################################
xString xSystem::getHomeDir()
{
    xString ret;
    bool res;
#ifdef XTK_OS_WINDOWS
    //try to get userprofile (work under winNt 2000 xp)
    res = getEnv(_T("USERPROFILE"),ret);

    if(res)
        return ret;

    //try to get HOMEDRIVE + HOMEPATH
    res = getEnv(_T("HOMEDRIVE"),ret);

    if(res)
    {
        xString ret2;
        res = getEnv(_T("HOMEPATH"),ret2);
        if(res)
        {
            ret.append(ret2);
            return ret;
        }
    }
#elif defined(XTK_OS_UNIX)
    res = getEnv(_T("HOME"),ret);
    if(res)
        return ret;

#endif

    //use the current dir
    return xString::getFormat(_T(".%c"),xFile::separator);
}
Example #5
0
static void
FillI2CBus(DataFieldEnum &dfe)
{
  dfe.addEnumText(_T("0"), 0u);
  dfe.addEnumText(_T("1"), 1u);
  dfe.addEnumText(_T("2"), 2u);
}
Example #6
0
HRESULT CMpcAudioRenderer::CompleteConnect(IPin *pReceivePin)
{
    HRESULT			hr = S_OK;
    TRACE(_T("CMpcAudioRenderer::CompleteConnect\n"));

    if (!m_useWASAPI && ! m_pDS) {
        return E_FAIL;
    }

    if (SUCCEEDED(hr)) {
        hr = CBaseRenderer::CompleteConnect(pReceivePin);
    }
    if (SUCCEEDED(hr)) {
        hr = InitCoopLevel();
    }

    if (!m_useWASAPI) {
        if (SUCCEEDED(hr)) {
            hr = CreateDSBuffer();
        }
    }
    if (SUCCEEDED(hr)) {
        TRACE(_T("CMpcAudioRenderer::CompleteConnect Success\n"));
    }
    return hr;
}
Example #7
0
void CWarning16Bit::CheckCheckBox()
{
   if (m_cbbDoNotDisplayAgain.GetCheck() == BST_CHECKED)
   {
      AfxGetApp()->WriteProfileInt(_T("Settings"), _T("DoNotDisplay16BitWarning"), 1);
   }
}
Example #8
0
CXMLElement* CProfiles::FindProcess(LPCTSTR xJobId, POSITION& posNext, CXMLElement** ppActionXML)
{
    CSingleLock pLock( &m_pSection, TRUE );
    if ( ! m_pXMLMonitor ) return NULL;

    CXMLElement* pAction = NULL;
    if ( ! ppActionXML ) ppActionXML = &pAction;

    *ppActionXML = m_pXMLMonitor->GetElementByName( _T("ShortMessage") );

    if ( CXMLElement* pXML = m_pXMLMonitor->GetElementByName( _T("Process") ) )
    {
        if ( ! posNext ) posNext = pXML->GetElementIterator();
        if ( ! posNext ) return NULL;

        CXMLElement* pMap = pXML->GetNextElement( posNext );
        if ( ! pMap->IsNamed( _T("Map") ) ) return posNext ? FindProcess( xJobId, posNext ) : NULL;

        if ( ! xJobId || ! _tcscmp(xJobId, _T("ÈÎÒâ")) ) return pMap;

        CXMLAttribute* pAttri = pMap->GetAttribute( "Host" );
        if ( pAttri && pAttri->GetValue() == xJobId ) return pMap;

        return posNext ? FindProcess( xJobId, posNext, ppActionXML ) : NULL;
    }

    return NULL;
}
bool cbEditorPanel::SaveAs()
{
    wxFileName fname;
    fname.Assign(GetFilename());
    ConfigManager* mgr = Manager::Get()->GetConfigManager(_T("app"));

    wxString Path = fname.GetPath();
    wxString Extension = _T("nsd");

    if(mgr && Path.IsEmpty())
        Path = mgr->Read(_T("/file_dialogs/save_file_as/directory"), Path);

    wxFileDialog dlg(Manager::Get()->GetAppWindow(),
                      _("Save file"),
                      Path,
                      fname.GetFullName(),
                      m_filecontent->GetWildcard(),
                      wxFD_SAVE | wxFD_OVERWRITE_PROMPT);

    if (dlg.ShowModal() != wxID_OK) // cancelled out
    {
        UpdateModified();
        return false;
    }

    SetFilename(dlg.GetPath());
    SetModified(true);
    m_IsOK = true;
    bool ret = m_filecontent->Save(GetFilename());
    UpdateModified();
    return ret;
}
Example #10
0
CString CSourceODBC::SDBField::GetValueAsString()
{
    switch( ID_TYPE )
    {
    case LONG:
    {
        CString ret;
        ret.Format( _T("%d"), lValue );
        return ret;
    }

    case STRING:
        return  strValue;

    case TIME:
        return CString(timeValue.Format( _T("%d/%m/%Y") ));

    case DOUBLE:
    {
        CString ret;
        ret.Format( _T("%.2f"), dValue );
        return ret;
    }

    case DOUBLE4:
    {
        CString ret;
        ret.Format( _T("%.4f"), dValue );
        return ret;
    }
    }
    return _T("Неизвестный тип данных");
}
Example #11
0
BOOL CProfiles::Setup()
{
    Release();

    CSingleLock pLock( &m_pSection, TRUE );

    CString strXML;

    strXML = Settings.General.Path;
    int nLength = strXML.GetLength();

    if ( nLength > 0 && strXML.GetAt(nLength-1) != '\\' ) strXML += '\\';
    strXML += _T("xProfile.xml");

    if ( CXMLElement* pXML = CXMLElement::FromFile( strXML, TRUE ) )
    {
        CXMLElement* pXMLSub;

        if ( pXMLSub = pXML->GetElementByName( _T("Monitor") ) )
        {
            m_pXMLMonitor = pXMLSub->Clone();
        }

        delete pXML;
        return TRUE;
    }

    return FALSE;
}
Example #12
0
BOOL CSourceODBC::Connect(void)
{
    if ( !PrepareOpen() ) return FALSE;
    m_nFields = m_database.GetFieldCount(); // число RFX полей. Определена в afxdb.h
    m_nDefaultType = dynaset;								// (Тип рабочего набора записей из таблицы в БД)Определена в afxdb.h и константа dynaset тоже

    try
    {
        Open();		// Используется соединение по умолчанию. Объект CDatabase создастся сам и подключится к источнику данных определяемому
        // строкой возвращаемой функцией GetDefaultConnect().
    }
    catch( CDBException *cdb )
    {
        AfxMessageBox( _T("Не удалось соедениться с базой данных.") );
        cdb->Delete();
        return FALSE;
    }

    if( !IsOpen() )
    {
        AfxMessageBox( _T("Не удалось соедениться с базой данных.") );
        return FALSE;
    }

    return TRUE;
}
Example #13
0
CString CSourceODBC::GetDefaultConnect()
{
    m_database.password = _T("");
    CString line = _T("DSN=ToolDB");
    line += _T(";DriverId=ODBC")	+ m_database.password;
    return line;
}
Example #14
0
/* static */
String
XFace::ConvertImgToXFaceData(wxImage &img)
{
   int l, n, i;
   int value;
   String dataString;
   String tmp;

   for(l = 0; l < 48; l++)
   {
      for(n = 0; n <= 32; n+= 16)
      {
         value = 0;
         for(i = 0; i < 16; i++)
         {
            if(img.GetRed(n+i,l) != 0)
               value += 1;
            if(i != 15)
               value <<= 1;
         }
         value = value ^ 0xffff;
         tmp.Printf(_T("0x%04lX"), (unsigned long)value);
         dataString += tmp;
         dataString += _T(',');
      }
      dataString += _T('\n');
   }
   return dataString;
}
Example #15
0
void
CImportDlg::AddNifEntry(const NifEntryArray& array)
{
	int entrySize = m_entries.GetSize();
	int size = array.GetSize();
	for (int i = 0; i < size; ++i)
	{
		NifEntry entry = array[i];
		
		entry.Name.TrimLeft();
		entry.Name.TrimRight();
		entry.DeviceId.TrimLeft();
		entry.DeviceId.TrimRight();
		entry.DeviceId.Remove(_T('-'));
		entry.DeviceId.Remove(_T(' '));
		entry.DeviceId.Remove(_T(':'));
		entry.WriteKey.TrimLeft();
		entry.WriteKey.TrimRight();

		if (-1 == m_entries.Find(entry))
		{
			if (!m_entries.Add(entry))
			{
				ATLTRACE("m_entries.Add failed\n");
				continue;
			}
			int nItem = m_wndListView.AddItem(entrySize, 0, entry.Name);
			ATLASSERT(nItem == entrySize);
			m_wndListView.AddItem(entrySize, 1, _T(""));
			m_wndListView.SetCheckState(entrySize, TRUE);
			_UpdateView(nItem, entry);
			++entrySize;
		}
	}
}
Example #16
0
CDumpContext &CDumpContext::operator<<( LPCWSTR lpsz )
/****************************************************/
{
    int             nLength = wcslen( lpsz );
#ifndef _UNICODE
    char            *pszBuff1 = new char[nLength + 1];
    ::WideCharToMultiByte( CP_ACP, 0L, lpsz, -1, pszBuff1, nLength + 1, NULL, NULL );
#else
    const wchar_t   *pszBuff1 = lpsz;
#endif

    // Convert LF to CR+LF.
    TCHAR   *pszBuff2 = new TCHAR[2 * nLength + 1];
    int     nCurPos = 0;
    for( int i = 0; i < nLength; i++ ) {
        if( pszBuff1[i] == _T('\n') ) {
            pszBuff2[nCurPos] = _T('\r');
            nCurPos++;
        }
        pszBuff2[nCurPos] = pszBuff1[i];
        nCurPos++;
    }
    pszBuff2[nCurPos] = _T('\0');

    OutputString( pszBuff2 );
    delete [] pszBuff2;
#ifndef _UNICODE
    delete [] pszBuff1;
#endif
    return( *this );
}
Example #17
0
HRESULT CMpcAudioRenderer::CreateAudioClient(IMMDevice *pMMDevice, IAudioClient **ppAudioClient)
{
    HRESULT hr = S_OK;
    hnsPeriod = 0;

    TRACE(_T("CMpcAudioRenderer::CreateAudioClient\n"));

    if (*ppAudioClient) {
        if (isAudioClientStarted) {
            (*ppAudioClient)->Stop();
        }
        SAFE_RELEASE(*ppAudioClient);
        isAudioClientStarted=false;
    }

    if (pMMDevice==NULL) {
        TRACE(_T("CMpcAudioRenderer::CreateAudioClient failed, device not loaded\n"));
        return E_FAIL;
    }

    hr = pMMDevice->Activate(__uuidof(IAudioClient), CLSCTX_ALL, NULL, reinterpret_cast<void**>(ppAudioClient));
    if (FAILED(hr)) {
        TRACE(_T("CMpcAudioRenderer::CreateAudioClient activation failed (0x%08x)\n"), hr);
    } else {
        TRACE(_T("CMpcAudioRenderer::CreateAudioClient success\n"));
    }
    return hr;
}
Example #18
0
wxString wxFileData::GetEntry( fileListFieldType num ) const
{
    wxString s;
    switch ( num )
    {
    case FileList_Name:
        s = m_fileName;
        break;

    case FileList_Size:
        if (!IsDir() && !IsLink() && !IsDrive())
            s.Printf(_T("%ld"), m_size);
        break;

    case FileList_Type:
        s = GetFileType();
        break;

    case FileList_Time:
        if (!IsDrive())
            s = GetModificationTime();
        break;

#if defined(__UNIX__) || defined(__WIN32__)
    case FileList_Perm:
        s = m_permissions;
        break;
#endif // defined(__UNIX__) || defined(__WIN32__)

    default:
        wxFAIL_MSG( _T("unexpected field in wxFileData::GetEntry()") );
    }

    return s;
}
Example #19
0
HRESULT CMpcAudioRenderer::CheckAudioClient(WAVEFORMATEX *pWaveFormatEx)
{
    HRESULT hr = S_OK;
    CAutoLock cAutoLock(&m_csCheck);
    TRACE(_T("CMpcAudioRenderer::CheckAudioClient\n"));
    if (pMMDevice == NULL) {
        hr = GetAudioDevice(&pMMDevice);
    }

    // If no WAVEFORMATEX structure provided and client already exists, return it
    if (pAudioClient != NULL && pWaveFormatEx == NULL) {
        return hr;
    }

    // Just create the audio client if no WAVEFORMATEX provided
    if (pAudioClient == NULL && pWaveFormatEx==NULL) {
        if (SUCCEEDED (hr)) {
            hr=CreateAudioClient(pMMDevice, &pAudioClient);
        }
        return hr;
    }

    // Compare the exisiting WAVEFORMATEX with the one provided
    WAVEFORMATEX *pNewWaveFormatEx = NULL;
    if (CheckFormatChanged(pWaveFormatEx, &pNewWaveFormatEx)) {
        // Format has changed, audio client has to be reinitialized
        TRACE(_T("CMpcAudioRenderer::CheckAudioClient Format changed, reinitialize the audio client\n"));
        if (m_pWaveFileFormat) {
            BYTE *p = (BYTE *)m_pWaveFileFormat;
            SAFE_DELETE_ARRAY(p);
        }
        m_pWaveFileFormat=pNewWaveFormatEx;
        hr = pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, pWaveFormatEx, NULL);
        if (SUCCEEDED(hr)) {
            if (pAudioClient!=NULL && isAudioClientStarted) {
                pAudioClient->Stop();
            }
            isAudioClientStarted=false;
            SAFE_RELEASE(pRenderClient);
            SAFE_RELEASE(pAudioClient);
            if (SUCCEEDED (hr)) {
                hr=CreateAudioClient(pMMDevice, &pAudioClient);
            }
        } else {
            TRACE(_T("CMpcAudioRenderer::CheckAudioClient New format not supported, accept it anyway\n"));
            return S_OK;
        }
    } else if (pRenderClient == NULL) {
        TRACE(_T("CMpcAudioRenderer::CheckAudioClient First initialization of the audio renderer\n"));
    } else {
        return hr;
    }


    SAFE_RELEASE(pRenderClient);
    if (SUCCEEDED (hr)) {
        hr=InitAudioClient(pWaveFormatEx, pAudioClient, &pRenderClient);
    }
    return hr;
}
// 关闭并结束线程
//************************************
// Method:    OnClose
// FullName:  CThreadManage::OnClose
// Access:    public 
// Returns:   void
// Qualifier:
// Parameter: void
//************************************
void CThreadManage::OnClose(void)
{
	int iResult = 0;
	CString str = _T("");

	m_oHeartBeatThread.OnClose();
	m_oADCDataRecThread.OnClose();
	iResult = WaitForSingleObject(m_oHeartBeatThread.m_hHeartBeatThreadClose, WaitForThreadCloseTime);
	if (iResult != WAIT_OBJECT_0)
	{
		str.Format(_T("心跳线程在%dms内未能正常结束!"), WaitForThreadCloseTime);
		AfxMessageBox(str);
	}

	iResult = WaitForSingleObject(m_oADCDataRecThread.m_hADCDataThreadClose, WaitForThreadCloseTime);
	if (iResult != WAIT_OBJECT_0)
	{
		str.Format(_T("ADC数据接收线程在%dms内未能正常结束!"), WaitForThreadCloseTime);
		AfxMessageBox(str);
	}
	
	m_oHeadFrameSocket.Close();
	m_oIPSetSocket.Close();
	m_oTailFrameSocket.Close();
	m_oTailTimeFrameSocket.Close();
	m_oSysTimeSocket.Close();
	m_oADCSetSocket.Close();
	m_oHeartBeatSocket.Close();
	m_oADCDataSocket.Close();
	m_oInstrumentList.OnClose();
}
Example #21
0
BOOL CPPgScheduler::OnInitDialog()
{
	CPropertyPage::OnInitDialog();
	InitWindowStyles(this);

	m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT);
	m_list.ModifyStyle(LVS_SINGLESEL,0);
	m_list.InsertColumn(0, GetResString(IDS_TITLE) ,LVCFMT_LEFT,150,0);
	m_list.InsertColumn(1,GetResString(IDS_S_DAYS),LVCFMT_LEFT,80,1);
	m_list.InsertColumn(2,GetResString(IDS_STARTTIME),LVCFMT_LEFT,80,2);
	m_time.SetFormat(_T("H:mm"));
	m_timeTo.SetFormat(_T("H:mm"));

	m_actions.SetExtendedStyle(LVS_EX_FULLROWSELECT);
	m_actions.ModifyStyle(LVS_SINGLESEL,0);
	m_actions.InsertColumn(0, GetResString(IDS_ACTION) ,LVCFMT_LEFT,150,0);
	m_actions.InsertColumn(1,GetResString(IDS_VALUE),LVCFMT_LEFT,80,1);

	Localize();
	CheckDlgButton(IDC_ENABLE,thePrefs.IsSchedulerEnabled());
	FillScheduleList();

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Example #22
0
void CTDLWebUpdater::RestoreBackup()
{
	// error handling
	if (m_nResUpdate != TDLWUR_SUCCESS)
	{
		// restore the backup if we got that far
		if (FileMisc::FolderExists(m_sBackupFolder))
		{
			FileMisc::DeleteFolderContents(m_sAppFolder, FMDF_HIDDENREADONLY, _T("*.exe;*.dll"));

			if (!FileMisc::CopyFolder(m_sBackupFolder, m_sAppFolder, (FMDF_SUBFOLDERS | FMDF_HIDDENREADONLY)))
			{
				// log the existing error because we overwrite it
				LogError(m_sAppFolder);

				m_nResUpdate = TDLWUR_ERR_RESTOREBACKUP;
			}
			// and restart previous install
			else if (FileMisc::Run(NULL, m_sAppPath) <= 32)
			{
				// log the existing error because we overwrite it
				LogError(m_sAppFolder);

				m_nResUpdate = TDLWUR_ERR_RUNRESTORE;
			}
			else
			{
				FileMisc::LogText(_T("The application '%s' was successfully restored."), m_sAppPath);
			}
		}
	}
}
void CRecordUpDlg::OnBnClickedUpdateLyest()
{
	// TODO: 在此添加控件通知处理程序代码
	UpdateData(TRUE);

	m_radio = 3;

	CTime ct = CTime::GetCurrentTime();
	// 调时间         日  小时 分钟 秒
	//ct -= CTimeSpan(ct.GetDayOfWeek()-1, 0, 0, 0);
	int m_ny = ct.GetYear();
	int m_nm = ct.GetMonth();
	int m_nd = ct.GetDay();
	ct -= CTimeSpan(1, 0, 0, 0);
	int m_fy = ct.GetYear();
	int m_fm = ct.GetMonth();
	int m_fd = ct.GetDay();

	CString ft, nt, cs;
	ft.Format(_T("'%d-%d-%d'"), m_fy, m_fm, m_fd);
	nt.Format(_T("'%d-%d-%d'"), m_ny, m_nm, m_nd);

	cs = _T("upTime between ");
	cs += ft;
	cs += _T(" and ");
	cs += nt;
	//MessageBox(cs);
	set.m_strFilter = cs;
	ListTheInfo();
}
Example #24
0
void User::StartMenuSynchronization() {

  wxArrayString foundFilePaths;
  wxString startMenuPath;

  for (int folderIndex = 0; folderIndex < 2; folderIndex++) {

    if (folderIndex == 0) {
      startMenuPath = FilePaths::GetAllUsersShellDirectory(_T("Common Programs"));
    } else {
      startMenuPath = FilePaths::GetUserShellDirectory(_T("Programs"));
    }
   
    wxDir startMenuFolder;  

    GetShortcutsFromFolder(startMenuPath, &foundFilePaths);

    if (wxFileName::DirExists(startMenuPath) && startMenuFolder.Open(startMenuPath)) {
      wxString folderName;
      bool success = startMenuFolder.GetFirst(&folderName, wxALL_FILES_PATTERN, wxDIR_DIRS | wxDIR_HIDDEN);
      
      while (success) {
        GetShortcutsFromFolder(startMenuFolder.GetName() + _T("/") + folderName, &foundFilePaths);

        success = startMenuFolder.GetNext(&folderName);
      }
    }
  } 

  BatchAddFolderItems(foundFilePaths, true);
}
Example #25
0
bool SessionForm::OnClicked(ui::EventArgs* param)
{
	std::wstring name = param->pSender->GetName();
	if (name == L"btn_max_restore")
	{
		DWORD style = GetWindowLong(GetHWND(), GWL_STYLE);
		if (style & WS_MAXIMIZE)
			::ShowWindow(GetHWND(), SW_RESTORE);
		else
			::ShowWindow(GetHWND(), SW_MAXIMIZE);
	}
	else if (name == _T("btn_close"))
	{
		if (NULL == active_session_box_)
		{
			ASSERT(0);
			return true;
		}
		
		CloseSessionBox(active_session_box_->GetSessionId());
	}
	else if (name == _T("btn_min"))
	{
		SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0);
	}

	return true;
}
Example #26
0
//---------------------------------------------------------------------------
size_t Reader_File::Format_Test(MediaInfo_Internal* MI, const String &File_Name)
{
    //std::cout<<Ztring(File_Name).To_Local().c_str()<<std::endl;
    #if MEDIAINFO_EVENTS
        {
            struct MediaInfo_Event_General_Start_0 Event;
            Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_None, MediaInfo_Event_General_Start, 0);
            Event.Stream_Size=File::Size_Get(File_Name);
            MI->Config.Event_Send((const int8u*)&Event, sizeof(MediaInfo_Event_General_Start_0));
        }
    #endif //MEDIAINFO_EVENTS

    //With Parser MultipleParsing
    /*
    MI->Open_Buffer_Init((int64u)-1, File_Name);
    if (Format_Test_PerParser(MI, File_Name))
         return 1;
    return 0; //There is a problem
    */

    //Get the Extension
    Ztring Extension=FileName::Extension_Get(File_Name);
    Extension.MakeLowerCase();

    //Search the theorical format from extension
    InfoMap &FormatList=MediaInfoLib::Config.Format_Get();
    InfoMap::iterator Format=FormatList.end();
    if (!MI->Config.File_ForceParser_Get().empty())
        Format=FormatList.find(MI->Config.File_ForceParser_Get());
    if (Format==FormatList.end())
    {
        Format=FormatList.begin();
        while (Format!=FormatList.end())
        {
            const Ztring &Extensions=FormatList.Get(Format->first, InfoFormat_Extensions);
            if (Extensions.find(Extension)!=Error)
            {
                if(Extension.size()==Extensions.size())
                    break; //Only one extenion in the list
                if(Extensions.find(Extension+_T(" "))!=Error
                || Extensions.find(_T(" ")+Extension)!=Error)
                    break;
            }
            Format++;
        }
    }
    if (Format!=FormatList.end())
    {
        const Ztring &Parser=Format->second(InfoFormat_Parser);
        if (MI->SelectFromExtension(Parser))
        {
            //Test the theorical format
            if (Format_Test_PerParser(MI, File_Name)>0)
                 return 1;
        }
    }

    size_t ToReturn=MI->ListFormats(File_Name);
    return ToReturn;
}
Example #27
0
/* must be freed by caller */
TCHAR* CreateAppIDOfClass(TCHAR* CLSID)
{
   TCHAR* retval = new TCHAR[_tcslen(CLSID)+_tcslen(_T("AppID\\"))+1]; // length of "AppID\" + null terminator
   _tcscpy(retval, _T("AppID\\"));
   _tcscat(retval, CLSID);
   return retval;
}
Example #28
0
///////////////////////////////////////////////////////////////////////////////
// PrintFCO
///////////////////////////////////////////////////////////////////////////////
static void PrintFCO( const iFCO* pFCO, const iFCOPropDisplayer* pDisplayer )
{
    TCOUT.setf(std::ios::left);
    
    TCOUT   << _T("------- ") 
            << iTWFactory::GetInstance()->GetNameTranslator()->ToStringDisplay( pFCO->GetName() )
            << _T(" -------") 
            << std::endl;
    //
    // iterate over all of the properties
    //
    const iFCOPropSet* pPropSet = pFCO->GetPropSet();
    cFCOPropVector v        = pPropSet->GetValidVector();
    for( int i=0; i < pPropSet->GetNumProps(); i++ )
    {   
        if( v.ContainsItem( i ) )
        {
            TCOUT << _T("[");
            TCOUT.width(2);
            TCOUT << i << _T("]") ;
            TCOUT.width(25);
            TCOUT << pPropSet->GetPropName(i);
            TCOUT.width(0);
            TCOUT << pDisplayer->PropAsString( pFCO, i ) << std::endl;
        }
    }
    TCOUT << _T("--------------------------------------------") << std::endl;
}
Example #29
0
void CTestWndWindow::Notify(TNotifyUI& msg)
{
	CDuiString strCtrlName = msg.pSender->GetName();
	if(msg.sType == _T("click"))
	{
		if(strCtrlName == _T("NewItemBtn"))
		{
			int j = index++;
			CDuiString strTxt;
			strTxt.Format(L"±êÇ©%d", j);
			static CDuiString strAttrOptionEx = _T("float=\"false\" group=\"group1\" maxwidth=\"174\" normalimage=\"file=\'TabBtnBk.png\' corner=\'15,15,15,15\' source=\'0,0,87,30\'\" hotimage=\"file=\'TabBtnBk.png\' corner=\'15,15,15,15\' source=\'87,0,174,30\'\" selectedimage=\"file=\'TabBtnBk.png\' corner=\'15,15,15,15\' source=\'174,0,261,30\'\" ");
			COptionExUI* pNewOption = new COptionExUI;
			pNewOption->ApplyAttributeList(strAttrOptionEx);
			pNewOption->SetText(strTxt);


			CTagMoveUI* pNewTagMove = new CTagMoveUI;
			pNewTagMove->ApplyAttributeList(_T("maxwidth=\"174\" "));
			pNewTagMove->Add(pNewOption);
			m_pTagLayout->AddAt(pNewTagMove, m_pTagLayout->GetCount());
			pNewOption->Activate();
		}

		if(strCtrlName == _T("closebtn"))
		{
			PostQuitMessage(0L);
		}
	}

}
Example #30
0
//-----------------------------------------------------------------------------
// プログラム スタート
//-----------------------------------------------------------------------------
int _tmain(int argc, TCHAR** argv) {
	_tsetlocale(LC_ALL, _T("japanese"));

	if (argc == 2) {
		cDrv = argv[1][0];
	}

	TCHAR stressPath[MAX_PATH];
	_stprintf(stressPath, _T("%c:\\__hddstress__"), cDrv);

	TCHAR readPath[MAX_PATH];
	_stprintf(readPath, _T("%c:\\"), cDrv);

	// Ctrl+C でしか止まりません。
	for (;;) {
		// ストレステスト用ファイルを作成するフォルダを準備
		_tmkdir(stressPath);

		// ストレステスト用のファイルを作成
		MakeAll(stressPath);

		// 全ファイルを読み込むテスト
		ReadAll(readPath);
		_putts(_T(""));
	}

	return 0;
}