示例#1
0
void CRoboMXApp::ApplyPic(void)
{

	if(m_bPicLoaded){

		m_iBgImage.Destroy();
		HWND hMain = m_pMainWnd->GetWindow(GW_CHILD)->GetSafeHwnd();
		SetWindowLong(hMain, GWL_WNDPROC, (LONG)m_pOldWndProc);
		m_bPicLoaded = FALSE;
		SendMessage(hMain, WM_ERASEBKGND, (WPARAM)::GetDC(hMain), 0);
	}

	if(g_sSettings.GetUseImage()){

		//hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), g_sSettings.GetImage(),IMAGE_BITMAP,0,0,LR_DEFAULTCOLOR|LR_LOADFROMFILE);
		//if (hBmp == NULL){
		if(m_iBgImage.Load(g_sSettings.GetImage()) == E_FAIL){

			AfxMessageBox(IDS_ERROR_BG_LOAD, MB_OK);
		}
		else{

			m_bPicLoaded = TRUE;
			HWND hMain = m_pMainWnd->GetWindow(GW_CHILD)->GetSafeHwnd();
			m_pOldWndProc = (WNDPROC)GetWindowLong(hMain, GWL_WNDPROC);
			SetWindowLong(hMain, GWL_WNDPROC, (LONG)NewWndProc);
			SendMessage(hMain, WM_ERASEBKGND, (WPARAM)::GetDC(hMain), 0);
		}
	}
}
示例#2
0
void CLoginCfg::Load()
{

	m_lcLogin.DeleteAllItems();
	POSITION pos = g_sSettings.GetLoginIterator();

	while(pos){

		CString strPass;
		UINT uMode;

		g_sSettings.IterateLogins(pos, strPass, uMode);

		if(!strPass.IsEmpty() && uMode != 0){

			int nPos = m_lcLogin.InsertItem(0, strPass);
			if(nPos < 0) continue; //error

			m_lcLogin.SetItemText(nPos, 1, ((uMode & LOGIN_MAIN) == LOGIN_MAIN) ? "x" : "");
			m_lcLogin.SetItemText(nPos, 2, ((uMode & LOGIN_SUB) == LOGIN_SUB) ? "x" : "");
			m_lcLogin.SetItemText(nPos, 3, ((uMode & UM_VOICED) == UM_VOICED) ? "x" : "");
			m_lcLogin.SetItemText(nPos, 4, ((uMode & UM_AGENT) == UM_AGENT) ? "x" : "");
			m_lcLogin.SetItemText(nPos, 5, ((uMode & UM_ADMIN) == UM_ADMIN) ? "x" : "");
		}
	}

	UINT uMode = g_sSettings.GetDefaultUserMode();

	if((uMode & UM_VOICED) == UM_VOICED) m_bDefVoice = TRUE;
	if((uMode & UM_ADMIN) == UM_ADMIN) m_bDefAdmin = TRUE;
	if((uMode & UM_AGENT) == UM_AGENT) m_bDefAgent = TRUE;

	UpdateData(FALSE);

}
示例#3
0
bool CClientService::ConnectPipes () {
	LOGINFO (TEXT ("Connecting pipes to JVM"));
	m_oPipesSemaphore.Wait ();
	if (!m_poPipes) {
		m_oPipesSemaphore.Signal ();
		LOGFATAL (TEXT ("Pipes not created"));
		assert (0);
		return false;
	}
	if (!m_poJVM) {
		m_oPipesSemaphore.Signal ();
		LOGFATAL (TEXT ("JVM not created"));
		assert (0);
		return false;
	}
	CSettings oSettings;
	const TCHAR *pszPipeName = oSettings.GetConnectionPipe ();
	LOGDEBUG (TEXT ("Connecting to ") << pszPipeName);
	unsigned long lTimeout = m_poJVM->FirstConnection () ? oSettings.GetStartTimeout () : oSettings.GetConnectTimeout ();
	m_lSendTimeout = lTimeout;
	m_lShortTimeout = oSettings.GetSendTimeout ();
	unsigned long lTime = GetTickCount ();
	CNamedPipe *poPipe;
	do {
		poPipe = CNamedPipe::ClientWrite (pszPipeName);
		if (poPipe) {
			break;
		} else {
			int ec = GetLastError ();
			if (ec == ENOENT) {
				if (GetTickCount () - lTime > lTimeout) {
					m_oPipesSemaphore.Signal ();
					LOGWARN (TEXT ("Timeout waiting for JVM service to open ") << pszPipeName);
					return false;
				} else {
					if (m_poJVM->IsAlive ()) {
						LOGDEBUG (TEXT ("Waiting for JVM service to open pipe"));
						CThread::Sleep (oSettings.GetServicePoll ());
					} else {
						m_oPipesSemaphore.Signal ();
						LOGWARN (TEXT ("JVM service terminated before opening ") << pszPipeName);
						return false;
					}
				}
			} else {
				m_oPipesSemaphore.Signal ();
				LOGWARN (TEXT ("Couldn't connect to ") << pszPipeName << TEXT (", error ") << ec);
				return false;
			}
		}
	} while (true);
	LOGDEBUG (TEXT ("Connected to service"));
	bool bResult = m_poPipes->Connect (m_pszLanguageID, poPipe, lTimeout);
	if (!bResult) {
		LOGWARN (TEXT ("Couldn't connect to JVM service, error ") << GetLastError ());
	}
	delete poPipe;
	m_oPipesSemaphore.Signal ();
	return bResult;
}
示例#4
0
bool CControllerManager::SaveControllerSettings(LPCTSTR pszName) const
{
	int Index=FindController(pszName);
	if (Index<0)
		return false;

	const ControllerInfo &Info=m_ControllerList[Index];
	if (!Info.fSettingsChanged)
		return true;

	CSettings Settings;
	TCHAR szFileName[MAX_PATH];

	if (!Info.pController->GetIniFileName(szFileName,lengthof(szFileName)))
		return false;
	if (Settings.Open(szFileName,CSettings::OPEN_WRITE)
			&& Settings.SetSection(Info.pController->GetIniFileSection())) {
		const int NumButtons=Info.pController->NumButtons();
		const CCommandList &CommandList=GetAppClass().CommandList;

		for (int i=0;i<NumButtons;i++) {
			TCHAR szName[64];
			LPCTSTR pszText=NULL;

			::wsprintf(szName,TEXT("Button%d_Command"),i);
			if (Info.Settings.AssignList[i]!=0)
				pszText=CommandList.GetCommandTextByID(Info.Settings.AssignList[i]);
			Settings.Write(szName,pszText!=NULL?pszText:TEXT(""));
		}
		if (!Info.pController->IsActiveOnly())
			Settings.Write(TEXT("ActiveOnly"),Info.Settings.fActiveOnly);
	}
	return true;
}
示例#5
0
bool CVideoDecoderOptions::ReadSettings(CSettings &Settings)
{
	CMediaViewer &MediaViewer = GetAppClass().CoreEngine.m_DtvEngine.m_MediaViewer;
	VideoDecoderSettings DecoderSettings;
	int Value;

	MediaViewer.GetVideoDecoderSettings(&DecoderSettings);

	Settings.Read(TEXT("EnableDeinterlace"), &DecoderSettings.bEnableDeinterlace);
	if (Settings.Read(TEXT("DeinterlaceMethod"), &Value))
		DecoderSettings.DeinterlaceMethod = static_cast<TVTVIDEODEC_DeinterlaceMethod>(Value);
	Settings.Read(TEXT("AdaptProgressive"), &DecoderSettings.bAdaptProgressive);
	Settings.Read(TEXT("AdaptTelecine"), &DecoderSettings.bAdaptTelecine);
	Settings.Read(TEXT("SetInterlacedFlag"), &DecoderSettings.bSetInterlacedFlag);
	Settings.Read(TEXT("Brightness"), &DecoderSettings.Brightness);
	Settings.Read(TEXT("Contrast"), &DecoderSettings.Contrast);
	Settings.Read(TEXT("Hue"), &DecoderSettings.Hue);
	Settings.Read(TEXT("Saturation"), &DecoderSettings.Saturation);
	Settings.Read(TEXT("NumThreads"), &DecoderSettings.NumThreads);
	Settings.Read(TEXT("EnableDXVA2"), &DecoderSettings.bEnableDXVA2);

	MediaViewer.SetVideoDecoderSettings(DecoderSettings);

	return true;
}
示例#6
0
	CRunnerThread (CClientService *poService) : CThread () {
		LOGDEBUG (TEXT ("Runner thread created"));
		CSettings oSettings;
		m_poService = poService;
		m_msgStash = NULL;
		m_lHeartbeatTimeout = oSettings.GetHeartbeatTimeout ();
	}
	void Run () {
		CSettings settings;
		ASSERT (settings.GetConnectionPipe ());
		LOGDEBUG (TEXT ("Connecting to ") << settings.GetConnectionPipe ());
		CNamedPipe *poPipe = CNamedPipe::ClientWrite (settings.GetConnectionPipe ());
		ASSERT (poPipe);
		LOGDEBUG (TEXT ("Client connected"));
		ClientConnect cc;
		memset (&cc, 0, sizeof (cc));
		cc._userName = TEST_USERNAME;
		cc._CPPToJavaPipe = TEST_CPP2JAVA;
		cc._JavaToCPPPipe = TEST_JAVA2CPP;
		cc._languageID = TEST_LANGUAGE;
#ifdef _DEBUG
		cc._debug = FUDGE_TRUE;
#endif /* ifdef _DEBUG */
		FudgeMsg msg;
		ASSERT (ClientConnect_toFudgeMsg (&cc, &msg) == FUDGE_OK);
		FudgeMsgEnvelope env;
		ASSERT (FudgeMsgEnvelope_create (&env, 0, 0, 0, msg) == FUDGE_OK);
		fudge_byte *ptrBuffer;
		fudge_i32 cbBuffer;
		ASSERT (FudgeCodec_encodeMsg (env, &ptrBuffer, &cbBuffer) == FUDGE_OK);
		FudgeMsgEnvelope_release (env);
		FudgeMsg_release (msg);
		LOGDEBUG (TEXT ("Writing connection packet"));
		ASSERT (poPipe->Write (ptrBuffer, cbBuffer, TIMEOUT_CONNECT) == (size_t)cbBuffer);
		LOGDEBUG (TEXT ("Connection packet written"));
		delete ptrBuffer;
		LOGDEBUG (TEXT ("Disconnecting"));
		delete poPipe;
	}
