Exemple #1
0
bool CSideBarOptions::WriteSettings(CSettings &Settings)
{
	Settings.Clear();

	Settings.Write(TEXT("ShowPopup"),m_fShowPopup);
	Settings.Write(TEXT("ShowToolTips"),m_fShowToolTips);
	Settings.Write(TEXT("ShowChannelLogo"),m_fShowChannelLogo);
	Settings.Write(TEXT("PopupOpacity"),m_PopupOpacity);
	Settings.Write(TEXT("Place"),(int)m_Place);

	Settings.Write(TEXT("ItemCount"),(int)m_ItemNameList.size());
	for (size_t i=0;i<m_ItemNameList.size();i++) {
		TCHAR szName[32];
		StdUtil::snprintf(szName,lengthof(szName),TEXT("Item%d"),(int)i);
		Settings.Write(szName,m_ItemNameList[i]);
	}
	/*
	const CCommandList *pCommandList=m_pSideBar->GetCommandList();
	for (size_t i=0;i<m_ItemList.size();i++) {
		TCHAR szName[32];

		StdUtil::snprintf(szName,lengthof(szName),TEXT("Item%d"),i);
		if (m_ItemList[i]==ITEM_SEPARATOR)
			Settings.Write(szName,TEXT(""));
		else
			Settings.Write(szName,pCommandList->GetCommandTextByID(m_ItemList[i]));
	}
	*/

	return true;
}
Exemple #2
0
bool CMenuOptions::WriteSettings(CSettings &Settings)
{
	Settings.Clear();

	Settings.Write(TEXT("MaxChannelMenuRows"),m_MaxChannelMenuRows);
	Settings.Write(TEXT("MaxChannelMenuEventInfo"),m_MaxChannelMenuEventInfo);

	bool fDefault=true;
	if (m_MenuItemList.size()!=lengthof(m_DefaultMenuItemList)) {
		fDefault=false;
	} else {
		for (int i=0;i<lengthof(m_DefaultMenuItemList);i++) {
			if (m_MenuItemList[i].ID!=m_DefaultMenuItemList[i].ID
					|| !m_MenuItemList[i].fVisible) {
				fDefault=false;
				break;
			}
		}
	}
	if (!fDefault) {
		Settings.Write(TEXT("ItemCount"),(int)m_MenuItemList.size());
		const CCommandList *pCommandList=GetAppClass().GetCommandList();
		for (size_t i=0;i<m_MenuItemList.size();i++) {
			TCHAR szName[32];

			::wsprintf(szName,TEXT("Item%d_ID"),i);
			if (m_MenuItemList[i].ID==MENU_ID_SEPARATOR) {
				Settings.Write(szName,TEXT(""));
			} else {
				Settings.Write(szName,pCommandList->GetCommandTextByID(IDToCommand(m_MenuItemList[i].ID)));
			}
			::wsprintf(szName,TEXT("Item%d_State"),i);
			Settings.Write(szName,m_MenuItemList[i].fVisible?ITEM_STATE_VISIBLE:0);
		}
	}

	return true;
}
Exemple #3
0
bool CChannelManager::SaveChannelSettings(LPCTSTR pszFileName,LPCTSTR pszDriverName)
{
	if (m_TuningSpaceList.IsEmpty() || m_fChannelFileHasStreamIDs)
		return true;

	CSettings Settings;
	int SpaceCount;

	TRACE(TEXT("ストリーム情報の保存 : \"%s\" [%s]\n"),pszFileName,pszDriverName);
	if (!Settings.Open(pszFileName,CSettings::OPEN_WRITE)
			|| !Settings.SetSection(::PathFindFileName(pszDriverName)))
		return false;
	SpaceCount=m_TuningSpaceList.NumSpaces();
	Settings.Clear();
	Settings.Write(TEXT("SpaceCount"),SpaceCount);
	for (int i=0;i<SpaceCount;i++) {
		const CChannelList *pList=m_TuningSpaceList.GetChannelList(i);
		int NumChannels=pList->NumChannels();
		TCHAR szName[64];

		::wsprintf(szName,TEXT("Space%d_Count"),i);
		Settings.Write(szName,NumChannels);
		int LastIndex=0;
		for (int j=0;j<NumChannels;j++) {
			int Index=pList->GetChannelIndex(j);
			if (Index>LastIndex)
				LastIndex=Index;
		}
		int *pServiceCount=new int[LastIndex+1];
		int Map=0;
		for (int j=0;j<=LastIndex;j++) {
			int NumServices=0;
			for (int k=0;k<NumChannels;k++) {
				if (pList->GetChannelIndex(k)==j)
					NumServices++;
			}
			if (NumServices>0) {
				::wsprintf(szName,TEXT("Space%d_ChannelMap%d"),i,Map++);
				Settings.Write(szName,j);
				::wsprintf(szName,TEXT("Space%d_Channel%d_Count"),i,j);
				Settings.Write(szName,NumServices);
			}
			pServiceCount[j]=0;
		}
		for (int j=0;j<NumChannels;j++) {
			const CChannelInfo *pChInfo=pList->GetChannelInfo(j);

			if (pChInfo->GetNetworkID()!=0) {
				::wsprintf(szName,TEXT("Space%d_Channel%d_NID"),
					pChInfo->GetSpace(),pChInfo->GetChannelIndex());
				Settings.Write(szName,pChInfo->GetNetworkID());
			}
			if (pChInfo->GetTransportStreamID()!=0) {
				::wsprintf(szName,TEXT("Space%d_Channel%d_TSID"),
					pChInfo->GetSpace(),pChInfo->GetChannelIndex());
				Settings.Write(szName,pChInfo->GetTransportStreamID());
			}
			if (pChInfo->GetServiceID()!=0) {
				::wsprintf(szName,TEXT("Space%d_Channel%d_Service%d_SID"),
					pChInfo->GetSpace(),pChInfo->GetChannelIndex(),
					pServiceCount[pChInfo->GetChannelIndex()]);
				Settings.Write(szName,pChInfo->GetServiceID());
			}
			pServiceCount[pChInfo->GetChannelIndex()]++;
		}
		delete [] pServiceCount;
	}
	return true;
}