CEpgDataCap_BonDlg::CEpgDataCap_BonDlg(CWnd* pParent /*=NULL*/) : CDialogEx(CEpgDataCap_BonDlg::IDD, pParent) , log(_T("")) , statusLog(_T("")) , pgInfo(_T("")) { m_hIcon = (HICON)LoadImage( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDI_ICON_BLUE ), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); m_hIcon2 = (HICON)LoadImage( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDI_ICON_BLUE ), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); iconRed = (HICON)LoadImage( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDI_ICON_RED ), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); iconBlue = (HICON)LoadImage( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDI_ICON_BLUE ), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); iconGreen = (HICON)LoadImage( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDI_ICON_GREEN ), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); iconGray = (HICON)LoadImage( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDI_ICON_GRAY ), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); wstring strPath = L""; GetModuleIniPath(strPath); this->moduleIniPath = strPath.c_str(); GetCommonIniPath(strPath); this->commonIniPath = strPath.c_str(); GetEpgTimerSrvIniPath(strPath); this->timerSrvIniPath = strPath.c_str(); this->initONID = GetPrivateProfileInt( L"Set", L"LastONID", -1, this->moduleIniPath ); this->initTSID = GetPrivateProfileInt( L"Set", L"LastTSID", -1, this->moduleIniPath ); this->initSID = GetPrivateProfileInt( L"Set", L"LastSID", -1, this->moduleIniPath ); WCHAR buff[512]=L""; GetPrivateProfileString( L"Set", L"LastBon", L"", buff, 512, this->moduleIniPath ); this->iniBonDriver = buff; iniView = FALSE; iniNetwork = TRUE; iniMin = FALSE; this->iniUDP = FALSE; this->iniTCP = FALSE; this->minTask = GetPrivateProfileInt( L"Set", L"MinTask", 0, this->moduleIniPath ); this->openLastCh = GetPrivateProfileInt( L"Set", L"OpenLast", 1, this->moduleIniPath ); if( this->openLastCh == 0 ){ if( GetPrivateProfileInt( L"Set", L"OpenFix", 0, this->moduleIniPath ) == 1){ this->initONID = GetPrivateProfileInt( L"Set", L"FixONID", -1, this->moduleIniPath ); this->initTSID = GetPrivateProfileInt( L"Set", L"FixTSID", -1, this->moduleIniPath ); this->initSID = GetPrivateProfileInt( L"Set", L"FixSID", -1, this->moduleIniPath ); GetPrivateProfileString( L"Set", L"FixBon", L"", buff, 512, this->moduleIniPath ); this->iniBonDriver = buff; }else{ this->initONID = -1; this->initTSID = -1; this->initSID = -1; this->iniBonDriver = L""; } } this->initOpenWait = 0; this->initChgWait = 0; }
CEpgDataCap_BonDlg::CEpgDataCap_BonDlg() : m_hWnd(NULL) , m_hKeyboardHook(NULL) { m_hIcon = (HICON)LoadImage( GetModuleHandle(NULL), MAKEINTRESOURCE( IDI_ICON_BLUE ), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); m_hIcon2 = (HICON)LoadImage( GetModuleHandle(NULL), MAKEINTRESOURCE( IDI_ICON_BLUE ), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); iconRed = (HICON)LoadImage( GetModuleHandle(NULL), MAKEINTRESOURCE( IDI_ICON_RED ), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); iconBlue = (HICON)LoadImage( GetModuleHandle(NULL), MAKEINTRESOURCE( IDI_ICON_BLUE ), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); iconGreen = (HICON)LoadImage( GetModuleHandle(NULL), MAKEINTRESOURCE( IDI_ICON_GREEN ), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); iconGray = (HICON)LoadImage( GetModuleHandle(NULL), MAKEINTRESOURCE( IDI_ICON_GRAY ), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); taskbarCreated = RegisterWindowMessage(L"TaskbarCreated"); wstring strPath = L""; GetModuleIniPath(strPath); this->moduleIniPath = strPath.c_str(); GetCommonIniPath(strPath); this->commonIniPath = strPath.c_str(); GetEpgTimerSrvIniPath(strPath); this->timerSrvIniPath = strPath.c_str(); this->initONID = GetPrivateProfileInt( L"Set", L"LastONID", -1, this->moduleIniPath.c_str() ); this->initTSID = GetPrivateProfileInt( L"Set", L"LastTSID", -1, this->moduleIniPath.c_str() ); this->initSID = GetPrivateProfileInt( L"Set", L"LastSID", -1, this->moduleIniPath.c_str() ); WCHAR buff[512]=L""; GetPrivateProfileString( L"Set", L"LastBon", L"", buff, 512, this->moduleIniPath.c_str() ); this->iniBonDriver = buff; iniView = FALSE; iniNetwork = TRUE; iniMin = FALSE; this->iniUDP = FALSE; this->iniTCP = FALSE; this->minTask = GetPrivateProfileInt( L"Set", L"MinTask", 0, this->moduleIniPath.c_str() ); this->openLastCh = GetPrivateProfileInt( L"Set", L"OpenLast", 1, this->moduleIniPath.c_str() ); if( this->openLastCh == 0 ){ if( GetPrivateProfileInt( L"Set", L"OpenFix", 0, this->moduleIniPath.c_str() ) == 1){ this->initONID = GetPrivateProfileInt( L"Set", L"FixONID", -1, this->moduleIniPath.c_str() ); this->initTSID = GetPrivateProfileInt( L"Set", L"FixTSID", -1, this->moduleIniPath.c_str() ); this->initSID = GetPrivateProfileInt( L"Set", L"FixSID", -1, this->moduleIniPath.c_str() ); GetPrivateProfileString( L"Set", L"FixBon", L"", buff, 512, this->moduleIniPath.c_str() ); this->iniBonDriver = buff; }else{ this->initONID = -1; this->initTSID = -1; this->initSID = -1; this->iniBonDriver = L""; } } this->initOpenWait = 0; this->initChgWait = 0; }
//チューナー一覧の読み込みを行う //戻り値: // TRUE(成功)、FALSE(失敗) BOOL CTunerManager::ReloadTuner() { map<DWORD, TUNER_INFO*>::iterator itr; for( itr = this->tunerMap.begin(); itr != this->tunerMap.end(); itr++ ){ SAFE_DELETE(itr->second); } this->tunerMap.clear(); wstring path = L""; GetSettingPath(path); wstring srvIniPath = L""; GetEpgTimerSrvIniPath(srvIniPath); wstring searchKey = path; searchKey += L"\\*.ChSet4.txt"; WIN32_FIND_DATA findData; HANDLE find; //指定フォルダのファイル一覧取得 find = FindFirstFile( searchKey.c_str(), &findData); if ( find == INVALID_HANDLE_VALUE ) { return FALSE; } do{ if( (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 ){ //本当に拡張子DLL? if( IsExt(findData.cFileName, L".txt") == TRUE ){ wstring chSetPath = L""; Format(chSetPath, L"%s\\%s", path.c_str(), findData.cFileName); wstring bonFileName = L""; wstring buff = findData.cFileName; FindBonFileName(buff, bonFileName); bonFileName += L".dll"; WORD count = (WORD)GetPrivateProfileInt(bonFileName.c_str(), L"Count", 0, srvIniPath.c_str()); if( count != 0 ){ //カウント0以上のものだけ利用 WORD priority = (WORD)GetPrivateProfileInt(bonFileName.c_str(), L"Priority", 0, srvIniPath.c_str()); BOOL epgCapFlag = (BOOL)GetPrivateProfileInt(bonFileName.c_str(), L"GetEpg", 1, srvIniPath.c_str()); WORD EPGcount = (WORD)GetPrivateProfileInt(bonFileName.c_str(), L"EPGCount", -1, srvIniPath.c_str()); if(EPGcount<0) EPGcount = count; for( WORD i=1; i<=count; i++ ){ TUNER_INFO* item = new TUNER_INFO; item->bonID = priority; item->tunerID = i; if(EPGcount<i){ // EPGCountを超えていたらEPG取得に使用しない item->epgCapFlag = 0; } else { item->epgCapFlag = epgCapFlag; } item->bonFileName = bonFileName; item->chUtil.ParseText(chSetPath.c_str()); item->chSet4FilePath = chSetPath; DWORD key = ((DWORD)item->bonID)<<16 | item->tunerID; this->tunerMap.insert(pair<DWORD, TUNER_INFO*>(key, item)); } } } } }while(FindNextFile(find, &findData)); FindClose(find); return TRUE; }
//チューナー一覧の読み込みを行う //戻り値: // TRUE(成功)、FALSE(失敗) BOOL CTunerManager::ReloadTuner() { this->tunerMap.clear(); wstring path = L""; GetSettingPath(path); wstring srvIniPath = L""; GetEpgTimerSrvIniPath(srvIniPath); wstring searchKey = path; searchKey += L"\\*.ChSet4.txt"; WIN32_FIND_DATA findData; HANDLE find; //指定フォルダのファイル一覧取得 find = FindFirstFile( searchKey.c_str(), &findData); if ( find == INVALID_HANDLE_VALUE ) { return FALSE; } do{ if( (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 ){ wstring bonFileName; if( FindBonFileName(findData.cFileName, bonFileName) != FALSE ){ wstring chSetPath = L""; Format(chSetPath, L"%s\\%s", path.c_str(), findData.cFileName); bonFileName += L".dll"; WORD count = (WORD)GetPrivateProfileInt(bonFileName.c_str(), L"Count", 0, srvIniPath.c_str()); if( count != 0 ){ //カウント0以上のものだけ利用 WORD priority = (WORD)GetPrivateProfileInt(bonFileName.c_str(), L"Priority", 0, srvIniPath.c_str()); BOOL epgCapFlag = (BOOL)GetPrivateProfileInt(bonFileName.c_str(), L"GetEpg", 1, srvIniPath.c_str()); WORD EPGcount = (WORD)GetPrivateProfileInt(bonFileName.c_str(), L"EPGCount", count, srvIniPath.c_str()); if(EPGcount==0) EPGcount = count; if( this->tunerMap.find((DWORD)priority<<16 | 1) != this->tunerMap.end() ){ OutputDebugString(L"CTunerManager::ReloadTuner(): Duplicate bonID\r\n"); count = 0; } for( WORD i=1; i<=count; i++ ){ TUNER_INFO item; item.epgCapMaxOfThisBon = min(epgCapFlag == FALSE ? 0 : EPGcount, count); item.bonFileName = bonFileName; item.chSet4FilePath = chSetPath; CParseChText4 chUtil; chUtil.ParseText(chSetPath.c_str()); map<DWORD, CH_DATA4>::const_iterator itr; for( itr = chUtil.GetMap().begin(); itr != chUtil.GetMap().end(); itr++ ){ item.chList.push_back(itr->second); } this->tunerMap.insert(pair<DWORD, TUNER_INFO>((DWORD)priority<<16 | i, item)); } } } } }while(FindNextFile(find, &findData)); FindClose(find); return TRUE; }