示例#8
0
CSettings* CSettings::NewLC()
{
    CSettings* self = new (ELeave) CSettings();
    _CPUSH(self);
    self->ConstructL();
    return self;
}
示例#9
0
bool CLogoDialog::fill_users(void)
{
    QString s;
    CSettings settings;
    QStringList sls;
    QString CurUserName;

    //user name
    CurUserName=qgetenv( "USER" );//current user name (by OS)
    if(CurUserName==QString::fromUtf8(""))//OS no support qgetenv
    {
        QDir dir(QDir::home());
        CurUserName=dir.dirName();
    }

    if(settings.load(QString::fromUtf8("USERS"),s))
    {
        if(s.length()>0)
            sls=s.split(",");
    }
    if(sls.count()<=0)//empty?
        ui->comboBoxUser->addItem(CurUserName);//add user name fom OS
    else
        ui->comboBoxUser->addItems(sls);//add lastest users
    //-
    sls.clear();
    return true;
}
void CSelectLanguageDlg::OnOK()
{
	// Declare variables
	CSettings * pSettings = CSettings::Instance();
	CPath * pPath = CPath::Instance();
	CString sLanguage, sLanguageFile = _T("default");

	// Get data
	m_cboLanguage.GetWindowText(sLanguage);

	// Now, get the right file
	for (int i = 0; i < m_iLanguageCount; i++)
	{
		// Is this the right language
		if (m_arrLanguages[i].sDescription == sLanguage)
		{
			// Yes, it is
			sLanguageFile = m_arrLanguages[i].sFilename;
		}
	}

	// Set language in settings
	pSettings->SetLanguage(sLanguageFile);

	// Should we even save it to settings.ini?
	if (m_chkRemember.GetCheck() != 0)
	{
		// Save to settings.ini
		WritePrivateProfileString(_T("UPDATER"), _T("language"), sLanguageFile,
			CInternalData::Instance()->GetSettingsFile());
	}

	// Call original function
	CDialog::OnOK();
}
示例#11
0
UINT DialogThreadFunktion(LPVOID param)
{
    CSettings dialog;
    dialog.DoModal();
    settingdialogopened=false;
    return 0;
}
示例#12
0
long CRequestBuilder::GetDefaultTimeout () {
	static long volatile s_lDefaultTimeout = 0;
	if (!s_lDefaultTimeout) {
		CSettings oSettings;
		s_lDefaultTimeout = oSettings.GetSendTimeout () * 2;
	}
	return s_lDefaultTimeout;
}
void CFindDialog::saveSearchSettings() const
{
	CSettings s;
	s.setValue(_settingsRootCategory + SETTINGS_BACKWARDS, searchBackwards());
	s.setValue(_settingsRootCategory + SETTINGS_CASE_SENSITIVE, caseSensitive());
	s.setValue(_settingsRootCategory + SETTINGS_REGEX, regex());
	s.setValue(_settingsRootCategory + SETTINGS_WHOLE_WORDS, wholeWords());

}
示例#14
0
/// Exitlude actions to stop the service, e.g. to remove any state that was created as part of _ServiceStartup.
///
/// @param[in] nReason how the service was run (e.g. SERVICE_RUN_INLINE) - different actions may be required
/// depending on whether the code is running direct from main() or through another mechanism.
static void _ServiceStop (int nReason) {
	CSettings oSettings;
#ifndef _WIN32
	if (nReason == SERVICE_RUN_DAEMON) {
		const TCHAR *pszPID = oSettings.GetPidFile ();
		if (pszPID) {
			LOGINFO (TEXT ("Removing PID file ") << pszPID);
			unlink (pszPID);
		}
	}
#endif /* ifndef _WIN32 */
}
示例#15
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;
}
示例#16
0
bool CChannelManager::LoadChannelSettings(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_READ)
			|| !Settings.SetSection(::PathFindFileName(pszDriverName)))
		return false;
	if (Settings.Read(TEXT("SpaceCount"),&SpaceCount) && SpaceCount>0) {
		for (int i=0;i<SpaceCount;i++) {
			int NumChannels;
			TCHAR szName[64];

			::wsprintf(szName,TEXT("Space%d_Count"),i);
			if (Settings.Read(szName,&NumChannels) && NumChannels>0) {
				for (int j=0;j<NumChannels;j++) {
					int ChannelIndex;
					int NumServices;
					unsigned int NetworkID,TSID,ServiceID;

					::wsprintf(szName,TEXT("Space%d_ChannelMap%d"),i,j);
					if (Settings.Read(szName,&ChannelIndex)) {
						::wsprintf(szName,TEXT("Space%d_Channel%d_NID"),i,ChannelIndex);
						if (!Settings.Read(szName,&NetworkID))
							NetworkID=0;
						::wsprintf(szName,TEXT("Space%d_Channel%d_TSID"),i,ChannelIndex);
						if (!Settings.Read(szName,&TSID))
							TSID=0;
						if (NetworkID!=0 || TSID!=0) {
							::wsprintf(szName,TEXT("Space%d_Channel%d_Count"),i,ChannelIndex);
							if (Settings.Read(szName,&NumServices) && NumServices>0) {
								for (int k=0;k<NumServices;k++) {
									::wsprintf(szName,TEXT("Space%d_Channel%d_Service%d_SID"),i,ChannelIndex,k);
									if (Settings.Read(szName,&ServiceID) && ServiceID!=0)
										UpdateStreamInfo(i,ChannelIndex,NetworkID,TSID,ServiceID);
								}
							}
						}
					}
				}
			}
		}
	}
	return true;
}
示例#17
0
/// Creates a description of the service for registering with the service control
/// manager.
///
/// @return the table
static SERVICE_TABLE_ENTRY *_CreateDispatchTable () {
	CSettings oSettings;
	PCTSTR pszServiceName = oSettings.GetServiceName ();
	size_t cchServiceName = _tcslen (pszServiceName);
	SERVICE_TABLE_ENTRY *pEntry = (SERVICE_TABLE_ENTRY*)malloc (sizeof (SERVICE_TABLE_ENTRY) * 2 + (cchServiceName + 1) * sizeof (TCHAR));
	if (!pEntry) {
		LOGFATAL (TEXT ("Out of memory"));
		return NULL;
	}
	memcpy (pEntry[0].lpServiceName = (PTSTR)(pEntry + 1), pszServiceName, cchServiceName * sizeof (TCHAR));
	pEntry[0].lpServiceProc = ServiceMain;
	pEntry[1].lpServiceName = NULL;
	pEntry[1].lpServiceProc = NULL;
	return pEntry;
}
示例#18
0
void CSubChannelCfg::OnOK() 
{

	UpdateData(TRUE);

	g_sSettings.SetSubFirstIsSupoer(m_bFirstIsSuper);
	g_sSettings.SetAutoCloseSub(m_bAutoClose);
	g_sSettings.SetLimitSub(m_uMax);


	UINT uMode = 0;


	uMode = g_sSettings.GetChannelMode();
	if(m_bEnable){

		uMode |= CM_SUBCHANNELS;
	}
	else{

		uMode &= ~CM_SUBCHANNELS;
	}
	g_sSettings.SetChannelMode(uMode);

	switch(m_nSubLevel){

	case 0:  // everyone
		uMode = UM_NORMAL;
		break;
	case 1:	// voice admin agent
		uMode = UM_ADMIN|UM_AGENT|UM_VOICED;
		break;
	case 2: // admin agent
		uMode = UM_ADMIN|UM_AGENT;
		break;
	case 3:// admin
		uMode = UM_ADMIN;
		break;
	default: // host
		uMode = UM_HOST;
		break;
	}
	g_sSettings.SetSubPermission(uMode);
	g_sSettings.SetDisplaySubText(m_bDisplaySubs);
	g_sSettings.SetSubListed(m_bSubList);

	g_sSettings.Save();
	CWnd* pWnd = AfxGetApp()->m_pMainWnd;
	if(pWnd){

		pWnd->SendMessage(UWM_SETTINGS, 0, 0);
	}
}
示例#19
0
void CLoginCfg::OnAdd() 
{

	if(!UpdateData(TRUE)) return;

	if(m_strPassword.IsEmpty()){
		
		AfxMessageBox(IDS_PASSWORDEMPTY, MB_ICONINFORMATION+MB_OK);
		return;
	}

	if(!m_bMain && !m_bSub){

		AfxMessageBox(IDS_NOCHANNELLOGIN, MB_ICONINFORMATION+MB_OK);
		return;
	}

	if(!m_bVoice && !m_bAgent && !m_bAdmin){

		AfxMessageBox(IDS_NOUSERMODE, MB_ICONINFORMATION+MB_OK);
		return;
	}

	for(int i = 0; i < m_lcLogin.GetItemCount(); i++){

		if(m_lcLogin.GetItemText(i, 0) == m_strPassword){

			AfxMessageBox(IDS_LOGINEXISTS, MB_ICONINFORMATION+MB_OK);
			return;
		}
	}

	int nPos = m_lcLogin.InsertItem(0, m_strPassword);
	if(nPos < 0) return;

	m_lcLogin.SetItemText(nPos, 1, m_bMain  ? "x" : "");
	m_lcLogin.SetItemText(nPos, 2, m_bSub   ? "x" : "");
	m_lcLogin.SetItemText(nPos, 3, m_bVoice ? "x" : "");
	m_lcLogin.SetItemText(nPos, 4, m_bAgent ? "x" : "");
	m_lcLogin.SetItemText(nPos, 5, m_bAdmin ? "x" : "");
	
	UINT uMode = 0;
	if(m_bMain) uMode |= LOGIN_MAIN;
	if(m_bSub) uMode |= LOGIN_SUB;
	if(m_bVoice) uMode |= UM_VOICED;
	if(m_bAgent) uMode |= UM_AGENT;
	if(m_bAdmin) uMode |= UM_ADMIN;

	g_sSettings.AddLogin(m_strPassword, uMode);

	m_strPassword.Empty();
	m_bMain = FALSE;
	m_bSub  = FALSE;
	m_bVoice = FALSE;
	m_bAgent = FALSE;
	m_bAdmin = FALSE;

	UpdateData(FALSE);

}
示例#20
0
/// Prelude actions to start up the service, e.g. to set any global variables from the settings or perform
/// any system specific actions. E.g. the Windows implementation registers with the service control manager
/// and can optionally set the security descriptor on the process to allow clients to kill/restart it.
///
/// @param[in] nReason how the startup is occuring (e.g. SERVICE_RUN_INLINE) - different actions may be
/// required depending on whether the code is running direct from main() or through another mechansim
static void _ServiceStartup (int nReason) {
	CSettings oSettings;
#ifdef _WIN32
	if (nReason == SERVICE_RUN_SCM) {
		g_hServiceStatus = RegisterServiceCtrlHandler (oSettings.GetServiceName (), ServiceHandler);
	}
	PCTSTR pszSDDL = oSettings.GetServiceSDDL ();
	if (pszSDDL) {
		LOGDEBUG (TEXT ("Setting security descriptor ") << pszSDDL);
		PSECURITY_DESCRIPTOR psdRelative;
		if (ConvertStringSecurityDescriptorToSecurityDescriptor (pszSDDL, SDDL_REVISION_1, &psdRelative, NULL)) {
			DWORD cbAbsolute = 1024;
			PSECURITY_DESCRIPTOR psdAbsolute = (PSECURITY_DESCRIPTOR)malloc (cbAbsolute);
			DWORD cbD = 1024;
			PACL paclD = (PACL)malloc (cbD);
			DWORD cbS = 1024;
			PACL paclS = (PACL)malloc (cbS);
			DWORD cbOwner = 1024;
			PSID psidOwner = (PSID)malloc (cbOwner);
			DWORD cbPGroup = 1024;
			PSID psidPGroup = (PSID)malloc (cbPGroup);
			if (MakeAbsoluteSD (psdRelative, psdAbsolute, &cbAbsolute, paclD, &cbD, paclS, &cbS, psidOwner, &cbOwner, psidPGroup, &cbPGroup)) {
				DWORD dwError = SetSecurityInfo (GetCurrentProcess (), SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, paclD, NULL);
				if (dwError == ERROR_SUCCESS) {
					LOGINFO (TEXT ("Security descriptor set on process handle"));
				} else {
					LOGWARN (TEXT ("Couldn't set security descriptor on process handle, error ") << GetLastError ());
				}
			} else {
				LOGWARN (TEXT ("Couldn't create absolute security description, error ") << GetLastError ());
			}
			free (psdAbsolute);
			free (paclD);
			free (paclS);
			free (psidOwner);
			free (psidPGroup);
			LocalFree (psdRelative);
		} else {
			LOGWARN (TEXT ("Couldn't parse SDDL ") << pszSDDL << TEXT (", error ") << GetLastError ());
		}
	} else {
		LOGDEBUG (TEXT ("No security descriptor specified"));
	}
#endif /* ifdef _WIN32 */
	g_lBusyTimeout = oSettings.GetBusyTimeout ();
	_ReportStateStarting ();
}
示例#21
0
bool CDriverManager::LoadTunerSpec(LPCTSTR pszFileName)
{
	CSettings Settings;

	if (!Settings.Open(pszFileName,CSettings::OPEN_READ)
			|| !Settings.SetSection(TEXT("TunerSpec")))
		return false;

	CSettings::EntryList Entries;
	if (!Settings.GetEntries(&Entries))
		return false;

	for (auto it=Entries.begin();it!=Entries.end();++it) {
		TunerSpecInfo Info;

		Info.TunerMask=it->Name;
		Info.Spec.Flags=0;

		std::vector<TVTest::String> Attributes;
		if (TVTest::StringUtility::Split(it->Value,TEXT("|"),&Attributes)) {
			static const struct {
				LPCTSTR pszName;
				unsigned int Flag;
			} FlagList[] = {
				{TEXT("network"),			TunerSpec::FLAG_NETWORK},
				{TEXT("file"),				TunerSpec::FLAG_FILE},
				{TEXT("virtual"),			TunerSpec::FLAG_VIRTUAL},
				{TEXT("volatile"),			TunerSpec::FLAG_VOLATILE},
				{TEXT("no-enum-channel"),	TunerSpec::FLAG_NOENUMCHANNEL},
			};
			for (int i=0;i<lengthof(FlagList);i++) {
				for (auto itAttr=Attributes.begin();itAttr!=Attributes.end();++itAttr) {
					TVTest::StringUtility::Trim(*itAttr);
					if (TVTest::StringUtility::CompareNoCase(*itAttr,FlagList[i].pszName)==0) {
						Info.Spec.Flags|=FlagList[i].Flag;
						break;
					}
				}
			}
		}

		m_TunerSpecList.push_back(Info);
	}

	return true;
}
示例#22
0
bool CInformationPanel::WriteSettings(CSettings &Settings)
{
	for (int i=0;i<NUM_ITEMS;i++) {
		const CItem *pItem=m_ItemList[i];
		Settings.Write(pItem->GetName(),pItem->IsVisible());
	}
	return true;
}
示例#23
0
bool CControllerManager::ReadSettings(CSettings &Settings)
{
	TCHAR szText[256];

	if (Settings.Read(TEXT("CurController"),szText,lengthof(szText)))
		m_CurController=szText;
	return true;
}
示例#24
0
LRESULT CSettingsDlg::OnClickedCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	int nTab = m_tab_ctrl.GetCurSel();
	int lres = 1;

	if(nTab != 3)
	{
		if(_Settings.m_initial_scripts_folder != _Settings.GetScriptsFolder())
		{
			_Settings.SetScriptsFolder(_Settings.m_initial_scripts_folder, true);
		}

		CWindow* pWnd;
		TC_ITEM tci;
		tci.mask = TCIF_PARAM;
		int cnt = m_tab_ctrl.GetItemCount();
		for (int i = cnt - 1; i >= 0; i--)
		{ 
			m_tab_ctrl.GetItem(i, &tci);
			pWnd = (CWindow*)tci.lParam;
			if(pWnd)
			{
				pWnd->SendMessage(WM_COMMAND, MAKELONG(IDCANCEL, 0), 0);
			}
		}
	}
	else
	{
		TC_ITEM tci; 
		tci.mask = TCIF_PARAM;

		m_tab_ctrl.GetItem(nTab, &tci); 
		CWindow* pWnd = (CWindow*)tci.lParam; 
		if(pWnd)
		{
			lres = pWnd->SendMessage(WM_COMMAND, MAKELONG(IDCANCEL, 0), 0);
		}
	}

	if(lres)
		EndDialog(wID);

	return 0;
}
示例#25
0
void CLoginCfg::OnOK() 
{

	if(!UpdateData(TRUE)) return;

	UINT uMode = UM_NORMAL;
	if(m_bDefVoice) uMode |= UM_VOICED;
	if(m_bDefAdmin) uMode |= UM_ADMIN;
	if(m_bDefAgent) uMode |= UM_AGENT;
	g_sSettings.SetDefaultUserMode(uMode);

	g_sSettings.Save();

	CWnd* pWnd = AfxGetApp()->m_pMainWnd;
	if(pWnd){

		pWnd->SendMessage(UWM_SETTINGS, 0, 0);
	}
}
示例#26
0
bool CInformationPanel::ReadSettings(CSettings &Settings)
{
	for (int i=0;i<NUM_ITEMS;i++) {
		CItem *pItem=m_ItemList[i];
		bool f;

		if (Settings.Read(pItem->GetName(),&f))
			pItem->SetVisible(f);
	}
	return true;
}
示例#27
0
bool CGeneralOptions::WriteSettings(CSettings &Settings)
{
	Settings.Write(TEXT("DriverDirectory"),m_BonDriverDirectory);
	Settings.Write(TEXT("DefaultDriverType"),(int)m_DefaultDriverType);
	Settings.Write(TEXT("DefaultDriver"),m_DefaultBonDriverName);
	Settings.Write(TEXT("Driver"),GetAppClass().CoreEngine.GetDriverFileName());
	Settings.Write(TEXT("Resident"),m_fResident);
	Settings.Write(TEXT("KeepSingleTask"),m_fKeepSingleTask);
	Settings.Write(TEXT("StandaloneProgramGuide"),m_fStandaloneProgramGuide);
	Settings.Write(TEXT("Enable1SegFallback"),m_fEnable1SegFallback);

	return true;
}
示例#28
0
void CRenameDlg::OnOK() 
{

	if(!UpdateData(TRUE)) return;

	if(m_strName.GetLength() < 1){

		AfxMessageBox(IDS_ERROR_NAME_SHORT, MB_ICONINFORMATION);
		return;
	}

	if((m_strName.Find(" ") >= 0) || (m_strName.Find("\\rtf") >= 0)){

		AfxMessageBox(IDS_ERROR_NAME_INVALID, MB_ICONINFORMATION);
		return;
	}

	if(m_bWPNOnly == 2){

		Util::MakeValidUserName(m_strName, FALSE, 0);
	}
	else{

		Util::MakeValidUserName(m_strName, m_bAllRooms, m_bAllRooms ? GetApp()->GetMainFrame()->m_wClientID : 0);
	}

	if(m_strName.GetLength() > 45){
		
		AfxMessageBox(IDS_ERROR_NAME_LONG, MB_ICONINFORMATION);
		return;
	}

	UpdateData(FALSE);
	
	g_sSettings.SetNickname(m_strName);
	g_sSettings.SetLine(m_nLine);
	g_sSettings.SetFiles(m_dwFiles);
	
	CDialog::OnOK();
}
int _tmain(int argc, _TCHAR* argv[])
{
	std::string filename = "settings.ini";
	CSettings* settings = new CSettings(filename);
	if (!settings->LoadSettings())
	{
		std::cout << "Unable to load settings.ini";
		return 1;
	}

	std::map<std::string, std::list<std::pair<std::string, std::string>>> attribmap = settings->GetAttributes();
	std::map<std::string, std::list<std::pair<std::string, std::string>>>::iterator itr = attribmap.begin();
	std::map<std::string, std::list<std::pair<std::string, std::string>>>::iterator end = attribmap.end();
	for (; itr != end; itr++)
	{
		std::string def = (*itr).first.c_str();
		std::cout << def << std::endl;
		std::list<std::pair<std::string, std::string>> section = settings->GetSection(def);
		for (std::list<std::pair<std::string, std::string>>::const_iterator it = section.begin(); it != section.end(); it++)
		{
			std::cout << (*it).first << " = " << (*it).second << std::endl;
		}
	}

	settings->Set("[Default]", "TESTSTR", "\"re-changed line with ; in quotes\"");
	settings->SaveSettings();
	return 0;
}
示例#30
0
bool CInputDialogWaregroup::settings(bool bUpdate)
{
    bool b;
    CSettings settings;
    QList<QString> lsSType,lsSValue,lsSUpdateType,lsSUpdateValue;
    lsSType.push_back(QString("DLG_WAREGROUP_TREE"));
    //-
    b=settings.load(lsSType,lsSValue);//load all settings
    if(b)
    {
        if(!bUpdate)//set
        {
            //tree width
            if(lsSValue.count()>0)
                settings.set_tree_width(ui->treeWidgetParents,lsSValue[0],500);
        }
        if(bUpdate)//write
        {
            //tree width
            if(lsSValue.count()>0)
            {
                if(settings.get_tree_width(ui->treeWidgetParents,lsSValue[0]))//setting change?
                {
                    lsSUpdateType.push_back(lsSType[0]);
                    lsSUpdateValue.push_back(lsSValue[0]);
                }
            }

            //write updates
            if(lsSUpdateType.count()>0 && lsSUpdateType.count()==lsSUpdateValue.count())
                b=settings.write(lsSUpdateType,lsSUpdateValue);
        }
    }
    //-
    lsSValue.clear();
    lsSType.clear();
    lsSUpdateValue.clear();
    lsSUpdateType.clear();
    return b;
}