示例#1
0
bool CTuningSpaceList::Reserve(int Spaces)
{
	int i;

	if (Spaces<0)
		return false;
	if (Spaces==NumSpaces())
		return true;
	if (Spaces==0) {
		Clear();
		return true;
	}
	if (Spaces<NumSpaces()) {
		for (i=NumSpaces()-1;i>=Spaces;i--)
			delete m_TuningSpaceList[i];
		m_TuningSpaceList.resize(Spaces);
	} else {
		for (i=NumSpaces();i<Spaces;i++) {
			CTuningSpaceInfo *pInfo=new CTuningSpaceInfo;

			pInfo->Create();
			m_TuningSpaceList.push_back(pInfo);
		}
	}
	return true;
}
static BOOL CALLBACK EnumerateLoadedModulesProcSymInfo (PSTR ModuleName, DWORD64 ModuleBase, ULONG ModuleSize, PVOID UserContext)
{
	Mem_Zero (&symInfo, sizeof(symInfo));
	fhReport = (FILE *)UserContext;

	symInfo.SizeOfStruct = sizeof(symInfo);

	if (fnSymGetModuleInfo64 (GetCurrentProcess(), ModuleBase, &symInfo))
		NumSpaces (fhReport, symInfo.LoadedImageName, SymTypeToString(symInfo.SymType));
	else
		NumSpaces (fhReport, ModuleName, "couldn't check symbols");
	
	return TRUE;
}
示例#3
0
CTuningSpaceInfo::TuningSpaceType CTuningSpaceList::GetTuningSpaceType(int Space) const
{
	if (Space<0 || Space>=NumSpaces()) {
		return CTuningSpaceInfo::SPACE_ERROR;
	}
	return m_TuningSpaceList[Space]->GetType();
}
示例#4
0
bool CTuningSpaceList::UpdateStreamInfo(int Space,int ChannelIndex,
	WORD NetworkID,WORD TransportStreamID,WORD ServiceID)
{
	if (Space<0 || Space>=NumSpaces())
		return false;
	m_TuningSpaceList[Space]->GetChannelList()->UpdateStreamInfo(
			Space,ChannelIndex,NetworkID,TransportStreamID,ServiceID);
	m_AllChannelList.UpdateStreamInfo(Space,ChannelIndex,
									  NetworkID,TransportStreamID,ServiceID);
	return true;
}
示例#5
0
bool CTuningSpaceList::MakeAllChannelList()
{
	m_AllChannelList.Clear();
	for (int i=0;i<NumSpaces();i++) {
		CChannelList *pList=m_TuningSpaceList[i]->GetChannelList();

		for (int j=0;j<pList->NumChannels();j++) {
			m_AllChannelList.AddChannel(*pList->GetChannelInfo(j));
		}
	}
	return true;
}
示例#6
0
bool CChannelManager::SetCurrentChannel(int Space,int Channel)
{
#ifdef NETWORK_REMOCON_SUPPORT
	if (!m_fNetworkRemocon)
#endif
	{
		if (Space!=SPACE_ALL && Space!=SPACE_INVALID) {
			if (Space<0 || Space>=NumSpaces())
				return false;
		}
	}
	if (Space!=SPACE_INVALID) {
		const CChannelList *pList=GetChannelList(Space);
		if (pList==NULL || Channel<-1 || Channel>=pList->NumChannels())
			return false;
	} else {
		Channel=-1;
	}
	m_CurrentSpace=Space;
	m_CurrentChannel=Channel;
	return true;
}
示例#7
0
// TODO: 必要に応じてUnicodeで保存
bool CTuningSpaceList::SaveToFile(LPCTSTR pszFileName) const
{
	HANDLE hFile;
	DWORD Length,Write;

	hFile=::CreateFile(pszFileName,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,
					   FILE_ATTRIBUTE_NORMAL,NULL);
	if (hFile==INVALID_HANDLE_VALUE)
		return false;

	static const char szComment[]=
		"; " APP_NAME_A " チャンネル設定ファイル\r\n"
		"; 名称,チューニング空間,チャンネル,リモコン番号,サービスタイプ,サービスID,ネットワークID,TSID,状態\r\n";
	if (!::WriteFile(hFile,szComment,sizeof(szComment)-1,&Write,NULL) || Write!=sizeof(szComment)-1) {
		::CloseHandle(hFile);
		return false;
	}

	for (int i=0;i<NumSpaces();i++) {
		const CChannelList *pChannelList=m_TuningSpaceList[i]->GetChannelList();
		char szText[MAX_CHANNEL_NAME*2+256];

		if (pChannelList->NumChannels()==0)
			continue;

		if (GetTuningSpaceName(i)!=NULL) {
			Length=::wsprintfA(szText,";#SPACE(%d,%S)\r\n",i,GetTuningSpaceName(i));
			if (!::WriteFile(hFile,szText,Length,&Write,NULL) || Write!=Length) {
				::CloseHandle(hFile);
				return false;
			}
		}

		for (int j=0;j<pChannelList->NumChannels();j++) {
			const CChannelInfo *pChInfo=pChannelList->GetChannelInfo(j);
			LPCTSTR pszName=pChInfo->GetName();
			char aszName[MAX_CHANNEL_NAME*2];

			// 必要に応じて " で囲む
			if (pszName[0]==_T('#') || pszName[0]==_T(';')
					|| ::StrChr(pszName,_T(','))!=NULL
					|| ::StrChr(pszName,_T('"'))!=NULL) {
				LPCTSTR p=pszName;
				int NameLength=1;
				aszName[0]='"';
				while (*p!=_T('\0') && NameLength<lengthof(aszName)-2) {
					if (*p==_T('"')) {
						if (NameLength>=lengthof(aszName)-3)
							break;
						aszName[NameLength++]='"';
						aszName[NameLength++]='"';
						p++;
					} else {
#ifdef UNICODE
						int SrcLength;
						for (SrcLength=1;p[SrcLength]!=L'"' && p[SrcLength]!=L'\0';SrcLength++);
						int DstLength=::WideCharToMultiByte(CP_ACP,0,p,SrcLength,
											&aszName[NameLength],lengthof(aszName)-2-NameLength,NULL,NULL);
						NameLength+=DstLength;
						p+=SrcLength;
#else
						if (::IsDBCSLeadByteEx(CP_ACP,*p) && *(p+1)!='\0') {
							if (NameLength>=lengthof(aszName)-3)
								break;
							aszName[NameLength++]=*p++;
						}
						aszName[NameLength++]=*p++;
#endif
					}
				}
				aszName[NameLength++]='"';
				aszName[NameLength]='\0';
			} else {
#ifdef UNICODE
				::WideCharToMultiByte(CP_ACP,0,pszName,-1,
									  aszName,lengthof(aszName),NULL,NULL);
#else
				::lstrcpy(aszName,pszName);
#endif
			}

			Length=::wsprintfA(szText,"%s,%d,%d,%d,",
				aszName,
				pChInfo->GetSpace(),
				pChInfo->GetChannelIndex(),
				pChInfo->GetChannelNo());
			if (pChInfo->GetServiceType()!=0)
				Length+=::wsprintfA(szText+Length,"%d",pChInfo->GetServiceType());
			szText[Length++]=',';
			if (pChInfo->GetServiceID()!=0)
				Length+=::wsprintfA(szText+Length,"%d",pChInfo->GetServiceID());
			szText[Length++]=',';
			if (pChInfo->GetNetworkID()!=0)
				Length+=::wsprintfA(szText+Length,"%d",pChInfo->GetNetworkID());
			szText[Length++]=',';
			if (pChInfo->GetTransportStreamID()!=0)
				Length+=::wsprintfA(szText+Length,"%d",pChInfo->GetTransportStreamID());
			szText[Length++]=',';
			szText[Length++]=pChInfo->IsEnabled()?'1':'0';
			szText[Length++]='\r';
			szText[Length++]='\n';

			if (!::WriteFile(hFile,szText,Length,&Write,NULL) || Write!=Length) {
				::CloseHandle(hFile);
				return false;
			}
		}
	}

	::CloseHandle(hFile);

	return true;
}
示例#8
0
LPCTSTR CTuningSpaceList::GetTuningSpaceName(int Space) const
{
	if (Space<0 || Space>=NumSpaces())
		return NULL;
	return m_TuningSpaceList[Space]->GetName();
}
示例#9
0
const CChannelList *CTuningSpaceList::GetChannelList(int Space) const
{
	if (Space<0 || Space>=NumSpaces())
		return NULL;
	return m_TuningSpaceList[Space]->GetChannelList();
}
示例#10
0
const CTuningSpaceInfo *CTuningSpaceList::GetTuningSpaceInfo(int Space) const
{
	if (Space<0 || Space>=NumSpaces())
		return NULL;
	return m_TuningSpaceList[Space];
}