Esempio n. 1
0
//認証結果の暗証番号を設定する
//内部でGetAuthorizationUrlで取得した値を使用するので、一連の流れで設定する必要あり
//戻り値:
// エラーコード
//引数:
// password		[IN]暗証番号
DWORD CTwitterMain::SetAuthorizationPWD(
	LPCWSTR password
	)
{
	if( Lock() == FALSE ) return ERR_FALSE;
	DWORD ret = NO_ERR;
	CRequestUtil requestUtil;

	wstring requestUrl;
	wstring httpHeader;

	wstring key = CONSUMER_SECRET_KEY;
	key += L"&";
	key += this->authorization_token_secret.c_str();

	requestUtil.CreateAccessToken(CONSUMER_KEY, key, this->authorization_token.c_str(), password, requestUrl, httpHeader);
	ret = SendCmd(&this->httpUtil, FALSE, NW_VERB_POST, requestUrl.c_str(), httpHeader.c_str(), NULL, L"");
	if( ret == NO_ERR ){
		//レスポンス取得して解析
		wstring buff = this->lastResponse;
		Replace(buff, L"oauth_token=", L"");
		Separate(buff, L"&oauth_token_secret=", this->oauth_token, buff);
		Separate(buff, L"&", this->oauth_token_secret, buff);

		WritePrivateProfileString(L"SET", L"token", this->oauth_token.c_str(), this->moduleIniPath.c_str() );
		WritePrivateProfileString(L"SET", L"token_secret", this->oauth_token_secret.c_str(), this->moduleIniPath.c_str() );
	}

	UnLock();
	return ret;
}
Esempio n. 2
0
BOOL CDLNAParseProtocolInfo::Parse1Line(string parseLine, DLNA_PROTOCOL_INFO* info )
{
	if( parseLine.empty() == true || info == NULL ){
		return FALSE;
	}
	string strBuff="";

	Separate( parseLine, "\t", strBuff, parseLine);

	//
	AtoW(strBuff, info->ext);

	Separate( parseLine, "\t", strBuff, parseLine);

	//
	AtoW(strBuff, info->upnpClass);

	Separate( parseLine, "\t", strBuff, parseLine);

	//
	AtoW(strBuff, info->mimeType);

	Separate( parseLine, "\t", strBuff, parseLine);

	//
	AtoW(strBuff, info->info);

	return TRUE;
}
Esempio n. 3
0
void CStreamCtrlDlg::SetNWModeSend()
{
    WCHAR textBuff[512] = L"";
    GetWindowText(GetDlgItem(this->hwnd, IDC_COMBO_IP), textBuff, 512);

    wstring strIP = textBuff;
    wstring ip1;
    wstring ip2;
    wstring ip3;
    wstring ip4;
    Separate(strIP, L".", ip1, strIP);
    Separate(strIP, L".", ip2, strIP);
    Separate(strIP, L".", ip3, ip4);

    nwPlayInfo.ctrlID = this->ctrlID;
    nwPlayInfo.udp = (BYTE)SendMessage(GetDlgItem(this->hwnd, IDC_CHECK_UDP), BM_GETCHECK, 0, 0);
    nwPlayInfo.tcp = (BYTE)SendMessage(GetDlgItem(this->hwnd, IDC_CHECK_TCP), BM_GETCHECK, 0, 0);
    nwPlayInfo.ip = _wtoi(ip1.c_str())<<24 | _wtoi(ip2.c_str())<<16 | _wtoi(ip3.c_str())<<8 | _wtoi(ip4.c_str());
    this->cmd->SendNwPlaySetIP(&nwPlayInfo);

    DWORD udpPort = 0;
    if( nwPlayInfo.udp == 1 ) {
        udpPort = nwPlayInfo.udpPort;
    }
    DWORD tcpPort = 0;
    if( nwPlayInfo.tcp == 1 ) {
        tcpPort = nwPlayInfo.tcpPort;
    }
    PostMessage(this->hwnd, WM_CHG_PORT, udpPort, tcpPort);
}
Esempio n. 4
0
AGDOCTYPE CXMLDlg::GetCurrentDocType(HTREEITEM pItem)
{
	HTREEITEM pChildItem = m_treeOutput.GetChildItem(pItem);
	if (!pChildItem)
	{
		ASSERT(false);
		return DOC_DEFAULT;
	}

	while (pChildItem)
	{
		CString szTitle;
		CString szValue;
		Separate(m_treeOutput.GetItemText(pChildItem), szTitle, szValue);

		if (!szTitle.CompareNoCase(_T("type")))
		{
			return (ConvertType(szValue));
		}

		pChildItem = m_treeOutput.GetNextItem(pChildItem, TVGN_NEXT);
	}

	ASSERT(false);
	return DOC_DEFAULT;
}
Esempio n. 5
0
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;
}
Esempio n. 6
0
void CXMLDlg::GetCurrentObjectSize(HTREEITEM pItem, POINT& Size)
{
	HTREEITEM pChildItem = m_treeOutput.GetChildItem(pItem);
	if (!pChildItem)
	{
		ASSERT(false);
		return;
	}

	while (pChildItem)
	{
		CString szTitle;
		CString szValue;
		Separate(m_treeOutput.GetItemText(pChildItem), szTitle, szValue);

		if (!szTitle.CompareNoCase(_T("dx")))
		{
			Size.x = INCHES(atof(szValue));
		}
		else
		if (!szTitle.CompareNoCase(_T("dy")))
		{
			Size.y = INCHES(atof(szValue));
		}

		pChildItem = m_treeOutput.GetNextItem(pChildItem, TVGN_NEXT);
	}
}
Esempio n. 7
0
bool CXMLDlg::GetCurrentPortrait(HTREEITEM pItem)
{
	HTREEITEM pChildItem = m_treeOutput.GetChildItem(pItem);
	if (!pChildItem)
	{
		ASSERT(false);
		return false;
	}

	while (pChildItem)
	{
		CString szTitle;
		CString szValue;
		Separate(m_treeOutput.GetItemText(pChildItem), szTitle, szValue);

		if (!szTitle.CompareNoCase(_T("orient")))
		{
			return !szValue.CompareNoCase(_T("portrait"));
		}

		pChildItem = m_treeOutput.GetNextItem(pChildItem, TVGN_NEXT);
	}

	ASSERT(false);
	return false;
}
Esempio n. 8
0
void CXMLDlg::GetCurrentObjectRect(HTREEITEM pItem, RECT& Rect)
{
	HTREEITEM pChildItem = m_treeOutput.GetChildItem(pItem);
	if (!pChildItem)
		return;

	while (pChildItem)
	{
		CString szTitle;
		CString szValue;
		Separate(m_treeOutput.GetItemText(pChildItem), szTitle, szValue);

		if (!szTitle.CompareNoCase(_T("x")) )
		{
			Rect.left = INCHES(atof(szValue));
		}
		else
		if (!szTitle.CompareNoCase(_T("y")) )
		{
			Rect.top = INCHES(atof(szValue));
		}
		else
		if (!szTitle.CompareNoCase(_T("dx")) )
		{
			Rect.right = Rect.left + INCHES(atof(szValue));
		}
		else
		if (!szTitle.CompareNoCase(_T("dy")) )
		{
			Rect.bottom = Rect.top + INCHES(atof(szValue));
		}

		pChildItem = m_treeOutput.GetNextItem(pChildItem, TVGN_NEXT);
	}
}
Esempio n. 9
0
void *MemoryAllocator::New (memory_size_t size)
{
	 if (!size) return 0;
	 if (this->Test()) return 0;
	 this->Lock();
	
	 MemoryChunk *chunk = this->PoolFree.GetFirst();
			while (chunk != (MemoryChunk *)0) {
				if (chunk->size >= size) {
					this->PoolFree.Remove(chunk);
					if (chunk->size >= size + sizeof(MemoryChunk) + __m) 
						this->PoolFree + Separate(chunk, size);
					this->PoolInUse + chunk;
					chunk->key = (alloc_addr_t)chunk;
					this->Unlock();
                    this->Success++;
					return (void *)(chunk + 1);
				}
				chunk = chunk->rlink;
			}
	 errno = ENOMEM;
     this->Errors++;
	 this->Unlock();
	 return (void *)0;
}
Esempio n. 10
0
//認証用ログインURLを取得する
//戻り値:
// エラーコード
//引数:
// url			[OUT]認証用ログインURL(次回API呼出時までメモリ確保)
DWORD CTwitterMain::GetAuthorizationUrl(
	WCHAR** url
	)
{
	if( Lock() == FALSE ) return ERR_FALSE;
	SAFE_DELETE_ARRAY(this->authorizationUrl);
	DWORD ret = NO_ERR;

	CRequestUtil requestUtil;

	wstring requestUrl;
	wstring httpHeader;

	CRequestUtil request;
	wstring key = CONSUMER_SECRET_KEY;
	key += L"&";
	requestUtil.CreateRequestToken(CONSUMER_KEY, key, requestUrl, httpHeader);

	ret = SendCmd(&this->httpUtil, FALSE, NW_VERB_POST, requestUrl.c_str(), httpHeader.c_str(), NULL, L"");
	if( ret == NO_ERR ){
		//レスポンス取得して解析
		wstring buff = this->lastResponse;
		Replace(buff, L"oauth_token=", L"");
		Separate(buff, L"&oauth_token_secret=", this->authorization_token, this->authorization_token_secret);

		wstring authUrl;
		request.CreateAuthorizationUrl(this->authorization_token.c_str(), authUrl);
		authorizationUrl = new WCHAR[authUrl.size() + 1];
		wcscpy_s(authorizationUrl, authUrl.size() + 1, authUrl.c_str());
		*url = authorizationUrl;
	}

	UnLock();
	return ret;
}
Esempio n. 11
0
int CDLNADmsContentDB::SearchFilePath(string uri, wstring& filePath)
{
	if( lock.Lock(L"CDLNADmsContentDB::SearchFilePath") == FALSE ){
		return ERR_FALSE;
	}

	int ret = NO_ERR;
	map<wstring, DLNA_DMS_CONTENT_ITEM*>::iterator itr1;
	wstring fileUri;
	wstring objectID;
	wstring buff1;
	wstring buff2;
	wstring tempBuff;

	AtoW(uri, fileUri);
	buff1 = this->rootUri;
	buff1 += L"/";

	//Separate(fileUri, L"?", fileUri, tempBuff);
	Separate(fileUri, buff1, buff2, objectID);

	itr1 = contentList.find(objectID);
	if( itr1 == contentList.end() ){
		ret = ERR_FALSE;
		goto Err_End;
	}

	filePath = itr1->second->info->filePath;

Err_End:
	lock.UnLock();

	return ret;
}
Esempio n. 12
0
// Each different input train configuration to Separate is handled similarly
void SeparateTestHelper(TrainCar* &train1, const std::string &which_test) {
  

  // UNCOMMENT THIS FUNCTION WHEN YOU'RE READY TO TEST SEPARATE

  std::cout << "============================================================================" << std::endl;
  std::cout << "SEPARATE TRAINS " << which_test << std::endl;

  SanityCheck(train1);
  // record the original IDs for later comparison and statistics calculation
  std::vector<int> original = RecordIDs(train1);
  PrintTrain(train1);
  float speed_original = CalculateSpeed(train1);
  
  TrainCar* train2;
  TrainCar* train3;
  Separate(train1, train2, train3);
  assert (train1 == NULL);
  SanityCheck(train2);
  SanityCheck(train3);
  // record the IDs after separation
  std::vector<int> left = RecordIDs(train2);
  std::vector<int> right = RecordIDs(train3);

  // calculate the number of links, unlinks, and train shifts
  // (all of these counts should be kept small to minimize train yard costs
  int num_unlinks, num_links, num_shifts;
  SeparateStatistics(original, left, right, num_unlinks, num_links, num_shifts);
  std::cout << "Separate Statistics: num unlinks = " << num_unlinks;
  std::cout << ", num links = " << num_links;
  std::cout << ", num shifts = " << num_shifts;
  std::cout << "   Total Cost: " << num_unlinks+num_links+num_shifts << std::endl;

  float speed_left = CalculateSpeed(train2);
  float speed_right = CalculateSpeed(train3);
  float left_percent = 100.0 * (speed_original-speed_left) / speed_original;
  float right_percent = 100.0 * (speed_original-speed_right) / speed_original;
  if (speed_left < 0.99*speed_original) {
    assert (speed_right > speed_original);
    std::cout << "left train is " << std::setprecision(1) << std::fixed << left_percent 
              << "% slower than the original and the right train is " << std::setprecision(1) << std::fixed 
              << -right_percent << "% faster than the original." << std::endl;
  } else if (speed_right < 0.99*speed_original) {
    assert (speed_left > speed_original);
    std::cout << "right train is " << std::setprecision(1) << std::fixed << right_percent 
              << "% slower than the original and the left train is " << std::setprecision(1) << std::fixed 
              << -left_percent << "% faster than the original." << std::endl;
  } else {
    std::cout << "  left and right train speeds are equal to the original." << std::endl;
  }


  PrintTrain(train2);
  PrintTrain(train3);
  // cleanup memory usage
  DeleteAllCars(train2);
  DeleteAllCars(train3);
  
}
Esempio n. 13
0
BOOL DLNAParsePublicFolder::Parse1Line(string parseLine, DLNA_PUBLIC_FOLDER_INFO* info )
{
	if( parseLine.empty() == true || info == NULL ){
		return FALSE;
	}
	string strBuff="";

	Separate( parseLine, "\t", strBuff, parseLine);

	//
	AtoW(strBuff, info->virtualPath);

	Separate( parseLine, "\t", strBuff, parseLine);

	//
	AtoW(strBuff, info->folderPath);

	return TRUE;
}
Esempio n. 14
0
BOOL CParseChText5::Parse1Line(string parseLine, CH_DATA5* chInfo )
{
	if( parseLine.empty() == true || chInfo == NULL ){
		return FALSE;
	}
	string strBuff="";

	Separate( parseLine, "\t", strBuff, parseLine);

	//名前
	AtoW(strBuff, chInfo->serviceName);

	Separate( parseLine, "\t", strBuff, parseLine);

	//ts_name or network_name
	AtoW(strBuff, chInfo->networkName);

	Separate( parseLine, "\t", strBuff, parseLine);

	//ONID
	chInfo->originalNetworkID = (WORD)atoi(strBuff.c_str());

	Separate( parseLine, "\t", strBuff, parseLine);

	//TSID
	chInfo->transportStreamID = (WORD)atoi(strBuff.c_str());

	Separate( parseLine, "\t", strBuff, parseLine);

	//SID
	chInfo->serviceID = (WORD)atoi(strBuff.c_str());

	Separate( parseLine, "\t", strBuff, parseLine);

	//Service Type
	chInfo->serviceType = (WORD)atoi(strBuff.c_str());

	Separate( parseLine, "\t", strBuff, parseLine);

	//Partial Flag
	chInfo->partialFlag = (WORD)atoi(strBuff.c_str());

	Separate( parseLine, "\t", strBuff, parseLine);

	//EPG取得対象
	chInfo->epgCapFlag = atoi(strBuff.c_str());

	//検索のデフォルト対象
	chInfo->searchFlag = atoi(parseLine.c_str());

	return TRUE;
}
Esempio n. 15
0
void GameOnKeyCallback(int keypressed)
{
	switch(keypressed)
	{
	case ' ':				GameInit();					break;
	case 13:				Separate();					break;
	case GLUT_KEY_DOWN:		m_xPosition[0].y -= 2.0f;	break;
	case GLUT_KEY_UP:		m_xPosition[0].y += 2.0f;	break;
	case GLUT_KEY_LEFT:		m_xPosition[0].x -= 2.0f;	break;
	case GLUT_KEY_RIGHT:	m_xPosition[0].x += 2.0f;	break;

	}
}
Esempio n. 16
0
char *TKGetNextToken(TokenizerT *tk) {
	//This makes sure there is anything to check in the string to split
    if(tk->delim == strlen(tk->stream)){
        return 0;
    }
    Separate(tk);
    //This checks for multiple delims in a row
    while(tk->curr == tk->delim){
        tk->curr = tk->delim +1;
        Separate(tk);

    }
    //This means there is no more delims left in string
    if(tk->delim == -2){
        return 0;
    }
    
    int start = tk->curr;
    int end = tk->delim;
    int i = 0;
    char token[(end - start) + 1];
    //This takes the segment found in from the separate method and copies only one segment to print.
    for(;start<end;start++){
        token[i] = tk->stream[start];
        i++;
    }
    token[i] = '\0';
    i = 0;
    while(i <=strlen(token)){
        tk->segment[i] = token[i];
        //printf("%c", tk->segment[i]);
        i++;
    }
    tk->curr = tk->delim + 1;
    //printf("%s\n", tk->segment);
    //printf("%s\n", token);
  return tk->segment;
}
Esempio n. 17
0
BOOL CParseSearchChgText::Parse1Line(string parseLine, wstring& oldText, wstring& newText)
{
	if( parseLine.empty() == true ){
		return FALSE;
	}
	string strBuff="";

	Separate( parseLine, "\t", strBuff, parseLine);
	
	AtoW(strBuff, oldText);
	AtoW(parseLine, newText);

	return TRUE;
}
Esempio n. 18
0
static int SepTableCalc()
{
	static int bDone = 0;
	if (bDone) {
		return 0;										// Already done it
	}

	for (int i = 0; i < 256; i++) {
		SepTable[i] = Separate(255 - i);
	}

	bDone = 1;											// done it
	return 0;
}
Esempio n. 19
0
void GameOnKeyCallback(int keypressed)
{
	switch(keypressed)
	{
	case ' ':				GameInit();					break;
	case 13:				Separate();					break;
	case 'P': 
	case 'p':				dbg_pause = !dbg_pause;		break;
	case 'A':
	case 'a':				ToggleRotation();			break;
	case GLUT_KEY_DOWN:		m_xPosition[0].y -= 2.0f;	break;
	case GLUT_KEY_UP:		m_xPosition[0].y += 2.0f;	break;
	case GLUT_KEY_LEFT:		m_xPosition[0].x -= 2.0f;	break;
	case GLUT_KEY_RIGHT:	m_xPosition[0].x += 2.0f;	break;
	}
}
Esempio n. 20
0
DWORD CRestApiManager::AnalyzeCmd(string verb, string url, string param, HTTP_STREAM* sendParam, CEpgDBManager* epgDB, vector<RESERVE_DATA*>* list, CReserveManager* resMng)
{
	DWORD ret = ERR_FALSE;
	string urlParam = "";
	if( url.find("?") != string::npos ){
		Separate(url, "?", url, urlParam);
	}
	if( urlParam.size() > 0 && param.size() > 0){
		urlParam += "&";
		urlParam += param;
	}else if( urlParam.size() == 0 && param.size() > 0){
		urlParam = param;
	}

	OutputDebugStringA(urlParam.c_str());

	if(url.find("/api/EnumService") == 0 ){
		ret = GetEnumService(urlParam, sendParam, epgDB);
	}else
	if(url.find("/api/EnumEventInfo") == 0 ){
		ret = GetEnumEventInfo(urlParam, sendParam, epgDB);
	}else
	if(url.find("/api/EnumReserveInfo") == 0 ){
		ret = GetEnumReserveInfo(urlParam, sendParam, list);
	}else
	if(url.find("/api/EnumRecPreset") == 0 ){
		ret = GetEnumRecPresetInfo(urlParam, sendParam);
	}else
	if(url.find("/api/AddReserveEPG") == 0 ){
		if(verb.find("POST") == 0 ){
			RESERVE_DATA addRes;
			ret = GetReserveDataEPG(urlParam, epgDB, &addRes);
			if( ret == TRUE ){
				vector<RESERVE_DATA> addList;
				addList.push_back(addRes);
				ret = resMng->AddReserveData(&addList);
			}
			GetReserveAddResponse(ret, sendParam);
		}
	}else
	if(url.find("/api/SearchEvent") == 0 ){
		ret = GetSearchEvent(urlParam, sendParam, epgDB);
	}

	return ret;
}
Esempio n. 21
0
int CDLNADmsContentDB::SearchContainer(wstring virtualPath, wstring& objectID)
{
	if( lock.Lock(L"CDLNADmsContentDB::SearchContainer") == FALSE ){
		return ERR_FALSE;
	}

	int ret = NO_ERR;
	map<wstring, DLNA_DMS_CONTAINER_ITEM*>::iterator itr1;
	DLNA_DMS_CONTAINER_ITEM* parentContainer = root;
	wstring findName;
	wstring buff1 = virtualPath;
	wstring buff2;

	BOOL find = FALSE;
	while( buff1.size() > 0 ){
		Separate(buff1, L"/", findName, buff1);
		if( findName.size() == 0 ){
			continue;
		}
		find = FALSE;
		for( itr1 = parentContainer->childContainer.begin(); itr1 != parentContainer->childContainer.end(); itr1++){
			if( CompareNoCase(itr1->second->info->title, findName ) == 0 ){
				find = TRUE;
				break;
			}
		}
		if( find == TRUE ){
			parentContainer = itr1->second;
			objectID = itr1->first;
		}else{
			ret = ERR_FALSE;
			break;
		}
	}

	if( find == FALSE ){
		objectID = L"";
		ret = ERR_FALSE;
	}

	lock.UnLock();

	return ret;
}
Esempio n. 22
0
CString CXMLDlg::GetCurrentObjectFile(HTREEITEM pItem)
{
	HTREEITEM pChildItem = m_treeOutput.GetChildItem(pItem);
	if (!pChildItem)
	{
		ASSERT(false);
		return CString("");
	}

	while (pChildItem)
	{
		CString szTitle;
		CString szValue;
		Separate(m_treeOutput.GetItemText(pChildItem), szTitle, szValue);

		if (!szTitle.CompareNoCase(_T("file")) )
			return szValue;

		pChildItem = m_treeOutput.GetNextItem(pChildItem, TVGN_NEXT);
	}

	ASSERT(false);
	return CString("");
}
Esempio n. 23
0
DWORD CRestApiManager::GetSearchEvent(string param, HTTP_STREAM* sendParam, CEpgDBManager* epgDB)
{
	DWORD ret = NO_ERR;

	map<string,string> paramMap;
	while(param.size()>0){
		string buff;
		Separate(param, "&", buff, param);
		if(buff.size()>0){
			string key;
			string val;
			Separate(buff, "=", key, val);
			paramMap.insert(pair<string,string>(key, val));
		}
	}

	map<string,string>::iterator itr;
	WORD network = 0xFFFF;
	itr = paramMap.find("network");
	if( itr != paramMap.end() ){
		network = (WORD)atoi(itr->second.c_str());
	}
	WORD days = 0;
	itr = paramMap.find("days");
	if( itr != paramMap.end() ){
		days = (WORD)atoi(itr->second.c_str());
	}

	wstring andkey;
	itr = paramMap.find("andkey");
	if( itr != paramMap.end() ){
		string utf8;
		UrlDecode(itr->second.c_str(), (DWORD)itr->second.size(), utf8);
		UTF8toW(utf8, andkey);
	}
	wstring notkey;
	itr = paramMap.find("notkey");
	if( itr != paramMap.end() ){
		string utf8;
		UrlDecode(itr->second.c_str(), (DWORD)itr->second.size(), utf8);
		UTF8toW(utf8, notkey);
	}
	vector<DWORD> genru;
	itr = paramMap.find("genru");
	if( itr != paramMap.end() ){
		string val = itr->second;
		string id;
		while(val.size() > 0 ){
			Separate(val, "-", id, val);
			genru.push_back((DWORD)atoi(id.c_str()));
		}
	}

	DWORD index = 0;
	itr = paramMap.find("index");
	if( itr != paramMap.end() ){
		index = (DWORD)atoi(itr->second.c_str());
	}
	DWORD count = 200;
	itr = paramMap.find("count");
	if( itr != paramMap.end() ){
		count = (DWORD)atoi(itr->second.c_str());
	}
	WORD basicOnly = 1;
	itr = paramMap.find("basic");
	if( itr != paramMap.end() ){
		basicOnly = (WORD)atoi(itr->second.c_str());
	}

	//検索条件
	EPGDB_SEARCH_KEY_INFO searchKey;
	searchKey.andKey = andkey;
	searchKey.notKey = notkey;
	for( size_t i=0; i<genru.size(); i++){
		EPGDB_CONTENT_DATA item;
		item.content_nibble_level_1 = (BYTE)(genru[i]>>8);
		item.content_nibble_level_2 = (BYTE)(genru[i]&0x00FF);
		searchKey.contentList.push_back(item);
	}
	//対象サービス
	vector<EPGDB_SERVICE_INFO> list;
	if( epgDB->GetServiceList(&list) == TRUE ){
		if( network != 0xFFFF ){
			for( size_t i=0; i<list.size(); i++ ){
				__int64 key = _Create64Key(list[i].ONID,list[i].TSID, list[i].SID);

				if( 0x7880 <= list[i].ONID && list[i].ONID<= 0x7FE8 ){
					//地デジ
					if( (network & 0x0001) > 0 ){
						searchKey.serviceList.push_back(key);
					}
				}else
				if( list[i].ONID == 0x0004 ){
					//BS
					if( (network & 0x0002) > 0 ){
						searchKey.serviceList.push_back(key);
					}
				}else
				if( list[i].ONID == 0x0006 || list[i].ONID == 0x0007 ){
					//CS
					if( (network & 0x0004) > 0 ){
						searchKey.serviceList.push_back(key);
					}
				}else{
					//その他
					if( (network & 0x0008) > 0 ){
						searchKey.serviceList.push_back(key);
					}
				}
			}
		}
	}

	//対象期間
	__int64 chkTime = 0;
	if( days > 0 ){
		SYSTEMTIME now;
		GetLocalTime(&now);
		now.wHour = 0;
		now.wMinute = 0;
		now.wSecond = 0;
		now.wMilliseconds = 0;

		chkTime = ConvertI64Time(now);
		chkTime += days*(29*60*60*I64_1SEC);
	}

	vector<EPGDB_SEARCH_KEY_INFO> keyList;
	keyList.push_back(searchKey);
	vector<EPGDB_EVENT_INFO*> resultList;
	wstring xml = L"";
	string utf8 = "";
	epgDB->SearchEpg(&keyList, &resultList);
	map<__int64, __int64> addID;
	map<__int64, __int64>::iterator itrAdd;
	if ( resultList.size() > 0 ){
		xml += L"<?xml version=\"1.0\" encoding=\"UTF-8\" ?><entry>";
		DWORD total = 0;
		DWORD findCount = 0;

		wstring serviceinfo = L"<items>";
		wstring buff;
		for( size_t i = 0; i<resultList.size(); i++){
			if( days > 0 ){
				if( chkTime < ConvertI64Time(resultList[i]->start_time)){
					continue;
				}
			}
			if( resultList[i]->eventGroupInfo != NULL ){
				BOOL find = FALSE;
				for( size_t j=0; j<resultList[i]->eventGroupInfo->eventDataList.size(); j++ ){
					__int64 evid = _Create64Key2(resultList[i]->eventGroupInfo->eventDataList[j].original_network_id,
						resultList[i]->eventGroupInfo->eventDataList[j].transport_stream_id,
						resultList[i]->eventGroupInfo->eventDataList[j].service_id,
						resultList[i]->eventGroupInfo->eventDataList[j].event_id);
					itrAdd = addID.find(evid);
					if( itrAdd != addID.end() ){
						find = TRUE;
					}
				}
				if( find == TRUE ){
					continue;
				}
			}
			__int64 evid = _Create64Key2(resultList[i]->original_network_id,
				resultList[i]->transport_stream_id,
				resultList[i]->service_id,
				resultList[i]->event_id);
			addID.insert(pair<__int64, __int64>(evid,evid));
			if( total < index ){
				total++;
				continue;
			}
			if( index + count <= total ){
				total++;
				continue;
			}
			total++;
			findCount++;

			EPGDB_EVENT_INFO* eventInfo = resultList[i];

			serviceinfo += L"<eventinfo>";
			Format(buff, L"<ONID>%d</ONID>", eventInfo->original_network_id);
			serviceinfo += buff;
			Format(buff, L"<TSID>%d</TSID>", eventInfo->transport_stream_id);
			serviceinfo += buff;
			Format(buff, L"<SID>%d</SID>", eventInfo->service_id);
			serviceinfo += buff;
			Format(buff, L"<eventID>%d</eventID>", eventInfo->event_id);
			serviceinfo += buff;
			if( eventInfo->StartTimeFlag == 1 ){
				Format(buff, L"<startDate>%04d/%02d/%02d</startDate>", eventInfo->start_time.wYear, eventInfo->start_time.wMonth, eventInfo->start_time.wDay);
				serviceinfo += buff;
				Format(buff, L"<startTime>%02d:%02d:%02d</startTime>", eventInfo->start_time.wHour, eventInfo->start_time.wMinute, eventInfo->start_time.wSecond);
				serviceinfo += buff;
				Format(buff, L"<startDayOfWeek>%d</startDayOfWeek>", eventInfo->start_time.wDayOfWeek);
				serviceinfo += buff;
			}
			if( eventInfo->DurationFlag == 1 ){
				Format(buff, L"<duration>%d</duration>", eventInfo->durationSec);
				serviceinfo += buff;
			}
			if( eventInfo->shortInfo != NULL ){
				wstring chk = eventInfo->shortInfo->event_name;
				CheckXMLChar(chk);
				Format(buff, L"<event_name>%s</event_name>", chk.c_str());
				serviceinfo += buff;

				chk = eventInfo->shortInfo->text_char;
				CheckXMLChar(chk);
				Format(buff, L"<event_text>%s</event_text>", chk.c_str());
				serviceinfo += buff;
			}
			if( eventInfo->contentInfo != NULL ){
				serviceinfo += L"";
				for( size_t k=0; k<eventInfo->contentInfo->nibbleList.size(); k++){
					wstring nibble = L"";
					Format(nibble,L"<contentInfo><nibble1>%d</nibble1><nibble2>%d</nibble2></contentInfo>", 
						eventInfo->contentInfo->nibbleList[k].content_nibble_level_1,
						eventInfo->contentInfo->nibbleList[k].content_nibble_level_2);
					serviceinfo += nibble;
				}
			}
			if( eventInfo->eventGroupInfo != NULL ){
				for( size_t k=0; k<eventInfo->eventGroupInfo->eventDataList.size(); k++){
					wstring group = L"";
					Format(group,L"<groupInfo><ONID>%d</ONID><TSID>%d</TSID><SID>%d</SID><eventID>%d</eventID></groupInfo>", 
						eventInfo->eventGroupInfo->eventDataList[k].original_network_id,
						eventInfo->eventGroupInfo->eventDataList[k].transport_stream_id,
						eventInfo->eventGroupInfo->eventDataList[k].service_id,
						eventInfo->eventGroupInfo->eventDataList[k].event_id
						);
					serviceinfo += group;
				}
			}

			Format(buff, L"<freeCAFlag>%d</freeCAFlag>", eventInfo->freeCAFlag);
			serviceinfo += buff;

			if( basicOnly == 0 ){
				if( eventInfo->extInfo != NULL ){
					wstring chk = eventInfo->extInfo->text_char;
					CheckXMLChar(chk);
					Format(buff, L"<event_ext_text>%s</event_ext_text>", chk.c_str());
					serviceinfo += buff;
				}
				if( eventInfo->componentInfo != NULL ){
					Format(buff, L"<videoInfo><stream_content>%d</stream_content><component_type>%d</component_type><component_tag>%d</component_tag><text>%s</text></videoInfo>", 
						eventInfo->componentInfo->stream_content,
						eventInfo->componentInfo->component_type,
						eventInfo->componentInfo->component_tag,
						eventInfo->componentInfo->text_char.c_str()
						);
					serviceinfo += buff;
				}
				if( eventInfo->audioInfo != NULL ){
					for( size_t k=0; k<eventInfo->audioInfo->componentList.size(); k++ ){
						Format(buff, L"<audioInfo><stream_content>%d</stream_content><component_type>%d</component_type><component_tag>%d</component_tag><stream_type>%d</stream_type><simulcast_group_tag>%d</simulcast_group_tag><ES_multi_lingual_flag>%d</ES_multi_lingual_flag><main_component_flag>%d</main_component_flag><quality_indicator>%d</quality_indicator><sampling_rate>%d</sampling_rate><text>%s</text></audioInfo>", 
							eventInfo->audioInfo->componentList[k].stream_content,
							eventInfo->audioInfo->componentList[k].component_type,
							eventInfo->audioInfo->componentList[k].component_tag,
							eventInfo->audioInfo->componentList[k].stream_type,
							eventInfo->audioInfo->componentList[k].simulcast_group_tag,
							eventInfo->audioInfo->componentList[k].ES_multi_lingual_flag,
							eventInfo->audioInfo->componentList[k].main_component_flag,
							eventInfo->audioInfo->componentList[k].quality_indicator,
							eventInfo->audioInfo->componentList[k].sampling_rate,
							eventInfo->audioInfo->componentList[k].text_char.c_str()
							);
						serviceinfo += buff;
					}
				}
				if( eventInfo->eventRelayInfo != NULL ){
					for( size_t k=0; k<eventInfo->eventRelayInfo->eventDataList.size(); k++){
						wstring group = L"";
						Format(group,L"<relayInfo><ONID>%d</ONID><TSID>%d</TSID><SID>%d</SID><eventID>%d</eventID></relayInfo>", 
							eventInfo->eventRelayInfo->eventDataList[k].original_network_id,
							eventInfo->eventRelayInfo->eventDataList[k].transport_stream_id,
							eventInfo->eventRelayInfo->eventDataList[k].service_id,
							eventInfo->eventRelayInfo->eventDataList[k].event_id
							);
						serviceinfo += group;
					}
				}
			}
			serviceinfo += L"</eventinfo>";
		}
		serviceinfo += L"</items>";

		Format(buff, L"<total>%d</total><index>%d</index><count>%d</count>", total, index, findCount);
		xml += buff;
		xml += serviceinfo;
		xml += L"</entry>";
	}else{
		xml += L"<?xml version=\"1.0\" encoding=\"UTF-8\" ?><entry>";
		xml += L"<err>EPGデータを読み込み中、または存在しません</err>";
		xml += L"</entry>";
	}

	WtoUTF8(xml, utf8);

	sendParam->dataSize = (DWORD)utf8.size();
	sendParam->data = new BYTE[sendParam->dataSize];
	memcpy(sendParam->data, utf8.c_str(), sendParam->dataSize);
	if( sendParam->dataSize > 0 ){
		Format(sendParam->httpHeader, "HTTP/1.0 200 OK\r\nContent-Type: text/xml\r\nContent-Length: %d\r\nConnection: close\r\n\r\n", sendParam->dataSize);
	}else{
		sendParam->httpHeader = "HTTP/1.0 400 Bad Request\r\nConnection: close\r\n\r\n";
	}

	return ret;
}
Esempio n. 24
0
DWORD CRestApiManager::GetReserveDataEPG(string param, CEpgDBManager* epgDB, RESERVE_DATA* reserveData)
{
	DWORD ret = NO_ERR;

	if( epgDB == NULL){
		return FALSE;
	}
	OutputDebugStringA(param.c_str());
	map<string,string> paramMap;
	while(param.size()>0){
		string buff;
		Separate(param, "&", buff, param);
		if(buff.size()>0){
			string key;
			string val;
			Separate(buff, "=", key, val);
			paramMap.insert(pair<string,string>(key, val));
		}
	}
	map<string,string>::iterator itr;
	WORD onid = 0;
	itr = paramMap.find("onid");
	if( itr != paramMap.end() ){
		onid = (WORD)atoi(itr->second.c_str());
	}
	WORD tsid = 0;
	itr = paramMap.find("tsid");
	if( itr != paramMap.end() ){
		tsid = (WORD)atoi(itr->second.c_str());
	}
	WORD sid = 0;
	itr = paramMap.find("sid");
	if( itr != paramMap.end() ){
		sid = (WORD)atoi(itr->second.c_str());
	}
	WORD evid = 0;
	itr = paramMap.find("evid");
	if( itr != paramMap.end() ){
		evid = (WORD)atoi(itr->second.c_str());
	}

	EPGDB_EVENT_INFO* eventInfo;
	if( epgDB->SearchEpg(onid, tsid, sid, evid, &eventInfo) == FALSE ){
		return FALSE;
	}
	if( eventInfo->shortInfo != NULL ){
		reserveData->title = eventInfo->shortInfo->event_name;
	}
	reserveData->startTime = eventInfo->start_time;
	reserveData->startTimeEpg = eventInfo->start_time;
	reserveData->durationSecond = eventInfo->durationSec;
	epgDB->SearchServiceName(
		eventInfo->original_network_id,
		eventInfo->transport_stream_id,
		eventInfo->service_id,
		reserveData->stationName
		);
	reserveData->originalNetworkID = eventInfo->original_network_id;
	reserveData->transportStreamID = eventInfo->transport_stream_id;
	reserveData->serviceID = eventInfo->service_id;
	reserveData->eventID = eventInfo->event_id;

	itr = paramMap.find("presetID");
	if( itr == paramMap.end() ){
		return FALSE;
	}
	WORD presetID = (WORD)atoi(itr->second.c_str());
	reserveData->recSetting.recFolderList.clear();
	reserveData->recSetting.partialRecFolder.clear();
	LoadRecSetData(presetID, &reserveData->recSetting);

	itr = paramMap.find("recMode");
	if( itr == paramMap.end() ){
		return FALSE;
	}
	reserveData->recSetting.recMode = (BYTE)atoi(itr->second.c_str());

	if(reserveData->eventID != 0xFFFF){
		itr = paramMap.find("tuijyuuFlag");
		if( itr == paramMap.end() ){
			return FALSE;
		}
		reserveData->recSetting.tuijyuuFlag = (BYTE)atoi(itr->second.c_str());
	}else{
		reserveData->recSetting.tuijyuuFlag = 0;
	}

	itr = paramMap.find("priority");
	if( itr == paramMap.end() ){
		return FALSE;
	}
	reserveData->recSetting.priority = (BYTE)atoi(itr->second.c_str());

	if(reserveData->eventID != 0xFFFF){
		itr = paramMap.find("pittariFlag");
		if( itr == paramMap.end() ){
			return FALSE;
		}
		reserveData->recSetting.pittariFlag = (BYTE)atoi(itr->second.c_str());
	}else{
		reserveData->recSetting.pittariFlag = 0;
	}

	itr = paramMap.find("suspendMode");
	if( itr == paramMap.end() ){
		return FALSE;
	}
	reserveData->recSetting.suspendMode = (BYTE)atoi(itr->second.c_str());
	
	if( reserveData->recSetting.suspendMode == 1 || reserveData->recSetting.suspendMode == 2 ){
		itr = paramMap.find("rebootFlag");
		if( itr == paramMap.end() ){
			reserveData->recSetting.rebootFlag = 0;
		}else{
			reserveData->recSetting.rebootFlag = 1;
		}
	}else{
		reserveData->recSetting.rebootFlag = 0;
	}

	itr = paramMap.find("useDefMargineFlag");
	if( itr == paramMap.end() ){
		reserveData->recSetting.useMargineFlag = 1;
		itr = paramMap.find("startMargine");
		if( itr == paramMap.end() ){
			return FALSE;
		}
		reserveData->recSetting.startMargine = atoi(itr->second.c_str());
		itr = paramMap.find("endMargine");
		if( itr == paramMap.end() ){
			return FALSE;
		}
		reserveData->recSetting.endMargine = atoi(itr->second.c_str());
	}else{
		reserveData->recSetting.useMargineFlag = 0;
		reserveData->recSetting.startMargine = 0;
		reserveData->recSetting.endMargine = 0;
	}

	itr = paramMap.find("serviceMode");
	if( itr != paramMap.end() ){
		reserveData->recSetting.serviceMode = 0;
	}else{
		reserveData->recSetting.serviceMode = 1;
		itr = paramMap.find("serviceMode_1");
		if( itr != paramMap.end() ){
			reserveData->recSetting.serviceMode |= 0x10;
		}
		itr = paramMap.find("serviceMode_2");
		if( itr != paramMap.end() ){
			reserveData->recSetting.serviceMode |= 0x20;
		}
	}

	itr = paramMap.find("continueRecFlag");
	if( itr == paramMap.end() ){
		reserveData->recSetting.continueRecFlag = 0;
	}else{
		reserveData->recSetting.continueRecFlag = 1;
	}
	
	itr = paramMap.find("tunerID");
	if( itr == paramMap.end() ){
		return FALSE;
	}
	reserveData->recSetting.tunerID = (DWORD)atoi(itr->second.c_str());

	itr = paramMap.find("partialRecFlag");
	if( itr == paramMap.end() ){
		reserveData->recSetting.partialRecFlag = 0;
	}else{
		reserveData->recSetting.partialRecFlag = 1;
	}

	return TRUE;
}
Esempio n. 25
0
DWORD CRestApiManager::GetEnumRecPresetInfo(string param, HTTP_STREAM* sendParam)
{
	DWORD ret = NO_ERR;

	wstring iniPath = L"";
	GetModuleIniPath(iniPath);
	WCHAR iniBuff[512]=L"";
	GetPrivateProfileString(L"SET", L"PresetID", L"", iniBuff, 512, iniPath.c_str());
	wstring parseBuff = iniBuff;
	vector<DWORD> idList;
	idList.push_back(0);
	do{
		wstring presetID =L"";
		Separate(parseBuff, L",", presetID, parseBuff);
		idList.push_back((DWORD)_wtoi(presetID.c_str()));
	}while(parseBuff.size()>0);


	wstring xml = L"";
	string utf8 = "";

	wstring buff = L"";
	xml += L"<?xml version=\"1.0\" encoding=\"UTF-8\" ?><entry>";
	Format(buff, L"<total>%d</total><index>0</index><count>%d</count>", idList.size(), idList.size());
	xml += buff;
	xml += L"<items>";
	wstring reserveinfo = L"";
	for( size_t i=0; i<idList.size(); i++ ){
		REC_SETTING_DATA recSetting;
		LoadRecSetData((WORD)idList[i], &recSetting);

		reserveinfo += L"<recpresetinfo>";

		if( idList[i] == 0 ){
			Format(buff, L"<id>%d</id>", idList[i]);
			reserveinfo += buff;
			reserveinfo += L"<name>デフォルト</name>";
		}else{
			wstring appName = L"";
			Format(appName, L"REC_DEF%d", idList[i]);
			ZeroMemory(iniBuff, sizeof(WCHAR)*512);
			GetPrivateProfileString(appName.c_str(), L"SetName", L"", iniBuff, 512, iniPath.c_str());

			Format(buff, L"<id>%d</id>", idList[i]);
			reserveinfo += buff;
			Format(buff, L"<name>%s</name>", iniBuff);
			reserveinfo += buff;
		}
		reserveinfo += L"<recsetting>";
		Format(buff, L"<recMode>%d</recMode>", recSetting.recMode);
		reserveinfo += buff;
		Format(buff, L"<priority>%d</priority>", recSetting.priority);
		reserveinfo += buff;
		Format(buff, L"<tuijyuuFlag>%d</tuijyuuFlag>", recSetting.tuijyuuFlag);
		reserveinfo += buff;
		Format(buff, L"<serviceMode>%d</serviceMode>", recSetting.serviceMode);
		reserveinfo += buff;
		Format(buff, L"<pittariFlag>%d</pittariFlag>", recSetting.pittariFlag);
		reserveinfo += buff;
		Format(buff, L"<batFilePath>%s</batFilePath>", recSetting.batFilePath.c_str());
		reserveinfo += buff;
		reserveinfo += L"<recFolderList>";
		for( size_t j=0; j<recSetting.recFolderList.size(); j++ ){
			reserveinfo += L"<recFolderInfo>";
			Format(buff, L"<recFolder>%s</recFolder>", recSetting.recFolderList[j].recFolder.c_str());
			reserveinfo += buff;
			Format(buff, L"<writePlugIn>%s</writePlugIn>", recSetting.recFolderList[j].writePlugIn.c_str());
			reserveinfo += buff;
			Format(buff, L"<recNamePlugIn>%s</recNamePlugIn>", recSetting.recFolderList[j].recNamePlugIn.c_str());
			reserveinfo += buff;
			reserveinfo += L"</recFolderInfo>";
		}
		reserveinfo += L"</recFolderList>";
		Format(buff, L"<suspendMode>%d</suspendMode>", recSetting.suspendMode);
		reserveinfo += buff;
		Format(buff, L"<rebootFlag>%d</rebootFlag>", recSetting.rebootFlag);
		reserveinfo += buff;
		Format(buff, L"<useMargineFlag>%d</useMargineFlag>", recSetting.useMargineFlag);
		reserveinfo += buff;
		Format(buff, L"<startMargine>%d</startMargine>", recSetting.startMargine);
		reserveinfo += buff;
		Format(buff, L"<endMargine>%d</endMargine>", recSetting.endMargine);
		reserveinfo += buff;
		Format(buff, L"<continueRecFlag>%d</continueRecFlag>", recSetting.continueRecFlag);
		reserveinfo += buff;
		Format(buff, L"<partialRecFlag>%d</partialRecFlag>", recSetting.partialRecFlag);
		reserveinfo += buff;
		Format(buff, L"<tunerID>%d</tunerID>", recSetting.tunerID);
		reserveinfo += buff;
		reserveinfo += L"<partialRecFolder>";
		for( size_t j=0; j<recSetting.partialRecFolder.size(); j++ ){
			reserveinfo += L"<recFolderInfo>";
			Format(buff, L"<recFolder>%s</recFolder>", recSetting.partialRecFolder[j].recFolder.c_str());
			reserveinfo += buff;
			Format(buff, L"<writePlugIn>%s</writePlugIn>", recSetting.partialRecFolder[j].writePlugIn.c_str());
			reserveinfo += buff;
			Format(buff, L"<recNamePlugIn>%s</recNamePlugIn>", recSetting.partialRecFolder[j].recNamePlugIn.c_str());
			reserveinfo += buff;
			reserveinfo += L"</recFolderInfo>";
		}
		reserveinfo += L"</partialRecFolder>";
		reserveinfo += L"</recsetting>";

		reserveinfo += L"</recpresetinfo>";
	}
	xml += reserveinfo;
	xml += L"</items>";
	xml += L"</entry>";

	WtoUTF8(xml, utf8);

	sendParam->dataSize = (DWORD)utf8.size();
	sendParam->data = new BYTE[sendParam->dataSize];
	memcpy(sendParam->data, utf8.c_str(), sendParam->dataSize);
	if( sendParam->dataSize > 0 ){
		Format(sendParam->httpHeader, "HTTP/1.0 200 OK\r\nContent-Type: text/xml\r\nContent-Length: %d\r\nConnection: close\r\n\r\n", sendParam->dataSize);
	}else{
		sendParam->httpHeader = "HTTP/1.0 400 Bad Request\r\nConnection: close\r\n\r\n";
	}

	return ret;
}
Esempio n. 26
0
DWORD CRestApiManager::GetEnumEventInfo(string param, HTTP_STREAM* sendParam, CEpgDBManager* epgDB)
{
	DWORD ret = NO_ERR;

	map<string,string> paramMap;
	while(param.size()>0){
		string buff;
		Separate(param, "&", buff, param);
		if(buff.size()>0){
			string key;
			string val;
			Separate(buff, "=", key, val);
			paramMap.insert(pair<string,string>(key, val));
		}
	}

	map<string,string>::iterator itr;
	WORD ONID = 0xFFFF;
	itr = paramMap.find("ONID");
	if( itr != paramMap.end() ){
		ONID = (WORD)atoi(itr->second.c_str());
	}
	WORD TSID = 0xFFFF;
	itr = paramMap.find("TSID");
	if( itr != paramMap.end() ){
		TSID = (WORD)atoi(itr->second.c_str());
	}
	WORD SID = 0xFFFF;
	itr = paramMap.find("SID");
	if( itr != paramMap.end() ){
		SID = (WORD)atoi(itr->second.c_str());
	}
	WORD basicOnly = 1;
	itr = paramMap.find("basic");
	if( itr != paramMap.end() ){
		basicOnly = (WORD)atoi(itr->second.c_str());
	}
	DWORD index = 0;
	itr = paramMap.find("index");
	if( itr != paramMap.end() ){
		index = (DWORD)atoi(itr->second.c_str());
	}
	DWORD count = 200;
	itr = paramMap.find("count");
	if( itr != paramMap.end() ){
		count = (DWORD)atoi(itr->second.c_str());
	}

	vector<EPGDB_SERVICE_EVENT_INFO*> list;
	wstring xml = L"";
	string utf8 = "";
	if( epgDB->EnumEventAll(&list) == TRUE ){
		wstring buff = L"";
		DWORD total = 0;
		DWORD findCount = 0;

		xml += L"<?xml version=\"1.0\" encoding=\"UTF-8\" ?><entry>";

		wstring serviceinfo = L"";
		serviceinfo += L"<items>";
		for( size_t i=0; i<list.size(); i++ ){
			for( size_t j=0; j<list[i]->eventList.size(); j++){
				EPGDB_EVENT_INFO* eventInfo = list[i]->eventList[j];
				if( eventInfo->original_network_id != ONID && ONID != 0xFFFF ){
					continue;
				}
				if( eventInfo->transport_stream_id != TSID && TSID != 0xFFFF ){
					continue;
				}
				if( eventInfo->service_id != SID && SID != 0xFFFF ){
					continue;
				}
				if( total < index ){
					total++;
					continue;
				}
				if( index + count <= total ){
					total++;
					continue;
				}
				total++;
				findCount++;

				serviceinfo += L"<eventinfo>";
				Format(buff, L"<ONID>%d</ONID>", eventInfo->original_network_id);
				serviceinfo += buff;
				Format(buff, L"<TSID>%d</TSID>", eventInfo->transport_stream_id);
				serviceinfo += buff;
				Format(buff, L"<SID>%d</SID>", eventInfo->service_id);
				serviceinfo += buff;
				Format(buff, L"<eventID>%d</eventID>", eventInfo->event_id);
				serviceinfo += buff;
				if( eventInfo->StartTimeFlag == 1 ){
					Format(buff, L"<startDate>%d/%d/%d</startDate>", eventInfo->start_time.wYear, eventInfo->start_time.wMonth, eventInfo->start_time.wDay);
					serviceinfo += buff;
					Format(buff, L"<startTime>%d:%d:%d</startTime>", eventInfo->start_time.wHour, eventInfo->start_time.wMinute, eventInfo->start_time.wSecond);
					serviceinfo += buff;
					Format(buff, L"<startDayOfWeek>%d</startDayOfWeek>", eventInfo->start_time.wDayOfWeek);
					serviceinfo += buff;
				}
				if( eventInfo->DurationFlag == 1 ){
					Format(buff, L"<duration>%d</duration>", eventInfo->durationSec);
					serviceinfo += buff;
				}
				if( eventInfo->shortInfo != NULL ){
					wstring chk = eventInfo->shortInfo->event_name;
					CheckXMLChar(chk);
					Format(buff, L"<event_name>%s</event_name>", chk.c_str());
					serviceinfo += buff;

					chk = eventInfo->shortInfo->text_char;
					CheckXMLChar(chk);
					Format(buff, L"<event_text>%s</event_text>", chk.c_str());
					serviceinfo += buff;
				}
				if( eventInfo->contentInfo != NULL ){
					serviceinfo += L"";
					for( size_t k=0; k<eventInfo->contentInfo->nibbleList.size(); k++){
						wstring nibble = L"";
						Format(nibble,L"<contentInfo><nibble1>%d</nibble1><nibble2>%d</nibble2></contentInfo>", 
							eventInfo->contentInfo->nibbleList[k].content_nibble_level_1,
							eventInfo->contentInfo->nibbleList[k].content_nibble_level_2);
						serviceinfo += nibble;
					}
				}
				if( eventInfo->eventGroupInfo != NULL ){
					for( size_t k=0; k<eventInfo->eventGroupInfo->eventDataList.size(); k++){
						wstring group = L"";
						Format(group,L"<groupInfo><ONID>%d</ONID><TSID>%d</TSID><SID>%d</SID><eventID>%d</eventID></groupInfo>", 
							eventInfo->eventGroupInfo->eventDataList[k].original_network_id,
							eventInfo->eventGroupInfo->eventDataList[k].transport_stream_id,
							eventInfo->eventGroupInfo->eventDataList[k].service_id,
							eventInfo->eventGroupInfo->eventDataList[k].event_id
							);
						serviceinfo += group;
					}
				}

				Format(buff, L"<freeCAFlag>%d</freeCAFlag>", eventInfo->freeCAFlag);
				serviceinfo += buff;

				if( basicOnly == 0 ){
					if( eventInfo->extInfo != NULL ){
						wstring chk = eventInfo->extInfo->text_char;
						CheckXMLChar(chk);
						Format(buff, L"<event_ext_text>%s</event_ext_text>", chk.c_str());
						serviceinfo += buff;
					}
					if( eventInfo->componentInfo != NULL ){
						Format(buff, L"<videoInfo><stream_content>%d</stream_content><component_type>%d</component_type><component_tag>%d</component_tag><text>%s</text></videoInfo>", 
							eventInfo->componentInfo->stream_content,
							eventInfo->componentInfo->component_type,
							eventInfo->componentInfo->component_tag,
							eventInfo->componentInfo->text_char.c_str()
							);
						serviceinfo += buff;
					}
					if( eventInfo->audioInfo != NULL ){
						for( size_t k=0; k<eventInfo->audioInfo->componentList.size(); k++ ){
							Format(buff, L"<audioInfo><stream_content>%d</stream_content><component_type>%d</component_type><component_tag>%d</component_tag><stream_type>%d</stream_type><simulcast_group_tag>%d</simulcast_group_tag><ES_multi_lingual_flag>%d</ES_multi_lingual_flag><main_component_flag>%d</main_component_flag><quality_indicator>%d</quality_indicator><sampling_rate>%d</sampling_rate><text>%s</text></audioInfo>", 
								eventInfo->audioInfo->componentList[k].stream_content,
								eventInfo->audioInfo->componentList[k].component_type,
								eventInfo->audioInfo->componentList[k].component_tag,
								eventInfo->audioInfo->componentList[k].stream_type,
								eventInfo->audioInfo->componentList[k].simulcast_group_tag,
								eventInfo->audioInfo->componentList[k].ES_multi_lingual_flag,
								eventInfo->audioInfo->componentList[k].main_component_flag,
								eventInfo->audioInfo->componentList[k].quality_indicator,
								eventInfo->audioInfo->componentList[k].sampling_rate,
								eventInfo->audioInfo->componentList[k].text_char.c_str()
								);
							serviceinfo += buff;
						}
					}
					if( eventInfo->eventRelayInfo != NULL ){
						for( size_t k=0; k<eventInfo->eventRelayInfo->eventDataList.size(); k++){
							wstring group = L"";
							Format(group,L"<relayInfo><ONID>%d</ONID><TSID>%d</TSID><SID>%d</SID><eventID>%d</eventID></relayInfo>", 
								eventInfo->eventRelayInfo->eventDataList[k].original_network_id,
								eventInfo->eventRelayInfo->eventDataList[k].transport_stream_id,
								eventInfo->eventRelayInfo->eventDataList[k].service_id,
								eventInfo->eventRelayInfo->eventDataList[k].event_id
								);
							serviceinfo += group;
						}
					}
				}
				serviceinfo += L"</eventinfo>";

			}
			list[i]->eventList.clear();
			SAFE_DELETE(list[i]);
		}
		serviceinfo += L"</items>";

		Format(buff, L"<total>%d</total><index>%d</index><count>%d</count>", total, index, findCount);
		xml += buff;
		xml += serviceinfo;
		xml += L"</entry>";
	}else{
		xml += L"<?xml version=\"1.0\" encoding=\"UTF-8\" ?><entry>";
		xml += L"<err>EPGデータを読み込み中、または存在しません</err>";
		xml += L"</entry>";
	}

	WtoUTF8(xml, utf8);

	sendParam->dataSize = (DWORD)utf8.size();
	sendParam->data = new BYTE[sendParam->dataSize];
	memcpy(sendParam->data, utf8.c_str(), sendParam->dataSize);
	if( sendParam->dataSize > 0 ){
		Format(sendParam->httpHeader, "HTTP/1.0 200 OK\r\nContent-Type: text/xml\r\nContent-Length: %d\r\nConnection: close\r\n\r\n", sendParam->dataSize);
	}else{
		sendParam->httpHeader = "HTTP/1.0 400 Bad Request\r\nConnection: close\r\n\r\n";
	}

	return ret;
}
Esempio n. 27
0
int CHttpPublicFileSend::HttpRequest(string method, string uri, nocase::map<string, string>* headerList, SOCKET clientSock, HANDLE stopEvent)
{
	int ret = 200;
	string buff = "";
	string path = "";
	string rootA = "";
	wstring filePath = L"";
	wstring wbuff = L"";
	map<string, wstring>::iterator itrVPath;
	nocase::map<string, string>::iterator itrHead;
	nocase::map<string, string> httpResHeader;
	__int64 fileSize = 0;
	string contentType = "";
	__int64 offset = 0;
	__int64 endPos = 0;
	map<__int64, __int64> rangeList;

	if( this->folderPath.size() == 0 || this->rootUri.size() == 0){
		ret = 404;
		goto Err_End;
	}
	if( CompareNoCase(method, "GET") != 0 ){
		ret = 404;
		goto Err_End;
	}

	WtoA(this->rootUri, rootA);

	UrlDecode(uri.c_str(), (DWORD)uri.size(), buff);


	//仮想パスから検索
	for(itrVPath = this->virtualPathList.begin(); itrVPath != this->virtualPathList.end(); itrVPath++){
		string key;
		Format(key, "%s/%s/", rootA.c_str(), itrVPath->first.c_str());

		if( buff.find(key) == 0 ){
			Separate(buff, key, buff, path);
			Replace(path, "/", "\\");

			UTF8toW(path, wbuff);

			filePath = itrVPath->second;
			ChkFolderPath(filePath);
			filePath += L"\\";
			filePath += wbuff;
			break;
		}
	}

	if(filePath.size() == 0 ){
		//通常のルート
		Separate(buff, rootA, buff, path);
		Replace(path, "/", "\\");

		UTF8toW(path, wbuff);

		filePath = this->folderPath;
		ChkFolderPath(filePath);
		filePath += L"\\";
		filePath += wbuff;
	}

	if( PathFileExists(filePath.c_str()) == FALSE ){
		ret = 404;
		goto Err_End;
	}

	httpSend.GetContentType(filePath, contentType);
	fileSize = httpSend.GetContentLength(filePath);

	endPos = fileSize;

	itrHead = headerList->find("Range");
	if( itrHead == headerList->end() ){
		//Rangeなし
		Format(buff, "%I64d", fileSize);
		httpResHeader.insert(pair<string, string>("Content-Length", buff));
		httpResHeader.insert(pair<string, string>("Content-Type", contentType));

		httpSend.SendResponseHeader(200, &httpResHeader, clientSock, stopEvent);
		httpSend.SendFile(filePath, offset, endPos, clientSock, stopEvent);
	}else{
		if( httpSend.ParseRangeHeader(fileSize, itrHead->second, &rangeList) == FALSE ){
			//Range指定が何かおかしい
			Format(buff, "%I64d", fileSize);
			httpResHeader.insert(pair<string, string>("Content-Length", buff));
			httpResHeader.insert(pair<string, string>("Content-Type", contentType));

			httpSend.SendResponseHeader(200, &httpResHeader, clientSock, stopEvent);
			httpSend.SendFile(filePath, offset, endPos, clientSock, stopEvent);
		}else{
			httpResHeader.insert(pair<string, string>("Accept-Ranges", "bytes"));
			if( rangeList.size() > 1 ){
				//複数の場所指定
				Format(buff, "multipart/byteranges; boundary=%s", MULTI_PART_BOUNDARY);
				httpResHeader.insert(pair<string, string>("Content-Type", buff));

				httpSend.SendResponseHeader(206, &httpResHeader, clientSock, stopEvent);


				map<__int64, __int64>::iterator itr;
				string boundary = "";
				for( itr = rangeList.begin(); itr != rangeList.end(); itr++ ){
					boundary = "--";
					boundary += MULTI_PART_BOUNDARY;
					boundary += "\r\n";
					Format(buff, "Content-Type: %s\r\n", contentType);
					boundary += buff;
					Format(buff, "Content-Range: bytes %I64d-%I64d/%I64d\r\n", itr->first, itr->second, fileSize);
					boundary += buff;
					boundary += "\r\n";

					if( httpSend.SendData((BYTE*)boundary.c_str(), (DWORD)boundary.size(), clientSock, stopEvent) != NO_ERR ){
						goto End;
					}
					if( httpSend.SendFile(filePath, itr->first, itr->second+1, clientSock, stopEvent) != NO_ERR ){
						goto End;
					}

					boundary = "\r\n";
					httpSend.SendData((BYTE*)boundary.c_str(), (DWORD)boundary.size(), clientSock, stopEvent);
				}
				boundary = "--";
				boundary += MULTI_PART_BOUNDARY;
				boundary += "--\r\n";
				httpSend.SendData((BYTE*)boundary.c_str(), (DWORD)boundary.size(), clientSock, stopEvent);
			}else{
				//一カ所のみ
				map<__int64, __int64>::iterator itr;
				itr = rangeList.begin();

				httpResHeader.insert(pair<string, string>("Content-Type", contentType));
				Format(buff, "bytes %I64d-%I64d/%I64d", itr->first, itr->second, fileSize);
				httpResHeader.insert(pair<string, string>("Content-Range", buff));
				Format(buff, "%I64d", itr->second-itr->first+1);
				httpResHeader.insert(pair<string, string>("Content-Length", buff));

				httpSend.SendResponseHeader(206, &httpResHeader, clientSock, stopEvent);
				httpSend.SendFile(filePath, itr->first, itr->second+1, clientSock, stopEvent);

			}
		}
	}



	return ret;

Err_End:
	httpSend.SendResponseHeader(ret, &httpResHeader, clientSock, stopEvent);
End:
	return ret;
}
Esempio n. 28
0
BOOL CHttpFileSend::ParseRangeHeader(__int64 fileSize, string val, map<__int64, __int64>* rangeList)
{
	vector<string> valList;
	vector<RANGE_ITEM> rangeItem;
	string buff1 = "";
	string buff2 = "";
	string tempBuff = "";

	if( rangeList == NULL ){
		return FALSE;
	}

	buff1 = val;
	do{
		Separate(buff1, ",", buff1, buff2);
		valList.push_back(buff1);
	}while(buff2.size() > 0);

	for( size_t i=0; i<valList.size(); i++ ){
		BOOL itemChg = FALSE;
		RANGE_ITEM item;
		Separate(valList[i], "-", buff1, buff2);
		Separate(buff1, "=", tempBuff, buff1);

		item.start = _atoi64(buff1.c_str());
		item.end = fileSize-1;

		if( buff2.size() > 0 ){
			item.end = _atoi64(buff2.c_str());
		}

		if( item.end > fileSize ){
			rangeItem.clear();
			break;
		}

		for( size_t j=0; j<rangeItem.size(); j++){
			if( rangeItem[j].start <= item.start && item.start <= rangeItem[j].end ){
				if( rangeItem[j].end < item.end ){
					rangeItem[j].end = item.end;
				}
				itemChg = TRUE;
				break;
			}
			if( rangeItem[j].start <= item.end && item.end <= rangeItem[j].end ){
				if( item.start < rangeItem[j].start ){
					rangeItem[j].start = item.start;
				}
				itemChg = TRUE;
				break;
			}
			if( item.start <= rangeItem[j].start && rangeItem[j].start <= item.end &&
				item.start <= rangeItem[j].end && rangeItem[j].end <= item.end
				){
				rangeItem[j].start = item.start;
				rangeItem[j].end = item.end;
				itemChg = TRUE;
				break;
			}
		}
		if( itemChg == FALSE ){
			rangeItem.push_back(item);
		}
	}

	for( size_t i=0 ;i<rangeItem.size(); i++ ){
		rangeList->insert(pair<__int64, __int64>(rangeItem[i].start, rangeItem[i].end));
	}

	//存在しない場合は最初から最後まで
	if(rangeList->size() == 0 ){
		rangeList->insert(pair<__int64, __int64>(0, fileSize-1));
		return FALSE;
	}
	return TRUE;
}
Esempio n. 29
0
void  PROFILE:: Code(LPCSTR NameInput, LPCSTR NameOutput ) {

      FILEBASE Out;
      FILETEXT Inp, InpSection;

      int  i, LenBuf, l;
      char buf[513], iRet=0, iRS, c, Word[40];
      BYTE knt, Type[512];
      SECTION sect;
      char drive[MAXDRIVE];
      char dir[MAXDIR];
      char file[MAXFILE];
      char ext[MAXEXT];
      DWORD PosFile, Len, CurrentPos;
      float f;
      UNITS UG;

      Out.Open(NameOutput,"rw");
      Inp.Open(NameInput,"r");

      Out.Write("**PRFL**",8);
      Out.Write(this,20);

      for ( i=0; ; i++ ) {
         if ( ReadProfString(Inp,buf,LenBuf) ) {
            iRet = 1;  goto _10;  }
         if ( buf[0] == '#' ) break;
         Out.StringWrite(buf);
         }
      QuantityLanguage = i;
      if ( QuantityLanguage < 1 ) {
	      Printf("ќшибки в числе ¤зыков");
         iRet = 1;  goto _10;  }

      for ( i=0; i<MAX_QUANTITY_GRAF+4; i++ ) {
         if ( ReadProfWord(Inp,buf,l)  ) {
            iRet = 1;  goto _10;  }
         if ( buf[0] == '#' ) break;
         strncpy(UG.Name,buf,10);
         if ( ReadProfWord(Inp,buf,l)  ) {
            iRet = 1;  goto _10;  }
         UG.coef = CharDouble(buf,knt);
         if ( knt || UG.coef < 0 ) {
            Printf("ќшибка в %d коэффициенте системы единиц",i+1);
            iRet = 2;  goto _10;  }
         if ( i == 0 ) TypeBase = UG.coef + 0.1;
         if ( i == 1 ) E = UG.coef;
         if ( i == 2 ) nu = UG.coef;
         if ( i == 3 ) ro = UG.coef;
         if ( i < 4 ) continue;
         Out.Write(&UG,sizeof(UNITS));
         }
      QuantityTypeGraf = i - 4;

      for ( ; ; ) {

         if ( ReadProfString(Inp,buf,LenBuf) ) break;
         if ( buf[0] == '#' ) break;
	 memset(&sect,0,sizeof(sect));  iRS = 0;
         PosFile = Out.GetLength();
         QuantityTypeSection++;
         Out.Write(&sect,16);

	 InpSection.Close();
	 InpSection.Open(buf,"r");
	 fnsplit(buf,drive,dir,file,ext);
	 strncpy(sect.NameFile,file,8);

    CurrentPos = 0;
	 if ( ReadProfString(InpSection,buf,LenBuf) ) {
	    Printf("ќтсутствует тип сечени¤ в файле: %s",InpSection.GetFileName());
            iRet = 3;  continue;  }

         Separate(buf,LenBuf,CurrentPos," ",Word);
         sect.Group = CharLong(Word,knt);
         if ( knt ) {
            Printf("ќшибка в типе сечени¤ в файле: %s ",InpSection.GetFileName());
            iRet = 3;   continue;  }
         Separate(buf,LenBuf,CurrentPos," ",Word);
         sect.TypeInGroup = CharLong(Word,knt);
         if ( knt ) {
            Printf("ќшибка в характеристике типа сечени¤ в файле: %s ",InpSection.GetFileName());
            iRet = 3;   continue;  }

         for ( i=0; ; i++ ) {
            if ( ReadProfString(InpSection,buf,LenBuf) ) {
               Printf("ќшибка в имени сечени¤ в файле: %s ",InpSection.GetFileName());
               iRS = iRet = 3;  break;  }
            if ( buf[0] == '#' ) {
               if ( i != QuantityLanguage ) {
                  Printf("„исло наименований сечени¤ не соответствует числу ¤зыков в файле: %s ",
                     InpSection.GetFileName());
                  iRS = iRet = 3;   }
                  break;  }
            Out.StringWrite(buf);   }
         if ( iRS ) continue;

         for ( i=0; ; i++ ) {
            if ( ReadProfWord(InpSection,buf,l) ) {  iRS = 3;  break;  }
            if ( buf[0] == '#' || i == MAX_QUANTITY_GRAF ) break;
            Type[i] = CharLong(buf,knt);
            if ( knt ) { iRS = 3;  break;  }
            }
         if ( iRS || i == 0 || i > QuantityTypeGraf  ) {
            Printf("ќшибка в типах граф в файле : %s",InpSection.GetFileName());
            iRet = 3;    continue;   }
         Out.Write(Type,i);
         sect.QuantityGraf = i;

         Len = Out.GetLength();
         for ( i=0; ; i++ ) {
            if ( ReadProfWord(InpSection,buf,l) ) {  iRS = 3;  break;  }
            if ( buf[0] == '#' || i == sect.QuantityGraf ) break;
            Out.Write(buf,strlen(buf)+1);   }
         if ( iRS || i == sect.QuantityGraf  ) {
            Printf("ќшибка в именах граф в файле : %s",InpSection.GetFileName());
            iRet = 3;    continue;   }
         Out.Write("",1);
         sect.LengthNamePrint = Out.GetLength() - Len;

         memset(Type,0,sizeof(Type));
         for ( i=0; ; i++ ) {
            if ( ReadProfWord(InpSection,buf,l) ) {  iRS = 3;  break;  }
            if ( buf[0] == '#' || i == sect.QuantityGraf ) break;
            Type[i] = CharLong(buf,knt);
            if ( knt ) { iRS = 3;  break;  }
            }
         if ( iRS ) {
            Printf("ќшибка в признаках печати граф в файле : %s",InpSection.GetFileName());
            iRet = 3;    continue;   }
         Out.Write(Type,sect.QuantityGraf);

         for ( ; ; ) {

             c =  ReadProfWord(InpSection,buf,l);
             if ( c == -1 || buf[0] == '#' ) break;
             buf[MAX_STRING_NAME-1] = 0;
             sect.QuantityString++;
             Out.StringWrite(buf);

             for ( i=1; i<sect.QuantityGraf; i++ ) {
                if ( InpSection.ReadWord(buf,l) ) {
                   Printf("ќшибка в cтроке %hd в файле/n %s",sect.QuantityString,InpSection.GetFileName());
                   iRet = 2;  goto _10;  }
                f = CharDouble(buf,knt);
                if ( knt ) {
                    Printf("ќшибка в cтроке %hd в файле/n %s",sect.QuantityString,InpSection.GetFileName());
                   iRet = 2;   }
                Out.Write(&f,sizeof(float));  }
             }

         Out.Write(&sect,16,PosFile);
	 InpSection.Close();	 }

      Out.Write(&QuantityLanguage,20,8);


_10:  if ( iRet ) {
         if ( iRet == 1 ) Printf("ќшибки в файле %s",NameInput);
         Out.Delete();   }

      Inp.Close();
      Out.Close();

}
Esempio n. 30
0
int CDLNADmsContentDB::CreateContainer2(wstring virtualPath, DLNA_DMS_CONTAINER_META_INFO* info, wstring& objectID)
{
	if( lock.Lock(L"CDLNADmsContentDB::CreateContainer2") == FALSE ){
		return ERR_FALSE;
	}

	int ret = NO_ERR;
	map<wstring, DLNA_DMS_CONTAINER_ITEM*>::iterator itr1;
	DLNA_DMS_CONTAINER_ITEM* parentContainer = root;
	wstring findName;
	wstring buff1 = virtualPath;
	wstring buff2;
	wstring id = L"";
	DLNA_DMS_CONTAINER_ITEM* containerInfo = NULL;

	map<wstring, DLNA_DMS_CONTENT_ITEM*>::iterator itrID1;
	map<wstring, DLNA_DMS_CONTAINER_ITEM*>::iterator itrID2;

	BOOL find = FALSE;
	while( buff1.size() > 0 ){
		Separate(buff1, L"/", findName, buff1);
		if( findName.size() == 0 ){
			continue;
		}
		find = FALSE;
		for( itr1 = parentContainer->childContainer.begin(); itr1 != parentContainer->childContainer.end(); itr1++){
			if( CompareNoCase(itr1->second->info->title, findName ) == 0 ){
				find = TRUE;
				break;
			}
		}
		if( find == FALSE ){
			do{
				Format(id, L"%I64d", this->nextObjectID);

				itrID1 = contentList.find(id);
				itrID2 = containerList.find(id);

				this->nextObjectID++;
			}while(itrID1 != contentList.end() || itrID2 != containerList.end());

			containerInfo = new DLNA_DMS_CONTAINER_ITEM;
			containerInfo->parentObjectID = parentContainer->objectID;
			containerInfo->objectID = id;
			containerInfo->info = new DLNA_DMS_CONTAINER_META_INFO;
			if( buff1.size() == 0){
				*containerInfo->info = *info;
			}else{
				containerInfo->info->title = findName;
				containerInfo->info->uploadSupportFlag = 0;
				containerInfo->info->uploadFolderPath = L"";
			}

			parentContainer->childContainer.insert(pair<wstring, DLNA_DMS_CONTAINER_ITEM*>(containerInfo->objectID, containerInfo));
			containerList.insert(pair<wstring, DLNA_DMS_CONTAINER_ITEM*>(containerInfo->objectID, containerInfo));

			objectID = containerInfo->objectID;
		}else{
			objectID = itr1->first;
			parentContainer = itr1->second;
		}
	}

	lock.UnLock();

	return ret;
}