コード例 #1
0
ファイル: EpgDataCap_Bon.cpp プロジェクト: 9060/EDCB.local
static void StartDebugLog()
{
	wstring iniPath;
	GetModuleIniPath(iniPath);
	if( GetPrivateProfileInt(L"SET", L"SaveDebugLog", 0, iniPath.c_str()) != 0 ){
		wstring logFolder;
		GetModuleFolderPath(logFolder);
		for( int i = 0; i < 100; i++ ){
			//パスに添え字をつけて書き込み可能な最初のものに記録する
			WCHAR logFileName[64];
			wsprintf(logFileName, L"\\EpgDataCap_Bon_DebugLog-%d.txt", i);
			g_hDebugLog = CreateFile((logFolder + logFileName).c_str(), FILE_APPEND_DATA, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
			if( g_hDebugLog != INVALID_HANDLE_VALUE ){
				if( GetLastError() == ERROR_SUCCESS ){
					DWORD dwWritten;
					WriteFile(g_hDebugLog, "\xFF\xFE", sizeof(char) * 2, &dwWritten, NULL);
				}else{
					LARGE_INTEGER liPos = {};
					SetFilePointerEx(g_hDebugLog, liPos, NULL, FILE_END);
				}
				InitializeCriticalSection(&g_debugLogLock);
				g_saveDebugLog = true;
				OutputDebugString(L"****** LOG START ******\r\n");
				break;
			}
		}
	}
}
コード例 #2
0
ファイル: DLNAManager.cpp プロジェクト: PyYoshi/EDCB
int CDLNAManager::LoadPublicFolder()
{
	wstring filePath = L"";
	GetModuleFolderPath(filePath);
	filePath += L"\\dlna\\dms\\publicFolder.txt";
	publicFolder.ParseText(filePath.c_str());

	DLNA_DMS_CONTAINER_META_INFO info;

	map<wstring, DLNA_PUBLIC_FOLDER_INFO>::iterator itrFolder;
	for( itrFolder = publicFolder.folderList.begin(); itrFolder != publicFolder.folderList.end(); itrFolder++ ){
		wstring buff1 = itrFolder->second.virtualPath;
		wstring buff2=L"";
		do{
			Separate(buff1, L"/", buff2, buff1);
		}while(buff1.size() > 0 );

		info.title = buff2;
		info.uploadFolderPath = itrFolder->second.folderPath;
		info.uploadSupportFlag = 0;

		wstring virtualPath = L"PublicFile/";
		virtualPath += itrFolder->second.virtualPath;

		wstring objectID;
		if( this->dms.CreateContainer2(virtualPath, &info, objectID) != NO_ERR){
			continue;
		}

		AddFolderItem(itrFolder->second.folderPath, objectID);
	}

	return NO_ERR;
}
コード例 #3
0
ファイル: HttpFileSend.cpp プロジェクト: ACUVE/EDCB
void CHttpFileSend::GetContentType(wstring filePath, string& contentType)
{
	wstring ext = L"";
	GetFileExt(filePath, ext);

	wstring textPath;
	GetModuleFolderPath(textPath);
	textPath += L"\\ContentTypeText.txt";

	CParseContentTypeText contentTypeUtil;
	contentTypeUtil.ParseText(textPath.c_str());

	wstring typeW = L"";
	contentTypeUtil.GetMimeType(ext, typeW);
	WtoA(typeW, contentType);
}
コード例 #4
0
ファイル: EpgDBManager.cpp プロジェクト: HK323232/EDCB
CEpgDBManager::CEpgDBManager(void)
{
	this->lockEvent = _CreateEvent(FALSE, TRUE, NULL);

    this->loadThread = NULL;
    this->loadStopEvent = _CreateEvent(FALSE, FALSE, NULL);

	wstring textPath;
	GetModuleFolderPath(textPath);
	textPath += L"\\ConvertText.txt";

	this->chgText.ParseReserveText(textPath.c_str() );

	::CoInitialize( NULL );
	HRESULT hr=regExp.CreateInstance(CLSID_RegExp);
	if(FAILED(hr)){
		regExp = NULL;
	}
}
コード例 #5
0
ファイル: DLNAManager.cpp プロジェクト: PyYoshi/EDCB
CDLNAManager::CDLNAManager(void)
{
	this->upnpCtrl = NULL;
	this->startDMS = FALSE;
	this->httpPort = 8081;

	wstring filePath = L"";
	GetModuleFolderPath(filePath);
	filePath += L"\\dlna\\dms\\protocolInfo.txt";
	protocolInfo.ParseText(filePath.c_str());

	DLNA_DMS_CONTAINER_META_INFO info;
	info.title = L"RecFile";
	info.uploadSupportFlag = 0;
	dms.CreateContainer(L"0", &info, this->recFolderObjectID);

	info.title = L"PublicFile";
	info.uploadSupportFlag = 0;
	dms.CreateContainer(L"0", &info, this->publicFolderObjectID);
}
コード例 #6
0
ファイル: TunerCtrl.cpp プロジェクト: HK323232/EDCB
void CTunerCtrl::GetOption()
{
	wstring strIni;
	GetModuleFolderPath(strIni);

	strIni+=L"\\ViewApp.ini";

	WCHAR buff[512]=L"";
	GetPrivateProfileString( L"APP_CMD_OPT", L"Bon", L"-d", buff, 512, strIni.c_str() );
	this->optBon = buff;
	ZeroMemory(buff, sizeof(WCHAR)*512);
	GetPrivateProfileString( L"APP_CMD_OPT", L"Min", L"-min", buff, 512, strIni.c_str() );
	this->optMin = buff;
	ZeroMemory(buff, sizeof(WCHAR)*512);
	GetPrivateProfileString( L"APP_CMD_OPT", L"ViewOff", L"-noview", buff, 512, strIni.c_str() );
	this->optNoView = buff;
	ZeroMemory(buff, sizeof(WCHAR)*512);
	GetPrivateProfileString( L"APP_CMD_OPT", L"NetworkOff", L"-nonw", buff, 512, strIni.c_str() );
	this->optNoNW = buff;
}
コード例 #7
0
ファイル: EpgTimerSrv.cpp プロジェクト: 9060/EDCB.local
static void StartDebugLog()
{
	wstring iniPath;
	GetModuleIniPath(iniPath);
	if( GetPrivateProfileInt(L"SET", L"SaveDebugLog", 0, iniPath.c_str()) != 0 ){
		wstring logPath;
		GetModuleFolderPath(logPath);
		logPath += L"\\EpgTimerSrvDebugLog.txt";
		g_hDebugLog = CreateFile(logPath.c_str(), FILE_APPEND_DATA, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
		if( g_hDebugLog != INVALID_HANDLE_VALUE ){
			if( GetLastError() == ERROR_SUCCESS ){
				DWORD dwWritten;
				WriteFile(g_hDebugLog, "\xFF\xFE", sizeof(char) * 2, &dwWritten, NULL);
			}else{
				LARGE_INTEGER liPos = {};
				SetFilePointerEx(g_hDebugLog, liPos, NULL, FILE_END);
			}
			InitializeCriticalSection(&g_debugLogLock);
			g_saveDebugLog = true;
			OutputDebugString(L"****** LOG START ******\r\n");
		}
	}
}
コード例 #8
0
ファイル: WriteTSFile.cpp プロジェクト: ACUVE/EDCB
//ファイル保存を開始する
//戻り値:
// TRUE(成功)、FALSE(失敗)
//引数:
// fileName				[IN]保存ファイル名
// overWriteFlag		[IN]同一ファイル名存在時に上書きするかどうか(TRUE:する、FALSE:しない)
// createSize			[IN]ファイル作成時にディスクに予約する容量
// saveFolder			[IN]使用するフォルダ一覧
// saveFolderSub		[IN]HDDの空きがなくなった場合に一時的に使用するフォルダ
BOOL CWriteTSFile::StartSave(
	wstring fileName,
	BOOL overWriteFlag,
	ULONGLONG createSize,
	vector<REC_FILE_SET_INFO>* saveFolder,
	vector<wstring>* saveFolderSub,
	int maxBuffCount
)
{
	if( Lock(L"StartSave") == FALSE ) return FALSE;
	BOOL ret = TRUE;

	this->exceptionErr = FALSE;
	this->buffOverErr = FALSE;
	this->maxBuffCount = maxBuffCount;

	if( saveFolder->size() == 0 ){
		UnLock();
		_OutputDebugString(L"CWriteTSFile::StartSave Err saveFolder 0");
		return FALSE;
	}
	
	if( this->outThread == NULL || this->fileList.size() == 0 ){
		this->writeTotalSize = 0;
		this->subRecFlag = FALSE;
		this->saveFileName = fileName;
		this->overWriteFlag = overWriteFlag;
		this->saveFolder = *saveFolder;
		this->saveFolderSub = *saveFolderSub;
		BOOL firstFreeChek = TRUE;
		for( size_t i=0; i<this->saveFolder.size(); i++ ){
			SAVE_INFO* item = new SAVE_INFO;
			if( this->saveFolder[i].writePlugIn.size() == 0 ){
				this->saveFolder[i].writePlugIn = L"Write_Default.dll";
			}
			wstring plugInPath = L"";
			GetModuleFolderPath(plugInPath);
			plugInPath += L"\\Write\\";
			plugInPath += this->saveFolder[i].writePlugIn.c_str();

			item->writeUtil = new CWritePlugInUtil;
			if(item->writeUtil->Initialize(plugInPath.c_str() ) == FALSE ){
				_OutputDebugString(L"CWriteTSFile::StartSave Err 3");
				SAFE_DELETE(item);
			}else{
				wstring folderPath = this->saveFolder[i].recFolder;
				if( CompareNoCase(this->saveFolder[i].writePlugIn, L"Write_Default.dll" ) == 0 ){
					//デフォルトの場合は空き容量をあらかじめチェック
					if( createSize > 0 ){
						if( ChkFreeFolder(createSize, this->saveFolder[i].recFolder) == FALSE ){
							if( GetFreeFolder(createSize, folderPath) == TRUE ){
								//空きなかったのでサブフォルダに録画
								this->subRecFlag = TRUE;
							}
						}
					}
				}
				ChkFolderPath(folderPath);

				wstring recPath;
				recPath = folderPath;
				recPath += L"\\";
				if( this->saveFolder[i].recFileName.size() == 0 ){
					recPath += fileName;
					item->recFileName = fileName;
				}else{
					recPath += this->saveFolder[i].recFileName;
					item->recFileName = this->saveFolder[i].recFileName;
				}
				//開始
				BOOL startRes = item->writeUtil->StartSave(recPath.c_str(), this->overWriteFlag, createSize);
				if( startRes == FALSE ){
					_OutputDebugString(L"CWriteTSFile::StartSave Err 2");
					//エラー時サブフォルダでリトライ
					if( GetFreeFolder(createSize, folderPath) == TRUE ){
						//空きなかったのでサブフォルダに録画
						this->subRecFlag = TRUE;
					}
					ChkFolderPath(folderPath);
					recPath = folderPath;
					recPath += L"\\";
					if( this->saveFolder[i].recFileName.size() == 0 ){
						recPath += fileName;
						item->recFileName = fileName;
					}else{
						recPath += this->saveFolder[i].recFileName;
						item->recFileName = this->saveFolder[i].recFileName;
					}
					startRes = item->writeUtil->StartSave(recPath.c_str(), this->overWriteFlag, createSize);
				}
				if( startRes == TRUE ){
					WCHAR saveFilePath[512] = L"";
					DWORD saveFilePathSize = 512;
					item->writeUtil->GetSaveFilePath(saveFilePath, &saveFilePathSize);

					item->recFilePath = saveFilePath;
					item->freeChk = firstFreeChek;
					item->overWriteFlag = overWriteFlag;
					this->fileList.push_back(item);
					if( i==0 ){
						this->mainSaveFilePath = saveFilePath;
					}
					firstFreeChek = FALSE;
				}else{
					SAFE_DELETE(item);
				}
			}
		}

		if( this->fileList.size() > 0 ){
			//受信スレッド起動
			ResetEvent(this->outStopEvent);
			this->outThread = (HANDLE)_beginthreadex(NULL, 0, OutThread, (LPVOID)this, CREATE_SUSPENDED, NULL);
			SetThreadPriority( this->outThread, THREAD_PRIORITY_NORMAL );
			ResumeThread(this->outThread);
		}else{
			_OutputDebugString(L"CWriteTSFile::StartSave Err fileList 0");
			ret = FALSE;
		}
	}else{
		_OutputDebugString(L"CWriteTSFile::StartSave Err 1");
		ret = FALSE;
	}

	UnLock();
	return ret;
}
コード例 #9
0
ファイル: MediaPortal_BonMain.cpp プロジェクト: xbmc-now/MPB
//設定を行う
void CMediaPortal_BonMain::ReloadSetting()
{
	wstring commonIniPath = L"";
	GetCommonIniPath(commonIniPath);

	wstring appIniPath = L"";
	GetModuleIniPath(appIniPath);

	wstring settingPath = L"";
	GetSettingPath(settingPath);

	wstring bonDriverPath = L"";
	GetModuleFolderPath(bonDriverPath);
	bonDriverPath += BON_DLL_FOLDER;

	this->bonCtrl.SetSettingFolder( settingPath.c_str(), bonDriverPath.c_str() );

	this->recFolderList.clear();
	int iNum = GetPrivateProfileInt( L"SET", L"RecFolderNum", 0, commonIniPath.c_str() );
	if( iNum == 0 ){
		this->recFolderList.push_back( settingPath );
	}else{
		for( int i = 0; i < iNum; i++ ){
			CString key = L"";
			key.Format(L"RecFolderPath%d", i );
			WCHAR wBuff[512]=L"";
			GetPrivateProfileString( L"SET", key, L"", wBuff, 512, commonIniPath.c_str() );

			this->recFolderList.push_back(wBuff);
		}
	}

	this->enableScrambleFlag = GetPrivateProfileInt( L"SET", L"Scramble", 1, appIniPath.c_str() );
	this->enableEMMFlag = GetPrivateProfileInt( L"SET", L"EMM", 0, appIniPath.c_str() );
	this->allService = GetPrivateProfileInt( L"SET", L"AllService", 0, appIniPath.c_str() );
	this->needCaption = GetPrivateProfileInt( L"SET", L"Caption", 1, appIniPath.c_str() );
	this->needData = GetPrivateProfileInt( L"SET", L"Data", 0, appIniPath.c_str() );

	this->startMargine = GetPrivateProfileInt( L"SET", L"StartMargine", 5, appIniPath.c_str() );
	this->endMargine = GetPrivateProfileInt( L"SET", L"EndMargine", 5, appIniPath.c_str() );

	this->overWriteFlag = GetPrivateProfileInt( L"SET", L"OverWrite", 0, appIniPath.c_str() );

	this->BSBasic = GetPrivateProfileInt( L"SET", L"BSBasicOnly", 1, commonIniPath.c_str() );
	this->CS1Basic = GetPrivateProfileInt( L"SET", L"CS1BasicOnly", 1, commonIniPath.c_str() );
	this->CS2Basic = GetPrivateProfileInt( L"SET", L"CS2BasicOnly", 1, commonIniPath.c_str() );

	WCHAR buff[512]=L"";
	GetPrivateProfileString( L"SET", L"ViewPath", L"", buff, 512, appIniPath.c_str() );
	this->viewPath = buff;
	GetPrivateProfileString( L"SET", L"ViewOption", L"", buff, 512, appIniPath.c_str() );
	this->viewOpt = buff;

	this->udpCount = (DWORD)GetPrivateProfileInt( L"SET_UDP", L"Count", 0, appIniPath.c_str() );
	this->tcpCount = (DWORD)GetPrivateProfileInt( L"SET_TCP", L"Count", 0, appIniPath.c_str() );

	if( this->nwCtrlID != 0 ){
		if( this->allService == TRUE ){
			this->bonCtrl.SetServiceID(this->nwCtrlID, 0xFFFF);
		}else{
			this->bonCtrl.SetServiceID(this->nwCtrlID, this->lastSID);
		}
	}

	BOOL epgCapLive = (BOOL)GetPrivateProfileInt( L"SET", L"EpgCapLive", 1, appIniPath.c_str() );
	BOOL epgCapRec = (BOOL)GetPrivateProfileInt( L"SET", L"EpgCapRec", 1, appIniPath.c_str() );
	DWORD epgCapBackStartWaitSec = (DWORD)GetPrivateProfileInt( L"SET", L"EpgCapBackStartWaitSec", 30, appIniPath.c_str() );

	this->bonCtrl.SetBackGroundEpgCap(epgCapLive, epgCapRec, this->BSBasic, this->CS1Basic, this->CS2Basic, epgCapBackStartWaitSec);
	if( this->sendTcpFlag == FALSE && this->sendUdpFlag == FALSE ){
		this->bonCtrl.SetScramble(this->nwCtrlID, this->enableScrambleFlag);
	}
	this->bonCtrl.SetEMMMode(this->enableEMMFlag);

	DWORD tsBuffMaxCount = (DWORD)GetPrivateProfileInt( L"SET", L"TsBuffMaxCount", 5000, appIniPath.c_str() );
	int writeBuffMaxCount = GetPrivateProfileInt( L"SET", L"WriteBuffMaxCount", -1, appIniPath.c_str() );
	this->bonCtrl.SetTsBuffMaxCount(tsBuffMaxCount, writeBuffMaxCount);

	this->openWait = (DWORD)GetPrivateProfileInt( L"SET", L"OpenWait", 200, appIniPath.c_str() );
}
コード例 #10
0
ファイル: SyoboiCalUtil.cpp プロジェクト: PyYoshi/EDCB
BOOL CSyoboiCalUtil::SendReserve(vector<RESERVE_DATA>* reserveList, vector<TUNER_RESERVE_INFO>* tunerList)
{
	if( reserveList == NULL || tunerList == NULL ){
		return FALSE;
	}
	if( reserveList->size() == 0 ){
		return FALSE;
	}

	wstring iniAppPath = L"";
	GetModuleIniPath(iniAppPath);
	if( GetPrivateProfileInt(L"SYOBOI", L"use", 0, iniAppPath.c_str()) == 0 ){
		return FALSE;
	}
	_OutputDebugString(L"★SyoboiCalUtil:SendReserve");

	wstring textPath;
	GetModuleFolderPath(textPath);
	textPath += L"\\SyoboiCh.txt";
	CParseServiceChgText srvChg;
	srvChg.ParseText(textPath.c_str());

	SAFE_DELETE(this->proxyInfo);
	WCHAR buff[512] = L"";
	int length = 0;
	BOOL useProxy = (BOOL)GetPrivateProfileInt(L"SYOBOI", L"useProxy", 0, iniAppPath.c_str());
	if( useProxy == TRUE ){
		this->proxyInfo = new USE_PROXY_INFO;

		GetPrivateProfileString(L"SYOBOI", L"ProxyServer", L"", buff, 512, iniAppPath.c_str());
		this->proxyInfo->serverName = new WCHAR[wcslen(buff)+1];
		wcscpy_s(this->proxyInfo->serverName, wcslen(buff)+1, buff);

		ZeroMemory(buff, (sizeof(WCHAR)*512));
		GetPrivateProfileString(L"SYOBOI", L"ProxyID", L"", buff, 512, iniAppPath.c_str());
		length = (int)wcslen(buff);
		if( length > 0 ){
			this->proxyInfo->userName = new WCHAR[length+1];
			wcscpy_s(this->proxyInfo->userName, length+1, buff);
		}else{
			this->proxyInfo->userName = NULL;
		}

		ZeroMemory(buff, (sizeof(WCHAR)*512));
		GetPrivateProfileString(L"SYOBOI", L"ProxyPWD", L"", buff, 512, iniAppPath.c_str());
		length = (int)wcslen(buff);
		if( length > 0 ){
			this->proxyInfo->password = new WCHAR[length+1];
			wcscpy_s(this->proxyInfo->password, length+1, buff);
		}else{
			this->proxyInfo->password = NULL;
		}

	}

	ZeroMemory(buff, (sizeof(WCHAR)*512));
	GetPrivateProfileString(L"SYOBOI", L"userID", L"", buff, 512, iniAppPath.c_str());
	this->id=buff;

	ZeroMemory(buff, (sizeof(WCHAR)*512));
	GetPrivateProfileString(L"SYOBOI", L"PWD", L"", buff, 512, iniAppPath.c_str());
	this->pass=buff;

	int slot = GetPrivateProfileInt(L"SYOBOI", L"slot", 0, iniAppPath.c_str());

	ZeroMemory(buff, (sizeof(WCHAR)*512));
	GetPrivateProfileString(L"SYOBOI", L"devcolors", L"", buff, 512, iniAppPath.c_str());
	wstring devcolors=buff;
	
	ZeroMemory(buff, (sizeof(WCHAR)*512));
	GetPrivateProfileString(L"SYOBOI", L"epgurl", L"", buff, 512, iniAppPath.c_str());
	wstring epgurl=buff;

	if( this->id.size() == 0 ){
		_OutputDebugString(L"★SyoboiCalUtil:NoUserID");
		return FALSE;
	}

	//Authorization
	wstring auth = L"";
	auth = this->id;
	auth += L":";
	auth += this->pass;
	string authA;
	WtoA(auth, authA);

	DWORD destSize = 0;
	Base64Enc(authA.c_str(), (DWORD)authA.size(), NULL, &destSize);
	WCHAR* base64 = new WCHAR[destSize];
	ZeroMemory(base64, destSize*sizeof(WCHAR));
	Base64Enc(authA.c_str(), (DWORD)authA.size(), base64, &destSize);

	wstring authHead = L"";
	Format(authHead, L"Authorization: Basic %s\r\nContent-type: application/x-www-form-urlencoded\r\n", base64);

	//data
	wstring dataParam;
	wstring param;
	map<DWORD, wstring> tunerMap;
	for( size_t i=0; i<tunerList->size(); i++ ){
		for( size_t j=0; j<(*tunerList)[i].reserveList.size(); j++ ){
			tunerMap.insert(pair<DWORD, wstring>((*tunerList)[i].reserveList[j], (*tunerList)[i].tunerName));
		}
	}
	map<DWORD, wstring>::iterator itrTuner;
	DWORD dataCount = 0;
	for(size_t i=0; i<reserveList->size(); i++ ){
		if( dataCount>=200 ){
			break;
		}
		RESERVE_DATA* info = &(*reserveList)[i];
		if( info->recSetting.recMode == RECMODE_NO || info->recSetting.recMode == RECMODE_VIEW ){
			continue;
		}
		wstring device=L"";
		itrTuner = tunerMap.find(info->reserveID);
		if( itrTuner != tunerMap.end() ){
			device = itrTuner->second;
		}

		wstring stationName = info->stationName;
		srvChg.ChgText(stationName);

		__int64 startTime = GetTimeStamp(info->startTime);
		Format(param, L"%I64d\t%I64d\t%s\t%s\t%s\t\t0\t%d\n", startTime, startTime+info->durationSecond, device.c_str(), info->title.c_str(), stationName.c_str(), info->reserveID );
		dataParam+=param;
	}

	if(dataParam.size() == 0 ){
		_OutputDebugString(L"★SyoboiCalUtil:NoReserve");
		return FALSE;
	}

	string utf8;
	UrlEncodeUTF8(dataParam.c_str(), (DWORD)dataParam.size(), utf8);
	string data;
	Format(data, "slot=%d&data=%s",slot, utf8.c_str());

	if( devcolors.size() > 0){
		utf8 = "";
		UrlEncodeUTF8(devcolors.c_str(), (DWORD)devcolors.size(), utf8);
		data += "&devcolors=";
		data += utf8;
	}
	if( epgurl.size() > 0){
		utf8 = "";
		UrlEncodeUTF8(epgurl.c_str(), (DWORD)epgurl.size(), utf8);
		data += "&epgurl=";
		data += utf8;
	}

	UPLOAD_DATA_LIST upList;
	upList.listCount = 1;
	upList.list = new UPLOAD_DATA[1];
	upList.list->filePathFlag = 0;
	upList.list->buffSize = (DWORD)data.size();
	upList.list->buff = new BYTE[data.size()+1];
	ZeroMemory(upList.list->buff, data.size()+1);
	memcpy(upList.list->buff, data.c_str(), data.size());

	wstring url;
	Format(url,L"%s",SYOBOI_UP_URL);

	CWinHTTPUtil http;
	DWORD result = NO_ERR;
	result = http.OpenSession(L"EpgTimerSrv", FALSE, useProxy, this->proxyInfo);
	if( result != NO_ERR ){
		return FALSE;
	}
	result = http.SendRequest(url.c_str(), NW_VERB_POST, authHead.c_str(), NULL, &upList);


	DWORD dlSize = 0;
	http.GetDLBuff(NULL, &dlSize);
	if( dlSize > 0 ){
		BYTE* dlBuff = new BYTE[dlSize+1];
		ZeroMemory(dlBuff, dlSize+1);
		http.GetDLBuff(dlBuff, &dlSize);

		string response = (char*)dlBuff;
		SAFE_DELETE_ARRAY(dlBuff);
	}

	http.CloseRequest();

	_OutputDebugString(L"★SyoboiCalUtil:SendRequest res:%d", result);

	if( result != NO_ERR ){
		return FALSE;
	}
	return TRUE;
}
コード例 #11
0
ファイル: SyoboiCalUtil.cpp プロジェクト: abt8WG/EDCB
BOOL CSyoboiCalUtil::SendReserve(const vector<RESERVE_DATA>* reserveList, const vector<TUNER_RESERVE_INFO>* tunerList)
{
	if( reserveList == NULL || tunerList == NULL ){
		return FALSE;
	}
	if( reserveList->size() == 0 ){
		return FALSE;
	}

	wstring iniAppPath = L"";
	GetModuleIniPath(iniAppPath);
	if( GetPrivateProfileInt(L"SYOBOI", L"use", 0, iniAppPath.c_str()) == 0 ){
		return FALSE;
	}
	_OutputDebugString(L"★SyoboiCalUtil:SendReserve");

	wstring textPath;
	GetModuleFolderPath(textPath);
	textPath += L"\\SyoboiCh.txt";
	CParseServiceChgText srvChg;
	srvChg.ParseText(textPath.c_str());

	wstring proxyServerName;
	wstring proxyUserName;
	wstring proxyPassword;
	if( GetPrivateProfileInt(L"SYOBOI", L"useProxy", 0, iniAppPath.c_str()) != 0 ){
		proxyServerName = GetPrivateProfileToString(L"SYOBOI", L"ProxyServer", L"", iniAppPath.c_str());
		proxyUserName = GetPrivateProfileToString(L"SYOBOI", L"ProxyID", L"", iniAppPath.c_str());
		proxyPassword = GetPrivateProfileToString(L"SYOBOI", L"ProxyPWD", L"", iniAppPath.c_str());
	}

	wstring id=GetPrivateProfileToString(L"SYOBOI", L"userID", L"", iniAppPath.c_str());

	wstring pass=GetPrivateProfileToString(L"SYOBOI", L"PWD", L"", iniAppPath.c_str());

	int slot = GetPrivateProfileInt(L"SYOBOI", L"slot", 0, iniAppPath.c_str());

	wstring devcolors=GetPrivateProfileToString(L"SYOBOI", L"devcolors", L"", iniAppPath.c_str());
	
	wstring epgurl=GetPrivateProfileToString(L"SYOBOI", L"epgurl", L"", iniAppPath.c_str());

	if( id.size() == 0 ){
		_OutputDebugString(L"★SyoboiCalUtil:NoUserID");
		return FALSE;
	}

	//Authorization
	wstring auth = L"";
	auth = id;
	auth += L":";
	auth += pass;
	string authA;
	WtoA(auth, authA);

	DWORD destSize = 0;
	Base64Enc(authA.c_str(), (DWORD)authA.size(), NULL, &destSize);
	vector<WCHAR> base64(destSize + 1, L'\0');
	Base64Enc(authA.c_str(), (DWORD)authA.size(), &base64.front(), &destSize);
	//無駄なCRLFが混じることがあるため
	std::replace(base64.begin(), base64.end(), L'\r', L'\0');
	std::replace(base64.begin(), base64.end(), L'\n', L'\0');

	wstring authHead = L"";
	Format(authHead, L"Authorization: Basic %s\r\nContent-type: application/x-www-form-urlencoded\r\n", &base64.front());

	//data
	wstring dataParam;
	wstring param;
	map<DWORD, wstring> tunerMap;
	for( size_t i=0; i<tunerList->size(); i++ ){
		for( size_t j=0; j<(*tunerList)[i].reserveList.size(); j++ ){
			tunerMap.insert(pair<DWORD, wstring>((*tunerList)[i].reserveList[j], (*tunerList)[i].tunerName));
		}
	}
	map<DWORD, wstring>::iterator itrTuner;
	DWORD dataCount = 0;
	for(size_t i=0; i<reserveList->size(); i++ ){
		if( dataCount>=200 ){
			break;
		}
		const RESERVE_DATA* info = &(*reserveList)[i];
		if( info->recSetting.recMode == RECMODE_NO || info->recSetting.recMode == RECMODE_VIEW ){
			continue;
		}
		wstring device=L"";
		itrTuner = tunerMap.find(info->reserveID);
		if( itrTuner != tunerMap.end() ){
			device = itrTuner->second;
		}

		wstring stationName = info->stationName;
		srvChg.ChgText(stationName);

		__int64 startTime = GetTimeStamp(info->startTime);
		Format(param, L"%I64d\t%I64d\t%s\t%s\t%s\t\t0\t%d\n", startTime, startTime+info->durationSecond, device.c_str(), info->title.c_str(), stationName.c_str(), info->reserveID );
		dataParam+=param;
	}

	if(dataParam.size() == 0 ){
		_OutputDebugString(L"★SyoboiCalUtil:NoReserve");
		return FALSE;
	}

	string utf8;
	UrlEncodeUTF8(dataParam.c_str(), (DWORD)dataParam.size(), utf8);
	string data;
	Format(data, "slot=%d&data=%s",slot, utf8.c_str());

	if( devcolors.size() > 0){
		utf8 = "";
		UrlEncodeUTF8(devcolors.c_str(), (DWORD)devcolors.size(), utf8);
		data += "&devcolors=";
		data += utf8;
	}
	if( epgurl.size() > 0){
		utf8 = "";
		UrlEncodeUTF8(epgurl.c_str(), (DWORD)epgurl.size(), utf8);
		data += "&epgurl=";
		data += utf8;
	}
	vector<char> dataBuff(data.begin(), data.end());

	//URLの分解
	URL_COMPONENTS stURL = {};
	stURL.dwStructSize = sizeof(stURL);
	stURL.dwSchemeLength = (DWORD)-1;
	stURL.dwHostNameLength = (DWORD)-1;
	stURL.dwUrlPathLength = (DWORD)-1;
	stURL.dwExtraInfoLength = (DWORD)-1;
	if( WinHttpCrackUrl(SYOBOI_UP_URL, 0, 0, &stURL) == FALSE || stURL.dwHostNameLength == 0 ){
		return FALSE;
	}
	wstring host(stURL.lpszHostName, stURL.dwHostNameLength);
	wstring sendUrl(stURL.lpszUrlPath, stURL.dwUrlPathLength + stURL.dwExtraInfoLength);

	HINTERNET session;
	if( proxyServerName.empty() ){
		session = WinHttpOpen(L"EpgTimerSrv", WINHTTP_ACCESS_TYPE_NO_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
	}else{
		session = WinHttpOpen(L"EpgTimerSrv", WINHTTP_ACCESS_TYPE_NAMED_PROXY, proxyServerName.c_str(), WINHTTP_NO_PROXY_BYPASS, 0);
	}
	if( session == NULL ){
		return FALSE;
	}

	LPCWSTR result = L"1";
	HINTERNET connect = NULL;
	HINTERNET request = NULL;

	if( WinHttpSetTimeouts(session, 15000, 15000, 15000, 15000) == FALSE ){
		result = L"0 SetTimeouts";
		goto EXIT;
	}
	//コネクションオープン
	connect = WinHttpConnect(session, host.c_str(), stURL.nPort, 0);
	if( connect == NULL ){
		result = L"0 Connect";
		goto EXIT;
	}
	//リクエストオープン
	request = WinHttpOpenRequest(connect, L"POST", sendUrl.c_str(), NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES,
	                             stURL.nPort == INTERNET_DEFAULT_HTTPS_PORT ? WINHTTP_FLAG_SECURE : 0);
	if( request == NULL ){
		result = L"0 OpenRequest";
		goto EXIT;
	}
	if( proxyServerName.empty() == false ){
		//ProxyのIDかパスワードがあったらセット
		if( proxyUserName.empty() == false || proxyPassword.empty() == false ){
			if( WinHttpSetCredentials(request, WINHTTP_AUTH_TARGET_PROXY, WINHTTP_AUTH_SCHEME_BASIC,
			                          proxyUserName.c_str(), proxyPassword.c_str(), NULL) == FALSE ){
				result = L"0 SetCredentials";
				goto EXIT;
			}
		}
	}
	if( WinHttpSendRequest(request, authHead.c_str(), (DWORD)-1, &dataBuff.front(), (DWORD)dataBuff.size(), (DWORD)dataBuff.size(), 0) == FALSE ){
		result = L"0 SendRequest";
		goto EXIT;
	}
	if( WinHttpReceiveResponse(request, NULL) == FALSE ){
		result = L"0 ReceiveResponse";
		goto EXIT;
	}
	//HTTPのステータスコード確認
	DWORD statusCode;
	DWORD statusCodeSize = sizeof(statusCode);
	if( WinHttpQueryHeaders(request, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, WINHTTP_HEADER_NAME_BY_INDEX,
	                        &statusCode, &statusCodeSize, WINHTTP_NO_HEADER_INDEX) == FALSE ){
		statusCode = 0;
	}
	if( statusCode != 200 && statusCode != 201 ){
		result = L"0 StatusNotOK";
		goto EXIT;
	}

EXIT:
	if( request != NULL ){
		WinHttpCloseHandle(request);
	}
	if( connect != NULL ){
		WinHttpCloseHandle(connect);
	}
	if( session != NULL ){
		WinHttpCloseHandle(session);
	}

	_OutputDebugString(L"★SyoboiCalUtil:SendRequest res:%s", result);

	if( result[0] != L'1' ){
		return FALSE;
	}
	return TRUE;
}
コード例 #12
0
ファイル: BonCtrl.cpp プロジェクト: Velmy/EDCB
UINT WINAPI CBonCtrl::EpgCapBackThread(LPVOID param)
{
	wstring folderPath;
	GetModuleFolderPath( folderPath );
	wstring iniPath = folderPath;
	iniPath += L"\\BonCtrl.ini";

	DWORD timeOut = GetPrivateProfileInt(L"EPGCAP", L"EpgCapTimeOut", 15, iniPath.c_str());
	BOOL saveTimeOut = GetPrivateProfileInt(L"EPGCAP", L"EpgCapSaveTimeOut", 0, iniPath.c_str());

	CBonCtrl* sys = (CBonCtrl*)param;
	if( ::WaitForSingleObject(sys->epgCapBackStopEvent, sys->epgCapBackStartWaitSec*1000) != WAIT_TIMEOUT ){
		//キャンセルされた
		return 0;
	}

	if( sys->tsOut.IsRec() == TRUE ){
		if( sys->enableRecEpgCap == FALSE ){
			return 0;
		}
	}else{
		if( sys->enableLiveEpgCap == FALSE ){
			return 0;
		}
	}

	LONGLONG startTime = GetTimeCount();

	wstring epgDataPath = L"";
	WORD ONID;
	WORD TSID;
	sys->tsOut.GetStreamID(&ONID, &TSID);

	if( sys->chUtil.IsEpgCapService(ONID, TSID) == FALSE ){
		return 0;
	}

	sys->GetEpgDataFilePath(ONID, TSID, epgDataPath);
	sys->tsOut.StartSaveEPG(epgDataPath);
	sys->tsOut.ClearSectionStatus();

	if( ::WaitForSingleObject(sys->epgCapBackStopEvent, 60*1000) != WAIT_TIMEOUT ){
		//キャンセルされた
		sys->tsOut.StopSaveEPG(FALSE);
		return 0;
	}
	while(1){
		//蓄積状態チェック
		BOOL chkNext = FALSE;
		BOOL leitFlag = sys->chUtil.IsPartial(ONID, TSID, sys->lastSID);
		EPG_SECTION_STATUS status = sys->tsOut.GetSectionStatus(leitFlag);
		if( ONID == 4 && sys->BSBasic == TRUE ){
			if( status == EpgBasicAll || status == EpgHEITAll ){
				chkNext = TRUE;
			}
		}else if( ONID == 6 && sys->CS1Basic == TRUE ){
			if( status == EpgBasicAll || status == EpgHEITAll ){
				chkNext = TRUE;
			}
		}else if( ONID == 7 && sys->CS2Basic == TRUE ){
			if( status == EpgBasicAll || status == EpgHEITAll ){
				chkNext = TRUE;
			}
		}else{
			if( leitFlag == FALSE && status == EpgHEITAll ){
				chkNext = TRUE;
			}else if( leitFlag == TRUE && status == EpgLEITAll ){
				chkNext = TRUE;
			}
		}

		if( chkNext == TRUE ){
			sys->tsOut.StopSaveEPG(TRUE);
			CSendCtrlCmd cmd;
			cmd.SetConnectTimeOut(1000);
			cmd.SendReloadEpg();
			break;
		}else{
			if( (startTime + timeOut*60 < GetTimeCount()) ){
				//15分以上かかっているなら停止
				sys->tsOut.StopSaveEPG(saveTimeOut);
				CSendCtrlCmd cmd;
				cmd.SetConnectTimeOut(1000);
				cmd.SendReloadEpg();
				_OutputDebugString(L"++%d分でEPG取得完了せず or Ch変更でエラー", timeOut);
				break;
			}
		}

		if( ::WaitForSingleObject(sys->epgCapBackStopEvent, 10*1000) != WAIT_TIMEOUT ){
			//キャンセルされた
			sys->tsOut.StopSaveEPG(FALSE);
			break;
		}
	}

	return 0;
}
コード例 #13
0
ファイル: BonCtrl.cpp プロジェクト: Velmy/EDCB
UINT WINAPI CBonCtrl::EpgCapThread(LPVOID param)
{
	CBonCtrl* sys = (CBonCtrl*)param;

	BOOL chkNext = TRUE;
	BOOL startCap = FALSE;
	DWORD wait = 0;
	LONGLONG startTime = 0;
	DWORD chkCount = 0;
	DWORD chkWait = 8;

	BOOL chkBS = FALSE;
	BOOL chkCS1 = FALSE;
	BOOL chkCS2 = FALSE;

	wstring folderPath;
	GetModuleFolderPath( folderPath );
	wstring iniPath = folderPath;
	iniPath += L"\\BonCtrl.ini";

	DWORD timeOut = GetPrivateProfileInt(L"EPGCAP", L"EpgCapTimeOut", 15, iniPath.c_str());
	BOOL saveTimeOut = GetPrivateProfileInt(L"EPGCAP", L"EpgCapSaveTimeOut", 0, iniPath.c_str());

	while(1){
		if( ::WaitForSingleObject(sys->epgCapStopEvent, wait) != WAIT_TIMEOUT ){
			//キャンセルされた
			OutputDebugString(L"EpgCapThread::Canceled");
			sys->epgSt_err = ST_CANCEL;
			sys->tsOut.StopSaveEPG(FALSE);
			break;
		}
		if( chkNext == TRUE ){
			if( sys->tsOut.IsChChanging(NULL) == TRUE ){
				Sleep(200);
				continue;
			}
			DWORD space = 0;
			DWORD ch = 0;
			sys->chUtil.GetCh(sys->epgCapChList[chkCount].ONID, sys->epgCapChList[chkCount].TSID, space, ch);
			sys->_SetCh(space, ch);
			startTime = GetTimeCount();
			chkNext = FALSE;
			startCap = FALSE;
			wait = 1000;

			TCHAR debug[MAX_PATH];
			wsprintf(debug, _T("EpgCapThread::Check SID = %d"), sys->epgCapChList[chkCount].SID);
			OutputDebugString(debug);
			if( sys->epgCapChList[chkCount].ONID == 4 ){
				OutputDebugString(L"EpgCapThread::BS Channel");
				chkBS = TRUE;
			}else if( sys->epgCapChList[chkCount].ONID == 6 ){
				OutputDebugString(L"EpgCapThread::CS1 Channel");
				chkCS1 = TRUE;
			}else if( sys->epgCapChList[chkCount].ONID == 7 ){
				OutputDebugString(L"EpgCapThread::CS2 Channel");
				chkCS2 = TRUE;
			}
			sys->epgSt_ch = sys->epgCapChList[chkCount];
		}else{
			BOOL chChgErr = FALSE;
			if( sys->tsOut.IsChChanging(&chChgErr) == TRUE ){
				if( startTime + chkWait < GetTimeCount() ){
					//チャンネル切り替えに10秒以上かかってるので無信号と判断
					OutputDebugString(L"EpgCapThread::No signal");
					chkNext = TRUE;
				}
			}else{
				if( (startTime + chkWait + timeOut*60 < GetTimeCount()) || chChgErr == TRUE){
					//15分以上かかっているなら停止
					OutputDebugString(L"EpgCapThread::Time out");
					sys->tsOut.StopSaveEPG(saveTimeOut);
					chkNext = TRUE;
					wait = 0;
					_OutputDebugString(L"++%d分でEPG取得完了せず or Ch変更でエラー", timeOut);
				}else if(startTime + chkWait < GetTimeCount() ){
					//切り替えから15秒以上過ぎているので取得処理
					if( startCap == FALSE ){
						//取得開始
						startCap = TRUE;
						wstring epgDataPath = L"";
						sys->GetEpgDataFilePath(sys->epgCapChList[chkCount].ONID, sys->epgCapChList[chkCount].TSID, epgDataPath);
						sys->tsOut.StartSaveEPG(epgDataPath);
						sys->tsOut.ClearSectionStatus();
						wait = 60*1000;
					}else{
						//蓄積状態チェック
						BOOL leitFlag = sys->chUtil.IsPartial(sys->epgCapChList[chkCount].ONID, sys->epgCapChList[chkCount].TSID, sys->epgCapChList[chkCount].SID);
						EPG_SECTION_STATUS status = sys->tsOut.GetSectionStatus(leitFlag);
						if( sys->epgCapChList[chkCount].ONID == 4 && sys->BSBasic == TRUE ){
							if( status == EpgBasicAll || status == EpgHEITAll ){
								chkNext = TRUE;
							}
						}else if( sys->epgCapChList[chkCount].ONID == 6 && sys->CS1Basic == TRUE ){
							if( status == EpgBasicAll || status == EpgHEITAll ){
								chkNext = TRUE;
							}
						}else if( sys->epgCapChList[chkCount].ONID == 7 && sys->CS2Basic == TRUE ){
							if( status == EpgBasicAll || status == EpgHEITAll ){
								chkNext = TRUE;
							}
						}else{
							if( leitFlag == FALSE && status == EpgHEITAll ){
								chkNext = TRUE;
							}else if( leitFlag == TRUE && status == EpgLEITAll ){
								chkNext = TRUE;
							}
						}
						if( chkNext == TRUE ){
							sys->tsOut.StopSaveEPG(TRUE);
							wait = 0;
						}else{
							wait = 10*1000;
						}
					}
				}
			}
			if( chkNext == TRUE ){
				//次のチャンネルへ
				chkCount++;
				if( sys->epgCapChList.size() <= chkCount ){
					//全部チェック終わったので終了
					sys->epgSt_err = ST_COMPLETE;
					return 0;
				}
				//BS 1チャンネルのみ?
				if( sys->epgCapChList[chkCount].ONID == 4 && sys->BSBasic == TRUE && chkBS == TRUE){
					while(chkCount<(DWORD)sys->epgCapChList.size()){
						if( sys->epgCapChList[chkCount].ONID != 4 ){
							OutputDebugString(L"EpgCapThread::BS yet checked Basic");
							break;
						}
						chkCount++;
						if( sys->epgCapChList.size() <= chkCount ){
							//全部チェック終わったので終了
							sys->epgSt_err = ST_COMPLETE;
							return 0;
						}
					}
				}
				//CS1 1チャンネルのみ?
				if( sys->epgCapChList[chkCount].ONID == 6 && sys->CS1Basic == TRUE && chkCS1 == TRUE ){
					while(chkCount<(DWORD)sys->epgCapChList.size()){
						if( sys->epgCapChList[chkCount].ONID != 6 ){
							OutputDebugString(L"EpgCapThread::CS1 yet checked Basic");
							break;
						}
						chkCount++;
						if( sys->epgCapChList.size() <= chkCount ){
							//全部チェック終わったので終了
							sys->epgSt_err = ST_COMPLETE;
							return 0;
						}
					}
				}
				//CS2 1チャンネルのみ?
				if( sys->epgCapChList[chkCount].ONID == 7 && sys->CS2Basic == TRUE && chkCS2 == TRUE ){
					while(chkCount<(DWORD)sys->epgCapChList.size()){
						if( sys->epgCapChList[chkCount].ONID != 7 ){
							OutputDebugString(L"EpgCapThread::CS2 yet checked Basic");
							break;
						}
						chkCount++;
						if( sys->epgCapChList.size() <= chkCount ){
							//全部チェック終わったので終了
							sys->epgSt_err = ST_COMPLETE;
							return 0;
						}
					}
				}
			}
		}
	}
	return 0;
}
コード例 #14
0
ファイル: BonCtrl.cpp プロジェクト: Velmy/EDCB
UINT WINAPI CBonCtrl::ChScanThread(LPVOID param)
{
	CBonCtrl* sys = (CBonCtrl*)param;

	sys->chUtil.Clear();

	wstring chSet4 = sys->bonUtil.GetChSet4Path();
	wstring chSet5 = sys->bonUtil.GetChSet5Path();

	vector<CHK_CH_INFO> chkList;
	map<DWORD, BON_SPACE_INFO> spaceMap;
	if( sys->bonUtil.GetOriginalChList(&spaceMap) != NO_ERR ){
		sys->chSt_err = ST_COMPLETE;
		sys->chUtil.SaveChSet(chSet4, chSet5);
		return 0;
	}
	map<DWORD, BON_SPACE_INFO>::iterator itrSpace;
	for( itrSpace = spaceMap.begin(); itrSpace != spaceMap.end(); itrSpace++ ){
		sys->chSt_totalNum += (DWORD)itrSpace->second.chMap.size();
		map<DWORD, BON_CH_INFO>::iterator itrCh;
		for( itrCh = itrSpace->second.chMap.begin(); itrCh != itrSpace->second.chMap.end(); itrCh++ ){
			CHK_CH_INFO item;
			item.space = itrSpace->second.space;
			item.spaceName = itrSpace->second.spaceName;
			item.ch = itrCh->second.ch;
			item.chName = itrCh->second.chName;
			chkList.push_back(item);
		}
	}

	if( sys->chSt_totalNum == 0 ){
		sys->chSt_err = ST_COMPLETE;
		sys->chUtil.SaveChSet(chSet4, chSet5);
		return 0;
	}

	wstring folderPath;
	GetModuleFolderPath( folderPath );
	wstring iniPath = folderPath;
	iniPath += L"\\BonCtrl.ini";

	DWORD chChgTimeOut = GetPrivateProfileInt(L"CHSCAN", L"ChChgTimeOut", 9, iniPath.c_str());
	DWORD serviceChkTimeOut = GetPrivateProfileInt(L"CHSCAN", L"ServiceChkTimeOut", 8, iniPath.c_str());


	DWORD wait = 0;
	BOOL chkNext = TRUE;
	LONGLONG startTime = 0;
	DWORD chkWait = 0;
	DWORD chkCount = 0;
	BOOL firstChg = FALSE;

	while(1){
		if( ::WaitForSingleObject(sys->chScanStopEvent, wait) != WAIT_TIMEOUT ){
			//キャンセルされた
			sys->chSt_err = ST_CANCEL;
			break;
		}
		if( chkNext == TRUE ){
			sys->chSt_space = chkList[chkCount].space;
			sys->chSt_ch = chkList[chkCount].ch;
			sys->chSt_chName = chkList[chkCount].chName;
			sys->_SetCh(chkList[chkCount].space, chkList[chkCount].ch, TRUE);
			if( firstChg == FALSE ){
				firstChg = TRUE;
				sys->tsOut.ResetChChange();
			}
			startTime = GetTimeCount();
			chkNext = FALSE;
			wait = 1000;
			chkWait = chChgTimeOut;
		}else{
			BOOL chChgErr = FALSE;
			if( sys->tsOut.IsChChanging(&chChgErr) == TRUE ){
				if( startTime + chkWait < GetTimeCount() ){
					//チャンネル切り替えに8秒以上かかってるので無信号と判断
					OutputDebugString(L"★AutoScan Ch Change timeout\r\n");
					chkNext = TRUE;
				}
			}else{
				if( startTime + chkWait+serviceChkTimeOut < GetTimeCount() || chChgErr == TRUE){
					//チャンネル切り替え成功したけどサービス一覧とれないので無信号と判断
					OutputDebugString(L"★AutoScan GetService timeout\r\n");
					chkNext = TRUE;
				}else{
					//サービス一覧の取得を行う
					DWORD serviceListSize;
					SERVICE_INFO* serviceList;
					if( sys->tsOut.GetServiceListActual(&serviceListSize, &serviceList) == NO_ERR ){
						if( serviceListSize > 0 ){
							//一覧の取得ができた
							for( DWORD i=0 ;i<serviceListSize; i++ ){
								if( serviceList[i].extInfo != NULL ){
									if( serviceList[i].extInfo->service_name != NULL ){
										if( wcslen(serviceList[i].extInfo->service_name) > 0 ){
											sys->chUtil.AddServiceInfo(chkList[chkCount].space, chkList[chkCount].ch, chkList[chkCount].chName, &(serviceList[i]));
										}
									}
								}
							}
							chkNext = TRUE;
						}
					}
				}
			}
			if( chkNext == TRUE ){
				//次のチャンネルへ
				chkCount++;
				sys->chSt_chkNum++;
				if( sys->chSt_totalNum <= chkCount ){
					//全部チェック終わったので終了
					sys->chSt_err = ST_COMPLETE;
					sys->chUtil.SaveChSet(chSet4, chSet5);
					break;
				}
			}
		}
	}

	sys->chUtil.LoadChSet(chSet4, chSet5);

	return 0;
}
コード例 #15
0
ファイル: TunerBankCtrl.cpp プロジェクト: xceza7/EDCB
bool CTunerBankCtrl::RecStart(const TUNER_RESERVE& reserve, __int64 now) const
{
	if( this->hTunerProcess == NULL ){
		return false;
	}
	if( reserve.recMode == RECMODE_VIEW ){
		return true;
	}
	CSendCtrlCmd ctrlCmd;
	ctrlCmd.SetPipeSetting(CMD2_VIEW_CTRL_WAIT_CONNECT, CMD2_VIEW_CTRL_PIPE, this->tunerPid);
	bool isMainCtrl = true;
	for( int i = 0; i < 2; i++ ){
		if( reserve.ctrlID[i] != 0 ){
			SET_CTRL_REC_PARAM param;
			param.ctrlID = reserve.ctrlID[i];
			//saveFolder[].recFileNameが空でない限りこのフィールドが利用されることはない
			param.fileName = L"padding.ts";
			//同時出力用ファイル名
			param.saveFolder = i == 0 ? reserve.recFolder : reserve.partialRecFolder;
			if( param.saveFolder.empty() ){
				param.saveFolder.resize(1);
				wstring commonIniPath;
				GetCommonIniPath(commonIniPath);
				GetRecFolderPath(param.saveFolder[0].recFolder);
				param.saveFolder[0].writePlugIn = GetPrivateProfileToString(L"SET", L"RecWritePlugIn0", L"", commonIniPath.c_str());
				param.saveFolder[0].recNamePlugIn = this->recNamePlugInFileName;
			}else{
				for( size_t j = 0; j < param.saveFolder.size(); j++ ){
					if( CompareNoCase(param.saveFolder[j].recFolder, L"!Default") == 0 ){
						//注意: この置換は原作にはない
						GetRecFolderPath(param.saveFolder[j].recFolder);
					}
					if( param.saveFolder[j].recNamePlugIn.empty() ){
						param.saveFolder[j].recNamePlugIn = this->recNamePlugInFileName;
					}
				}
			}
			//recNamePlugInを展開して実ファイル名をセット
			for( size_t j = 0; j < param.saveFolder.size(); j++ ){
				param.saveFolder[j].recFileName.clear();
				if( param.saveFolder[j].recNamePlugIn.empty() == false ){
					WORD sid = reserve.sid;
					WORD eid = reserve.eid;
					wstring stationName = reserve.stationName;
					if( i != 0 ){
						FindPartialService(reserve.onid, reserve.tsid, reserve.sid, &sid, &stationName);
						eid = 0xFFFF;
					}
					wstring plugInPath;
					GetModuleFolderPath(plugInPath);
					plugInPath += L"\\RecName\\";
					{
						PLUGIN_RESERVE_INFO info;
						ConvertSystemTime(reserve.startTime, &info.startTime);
						info.durationSec = reserve.durationSecond;
						wcscpy_s(info.eventName, reserve.title.c_str());
						info.ONID = reserve.onid;
						info.TSID = reserve.tsid;
						info.SID = sid;
						info.EventID = eid;
						wcscpy_s(info.serviceName, stationName.c_str());
						wcscpy_s(info.bonDriverName, this->bonFileName.c_str());
						info.bonDriverID = this->tunerID >> 16;
						info.tunerID = this->tunerID & 0xFFFF;
						EPG_EVENT_INFO* epgInfo = NULL;
						if( info.EventID != 0xFFFF ){
							EPGDB_EVENT_INFO epgDBInfo;
							if( this->epgDBManager.SearchEpg(info.ONID, info.TSID, info.SID, info.EventID, &epgDBInfo) != FALSE ){
								epgInfo = new EPG_EVENT_INFO;
								CopyEpgInfo(epgInfo, &epgDBInfo);
							}
						}
						info.reserveID = reserve.reserveID;
						info.epgInfo = epgInfo;
						info.sizeOfStruct = 0;
						WCHAR name[512];
						DWORD size = 512;
						if( CReNamePlugInUtil::ConvertRecName3(&info, param.saveFolder[j].recNamePlugIn.c_str(), plugInPath.c_str(), name, &size) ){
							param.saveFolder[j].recFileName = name;
							CheckFileName(param.saveFolder[j].recFileName, this->recNameNoChkYen);
						}
						delete epgInfo;
					}
					param.saveFolder[j].recNamePlugIn.clear();
				}
				//実ファイル名は空にしない
				if( param.saveFolder[j].recFileName.empty() ){
					SYSTEMTIME st;
					ConvertSystemTime(max(reserve.startTime, now), &st);
					Format(param.saveFolder[j].recFileName, L"%04d%02d%02d%02d%02d%02X%02X%02d-%s.ts",
					       st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute,
					       this->tunerID >> 16, this->tunerID & 0xFFFF, param.ctrlID, reserve.title.c_str());
					CheckFileName(param.saveFolder[j].recFileName);
				}
			}
コード例 #16
0
ファイル: BonCtrl.cpp プロジェクト: PyYoshi/EDCB
UINT WINAPI CBonCtrl::EpgCapThread(LPVOID param)
{
	CBonCtrl* sys = (CBonCtrl*)param;

	BOOL chkNext = TRUE;
	BOOL startCap = FALSE;
	DWORD wait = 0;
	DWORD startTime = 0;
	DWORD chkCount = 0;
	DWORD chkWait = 8;

	BOOL chkBS = FALSE;
	BOOL chkCS1 = FALSE;
	BOOL chkCS2 = FALSE;

	wstring folderPath;
	GetModuleFolderPath( folderPath );
	wstring iniPath = folderPath;
	iniPath += L"\\BonCtrl.ini";

	DWORD timeOut = GetPrivateProfileInt(L"EPGCAP", L"EpgCapTimeOut", 15, iniPath.c_str());
	BOOL saveTimeOut = GetPrivateProfileInt(L"EPGCAP", L"EpgCapSaveTimeOut", 0, iniPath.c_str());

	//Common.iniは一般に外部プロセスが変更する可能性のある(はずの)ものなので、利用の直前にチェックする
	wstring commonIniPath;
	GetCommonIniPath(commonIniPath);
	BOOL BSBasic = GetPrivateProfileInt(L"SET", L"BSBasicOnly", 1, commonIniPath.c_str());
	BOOL CS1Basic = GetPrivateProfileInt(L"SET", L"CS1BasicOnly", 1, commonIniPath.c_str());
	BOOL CS2Basic = GetPrivateProfileInt(L"SET", L"CS2BasicOnly", 1, commonIniPath.c_str());

	while(1){
		if( ::WaitForSingleObject(sys->epgCapStopEvent, wait) != WAIT_TIMEOUT ){
			//キャンセルされた
			sys->epgSt_err = ST_CANCEL;
			sys->tsOut.StopSaveEPG(FALSE);
			break;
		}
		if( chkNext == TRUE ){
			if( sys->tsOut.IsChChanging(NULL) == TRUE ){
				Sleep(200);
				continue;
			}
			DWORD space = 0;
			DWORD ch = 0;
			sys->chUtil.GetCh(sys->epgCapChList[chkCount].ONID, sys->epgCapChList[chkCount].TSID, space, ch);
			sys->_SetCh(space, ch);
			startTime = GetTickCount();
			chkNext = FALSE;
			startCap = FALSE;
			wait = 1000;
			if( sys->epgCapChList[chkCount].ONID == 4 ){
				chkBS = TRUE;
			}else if( sys->epgCapChList[chkCount].ONID == 6 ){
				chkCS1 = TRUE;
			}else if( sys->epgCapChList[chkCount].ONID == 7 ){
				chkCS2 = TRUE;
			}
			sys->epgSt_ch = sys->epgCapChList[chkCount];
		}else{
			BOOL chChgErr = FALSE;
			if( sys->tsOut.IsChChanging(&chChgErr) == TRUE ){
				if( GetTickCount() - startTime > chkWait * 1000 ){
					//チャンネル切り替えに10秒以上かかってるので無信号と判断
					chkNext = TRUE;
				}
			}else{
				if( GetTickCount() - startTime > (chkWait + timeOut * 60) * 1000 || chChgErr == TRUE){
					//15分以上かかっているなら停止
					sys->tsOut.StopSaveEPG(saveTimeOut);
					chkNext = TRUE;
					wait = 0;
					_OutputDebugString(L"++%d分でEPG取得完了せず or Ch変更でエラー", timeOut);
				}else if( GetTickCount() - startTime > chkWait * 1000 ){
					//切り替えから15秒以上過ぎているので取得処理
					if( startCap == FALSE ){
						//取得開始
						startCap = TRUE;
						wstring epgDataPath = L"";
						sys->GetEpgDataFilePath(sys->epgCapChList[chkCount].ONID, sys->epgCapChList[chkCount].TSID, epgDataPath, BSBasic, CS1Basic, CS2Basic);
						sys->tsOut.StartSaveEPG(epgDataPath);
						sys->tsOut.ClearSectionStatus();
						wait = 60*1000;
					}else{
						//蓄積状態チェック
						BOOL leitFlag = sys->chUtil.IsPartial(sys->epgCapChList[chkCount].ONID, sys->epgCapChList[chkCount].TSID, sys->epgCapChList[chkCount].SID);
						EPG_SECTION_STATUS status = sys->tsOut.GetSectionStatus(leitFlag);
						if( sys->epgCapChList[chkCount].ONID == 4 && BSBasic == TRUE ){
							if( status == EpgBasicAll || status == EpgHEITAll ){
								chkNext = TRUE;
							}
						}else if( sys->epgCapChList[chkCount].ONID == 6 && CS1Basic == TRUE ){
							if( status == EpgBasicAll || status == EpgHEITAll ){
								chkNext = TRUE;
							}
						}else if( sys->epgCapChList[chkCount].ONID == 7 && CS2Basic == TRUE ){
							if( status == EpgBasicAll || status == EpgHEITAll ){
								chkNext = TRUE;
							}
						}else{
							if( leitFlag == FALSE && status == EpgHEITAll ){
								chkNext = TRUE;
							}else if( leitFlag == TRUE && status == EpgLEITAll ){
								chkNext = TRUE;
							}
						}
						if( chkNext == TRUE ){
							sys->tsOut.StopSaveEPG(TRUE);
							wait = 0;
						}else{
							wait = 10*1000;
						}
					}
				}
			}
			if( chkNext == TRUE ){
				//次のチャンネルへ
				chkCount++;
				if( sys->epgCapChList.size() <= chkCount ){
					//全部チェック終わったので終了
					sys->epgSt_err = ST_COMPLETE;
					return 0;
				}
				//BS 1チャンネルのみ?
				if( sys->epgCapChList[chkCount].ONID == 4 && BSBasic == TRUE && chkBS == TRUE){
					while(chkCount<(DWORD)sys->epgCapChList.size()){
						if( sys->epgCapChList[chkCount].ONID != 4 ){
							break;
						}
						chkCount++;
						if( sys->epgCapChList.size() <= chkCount ){
							//全部チェック終わったので終了
							sys->epgSt_err = ST_COMPLETE;
							return 0;
						}
					}
				}
				//CS1 1チャンネルのみ?
				if( sys->epgCapChList[chkCount].ONID == 6 && CS1Basic == TRUE && chkCS1 == TRUE ){
					while(chkCount<(DWORD)sys->epgCapChList.size()){
						if( sys->epgCapChList[chkCount].ONID != 6 ){
							break;
						}
						chkCount++;
						if( sys->epgCapChList.size() <= chkCount ){
							//全部チェック終わったので終了
							sys->epgSt_err = ST_COMPLETE;
							return 0;
						}
					}
				}
				//CS2 1チャンネルのみ?
				if( sys->epgCapChList[chkCount].ONID == 7 && CS2Basic == TRUE && chkCS2 == TRUE ){
					while(chkCount<(DWORD)sys->epgCapChList.size()){
						if( sys->epgCapChList[chkCount].ONID != 7 ){
							break;
						}
						chkCount++;
						if( sys->epgCapChList.size() <= chkCount ){
							//全部チェック終わったので終了
							sys->epgSt_err = ST_COMPLETE;
							return 0;
						}
					}
				}
			}
		}
	}
	return 0;
}
コード例 #17
0
ファイル: BatManager.cpp プロジェクト: HK323232/EDCB
BOOL CBatManager::CreateBatFile(BAT_WORK_INFO* info, wstring batSrcFilePath, wstring& batFilePath )
{
	if( info == NULL ){
		return FALSE;
	}
	GetModuleFolderPath(batFilePath);
	batFilePath+=L"\\EpgTimer_Bon_RecEnd.bat";

	//バッチの作成
	HANDLE hRead = CreateFileW( batSrcFilePath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
	if( hRead == INVALID_HANDLE_VALUE ){
		return FALSE;
	}
	HANDLE hWrite = _CreateFile2( batFilePath.c_str(), GENERIC_WRITE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
	if( hWrite == INVALID_HANDLE_VALUE ){
		CloseHandle(hRead);
		return FALSE;
	}

	DWORD dwRead=0;
	DWORD dwL = GetFileSize(hRead, NULL);
	char* pBuff = new char[dwL+1];
	ZeroMemory(pBuff, dwL+1);
	ReadFile(hRead, pBuff, dwL, &dwRead, NULL );
	CloseHandle(hRead);

	string strRead = "";
	strRead = pBuff;
	SAFE_DELETE_ARRAY(pBuff);

	string strRecFilePath="";
	string strFolderPath="";
	string strFileName="";
	string strTitle="";
	string strSDYYYY="";
	string strSDYY="";
	string strSDMM="";
	string strSDM="";
	string strSDDD="";
	string strSDD="";
	string strSDW="";
	string strSTHH="";
	string strSTH="";
	string strSTMM="";
	string strSTM="";
	string strSTSS="";
	string strSTS="";
	string strEDYYYY="";
	string strEDYY="";
	string strEDMM="";
	string strEDM="";
	string strEDDD="";
	string strEDD="";
	string strEDW="";
	string strETHH="";
	string strETH="";
	string strETMM="";
	string strETM="";
	string strETSS="";
	string strETS="";
	string strONID10="";
	string strTSID10="";
	string strSID10="";
	string strEID10="";
	string strONID16="";
	string strTSID16="";
	string strSID16="";
	string strEID16="";
	string strServiceName="";
	string strSDYYYY28="";
	string strSDYY28="";
	string strSDMM28="";
	string strSDM28="";
	string strSDDD28="";
	string strSDD28="";
	string strSDW28="";
	string strSTHH28="";
	string strSTH28="";
	string strEDYYYY28="";
	string strEDYY28="";
	string strEDMM28="";
	string strEDM28="";
	string strEDDD28="";
	string strEDD28="";
	string strEDW28="";
	string strETHH28="";
	string strETH28="";
	string strDUH="";
	string strDUHH="";
	string strDUM="";
	string strDUMM="";
	string strDUS="";
	string strDUSS="";
	string strTitle2="";
	string strDrops="";
	string strScrambles="";
	string strResult="";
	string strTitleF="";
	string strTitle2F="";
	string strAddKey="";

	WtoA(info->recFileInfo.recFilePath, strRecFilePath);

	WCHAR szDrive[_MAX_DRIVE];
	WCHAR szDir[_MAX_DIR];
	WCHAR szFname[_MAX_FNAME];
	WCHAR szExt[_MAX_EXT];
	WCHAR szPath[_MAX_PATH] = L"";
	_tsplitpath_s( info->recFileInfo.recFilePath.c_str(), szDrive, _MAX_DRIVE, szDir, _MAX_DIR, szFname, _MAX_FNAME, szExt, _MAX_EXT );
	_tmakepath_s( szPath, _MAX_PATH, szDrive, szDir, NULL, NULL );
	wstring strFolder;
	strFolder = szPath;
	ChkFolderPath(strFolder);

	WtoA(szFname, strFileName);
	WtoA(strFolder, strFolderPath);
	WtoA(info->recFileInfo.title, strTitle);

	Format(strSDYYYY, "%04d", info->recFileInfo.startTime.wYear);
	Format(strSDYY, "%02d", info->recFileInfo.startTime.wYear%100);
	Format(strSDMM, "%02d", info->recFileInfo.startTime.wMonth);
	Format(strSDM, "%d", info->recFileInfo.startTime.wMonth);
	Format(strSDDD, "%02d", info->recFileInfo.startTime.wDay);
	Format(strSDD, "%d", info->recFileInfo.startTime.wDay);
	GetDayOfWeekString2(info->recFileInfo.startTime, strSDW);
	Format(strSTHH, "%02d", info->recFileInfo.startTime.wHour);
	Format(strSTH, "%d", info->recFileInfo.startTime.wHour);
	Format(strSTMM, "%02d", info->recFileInfo.startTime.wMinute);
	Format(strSTM, "%d", info->recFileInfo.startTime.wMinute);
	Format(strSTSS, "%02d", info->recFileInfo.startTime.wSecond);
	Format(strSTS, "%d", info->recFileInfo.startTime.wSecond);

	SYSTEMTIME t28TimeS;
	if( 0 <= info->recFileInfo.startTime.wHour && info->recFileInfo.startTime.wHour < 4 ){
		GetSumTime(info->recFileInfo.startTime, -24*60*60, &t28TimeS);
		GetDayOfWeekString2(t28TimeS, strSDW28);
		t28TimeS.wHour+=24;
	}else{
		t28TimeS = info->recFileInfo.startTime;
		GetDayOfWeekString2(t28TimeS, strSDW28);
	}

	Format(strSDYYYY28, "%04d", t28TimeS.wYear);
	Format(strSDYY28, "%02d", t28TimeS.wYear%100);
	Format(strSDMM28, "%02d", t28TimeS.wMonth);
	Format(strSDM28, "%d", t28TimeS.wMonth);
	Format(strSDDD28, "%02d", t28TimeS.wDay);
	Format(strSDD28, "%d", t28TimeS.wDay);
	Format(strSTHH28, "%02d", t28TimeS.wHour);
	Format(strSTH28, "%d", t28TimeS.wHour);

	SYSTEMTIME tEnd;
	GetI64Time(info->recFileInfo.startTime, info->recFileInfo.durationSecond, NULL, NULL, &tEnd);

	Format(strEDYYYY, "%04d", tEnd.wYear);
	Format(strEDYY, "%02d", tEnd.wYear%100);
	Format(strEDMM, "%02d", tEnd.wMonth);
	Format(strEDM, "%d", tEnd.wMonth);
	Format(strEDDD, "%02d", tEnd.wDay);
	Format(strEDD, "%d", tEnd.wDay);
	GetDayOfWeekString2(tEnd, strEDW);
	Format(strETHH, "%02d", tEnd.wHour);
	Format(strETH, "%d", tEnd.wHour);
	Format(strETMM, "%02d", tEnd.wMinute);
	Format(strETM, "%d", tEnd.wMinute);
	Format(strETSS, "%02d", tEnd.wSecond);
	Format(strETS, "%d", tEnd.wSecond);

	SYSTEMTIME t28TimeE;
	if( 0 <= tEnd.wHour && tEnd.wHour < 4 ){
		GetSumTime(tEnd, -24*60*60, &t28TimeE);
		GetDayOfWeekString2(t28TimeE, strEDW28);
		t28TimeE.wHour+=24;
	}else{
		t28TimeE = tEnd;
		GetDayOfWeekString2(tEnd, strEDW28);
	}

	Format(strEDYYYY28, "%04d", t28TimeE.wYear);
	Format(strEDYY28, "%02d", t28TimeE.wYear%100);
	Format(strEDMM28, "%02d", t28TimeE.wMonth);
	Format(strEDM28, "%d", t28TimeE.wMonth);
	Format(strEDDD28, "%02d", t28TimeE.wDay);
	Format(strEDD28, "%d", t28TimeE.wDay);
	Format(strETHH28, "%02d", t28TimeE.wHour);
	Format(strETH28, "%d", t28TimeE.wHour);

	Format(strONID10, "%d", info->recFileInfo.originalNetworkID);
	Format(strTSID10, "%d", info->recFileInfo.transportStreamID);
	Format(strSID10, "%d", info->recFileInfo.serviceID);
	Format(strEID10, "%d", info->recFileInfo.eventID);
	Format(strONID16, "%04X", info->recFileInfo.originalNetworkID);
	Format(strTSID16, "%04X", info->recFileInfo.transportStreamID);
	Format(strSID16, "%04X", info->recFileInfo.serviceID);
	Format(strEID16, "%04X", info->recFileInfo.eventID);

	WtoA(info->recFileInfo.serviceName, strServiceName);

	Format(strDUHH, "%02d", info->recFileInfo.durationSecond/(60*60));
	Format(strDUH, "%d", info->recFileInfo.durationSecond/(60*60));
	Format(strDUMM, "%02d", (info->recFileInfo.durationSecond%(60*60))/60);
	Format(strDUM, "%d", (info->recFileInfo.durationSecond%(60*60))/60);
	Format(strDUSS, "%02d", info->recFileInfo.durationSecond%60);
	Format(strDUS, "%d", info->recFileInfo.durationSecond%60);

	wstring strTemp = info->recFileInfo.title;
	while( (strTemp.find(L"[") != string::npos) && (strTemp.find(L"]") != string::npos) ){
		wstring strSep1=L"";
		wstring strSep2=L"";
		Separate(strTemp, L"[", strSep1, strTemp);
		Separate(strTemp, L"]", strSep2, strTemp);
		strSep1 += strTemp;
		strTemp = strSep1;
	}
	WtoA(strTemp, strTitle2);

	Format(strDrops, "%I64d", info->recFileInfo.drops);
	Format(strScrambles, "%I64d", info->recFileInfo.scrambles);
	WtoA(info->recFileInfo.comment, strResult);

	CheckFileName(strTitleF);
	CheckFileName(strTemp);
	WtoA(strTemp, strTitle2F);
	strTemp = info->recFileInfo.title;
	CheckFileName(strTemp);
	WtoA(strTemp, strTitleF);

	if( info->reserveInfo.comment.find(L"EPG自動予約(") != string::npos ){
		WtoA(info->reserveInfo.comment, strAddKey);
		Replace(strAddKey, "EPG自動予約(", "");
		strAddKey.erase(strAddKey.length()-1, 1);
	}

	Replace(strRead, "$FilePath$", strRecFilePath);
	Replace(strRead, "$FolderPath$", strFolderPath);
	Replace(strRead, "$FileName$", strFileName);
	Replace(strRead, "$Title$", strTitle);
	Replace(strRead, "$SDYYYY$", strSDYYYY);
	Replace(strRead, "$SDYY$", strSDYY);
	Replace(strRead, "$SDMM$", strSDMM);
	Replace(strRead, "$SDM$", strSDM);
	Replace(strRead, "$SDDD$", strSDDD);
	Replace(strRead, "$SDD$", strSDD);
	Replace(strRead, "$SDW$", strSDW);
	Replace(strRead, "$STHH$", strSTHH);
	Replace(strRead, "$STH$", strSTH);
	Replace(strRead, "$STMM$", strSTMM);
	Replace(strRead, "$STM$", strSTM);
	Replace(strRead, "$STSS$", strSTSS);
	Replace(strRead, "$STS$", strSTS);
	Replace(strRead, "$EDYYYY$", strEDYYYY);
	Replace(strRead, "$EDYY$", strEDYY);
	Replace(strRead, "$EDMM$", strEDMM);
	Replace(strRead, "$EDM$", strEDM);
	Replace(strRead, "$EDDD$", strEDDD);
	Replace(strRead, "$EDD$", strEDD);
	Replace(strRead, "$EDW$", strEDW);
	Replace(strRead, "$ETHH$", strETHH);
	Replace(strRead, "$ETH$", strETH);
	Replace(strRead, "$ETMM$", strETMM);
	Replace(strRead, "$ETM$", strETM);
	Replace(strRead, "$ETSS$", strETSS);
	Replace(strRead, "$ETS$", strETS);
	Replace(strRead, "$ONID10$", strONID10);
	Replace(strRead, "$TSID10$", strTSID10);
	Replace(strRead, "$SID10$", strSID10);
	Replace(strRead, "$EID10$", strEID10);
	Replace(strRead, "$ONID16$", strONID16);
	Replace(strRead, "$TSID16$", strTSID16);
	Replace(strRead, "$SID16$", strSID16);
	Replace(strRead, "$EID16$", strEID16);
	Replace(strRead, "$ServiceName$", strServiceName);
	Replace(strRead, "$SDYYYY28$", strSDYYYY28);
	Replace(strRead, "$SDYY28$", strSDYY28);
	Replace(strRead, "$SDMM28$", strSDMM28);
	Replace(strRead, "$SDM28$", strSDM28);
	Replace(strRead, "$SDDD28$", strSDDD28);
	Replace(strRead, "$SDD28$", strSDD28);
	Replace(strRead, "$SDW28$", strSDW28);
	Replace(strRead, "$STHH28$", strSTHH28);
	Replace(strRead, "$STH28$", strSTH28);
	Replace(strRead, "$EDYYYY28$", strEDYYYY28);
	Replace(strRead, "$EDYY28$", strEDYY28);
	Replace(strRead, "$EDMM28$", strEDMM28);
	Replace(strRead, "$EDM28$", strEDM28);
	Replace(strRead, "$EDDD28$", strEDDD28);
	Replace(strRead, "$EDD28$", strEDD28);
	Replace(strRead, "$EDW28$", strEDW28);
	Replace(strRead, "$ETHH28$", strETHH28);
	Replace(strRead, "$ETH28$", strETH28);
	Replace(strRead, "$DUHH$", strDUHH);
	Replace(strRead, "$DUH$", strDUH);
	Replace(strRead, "$DUMM$", strDUMM);
	Replace(strRead, "$DUM$", strDUM);
	Replace(strRead, "$DUSS$", strDUSS);
	Replace(strRead, "$DUS$", strDUS);
	Replace(strRead, "$Title2$", strTitle2);
	Replace(strRead, "$Drops$", strDrops);
	Replace(strRead, "$Scrambles$", strScrambles);
	Replace(strRead, "$Result$", strResult);
	Replace(strRead, "$TitleF$", strTitleF);
	Replace(strRead, "$Title2F$", strTitle2F);
	Replace(strRead, "$AddKey$", strAddKey);

	DWORD dwWrite=0;
	WriteFile(hWrite, strRead.c_str(), (DWORD)strRead.length(), &dwWrite, NULL );
	CloseHandle(hWrite);

	return TRUE;
}
コード例 #18
0
void GetDefSettingPath(wstring& strPath)
{
	GetModuleFolderPath(strPath);
	strPath += L"\\Setting";
}
コード例 #19
0
void GetEpgTimerSrvIniPath(wstring& strPath)
{
	GetModuleFolderPath(strPath);
	strPath += L"\\EpgTimerSrv.ini";
}
コード例 #20
0
void GetCommonIniPath(wstring& strPath)
{
	GetModuleFolderPath(strPath);
	strPath += L"\\Common.ini";
}