当前位置: 首页>>代码示例>>C++>>正文


C++ COptions类代码示例

本文整理汇总了C++中COptions的典型用法代码示例。如果您正苦于以下问题:C++ COptions类的具体用法?C++ COptions怎么用?C++ COptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了COptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sxOldDBPrefsString

void PasswordSafeFrame::OnPreferencesClick( wxCommandEvent& /* evt */ )
{
  PWSprefs* prefs = PWSprefs::GetInstance();
  const StringX sxOldDBPrefsString(prefs->Store());
  COptions *window = new COptions(this);
  if (window->ShowModal() == wxID_OK) {
    StringX sxNewDBPrefsString(prefs->Store(true));
    // Update system tray icon if visible so changes show up immediately
    if (m_sysTray && prefs->GetPref(PWSprefs::UseSystemTray))
        m_sysTray->ShowIcon();

    if (!m_core.GetCurFile().empty() && !m_core.IsReadOnly() &&
        m_core.GetReadFileVersion() == PWSfile::VCURRENT) {
      if (sxOldDBPrefsString != sxNewDBPrefsString) {
        Command *pcmd = DBPrefsCommand::Create(&m_core, sxNewDBPrefsString);
        if (pcmd) {
            //I don't know why notifications should ever be suspended, but that's how
            //things were before I messed with them, so I want to limit the damage by
            //enabling notifications only as long as required and no more
            m_core.ResumeOnDBNotification();
            Execute(pcmd);  //deleted automatically
            m_core.SuspendOnDBNotification();
        }
      }
    }
  }
  window->Destroy();
}
开发者ID:Sp1l,项目名称:pwsafe,代码行数:28,代码来源:mainManage.cpp

示例2: SetHP

CEnemyDemon::CEnemyDemon()
{
    COptions *op = COptions::GetInstance();
    CSGD_EventSystem *pES = CSGD_EventSystem::GetInstance();

    SetHP(25 * op->GetDifficulty());
    SetVelX(100.0f * op->GetDifficulty());
    SetVelY(100.0f * op->GetDifficulty());
    SetXFlip(-1);
    SetHeight(64);
    SetWidth(64);
    SetPosX(500);
    SetPosY(500);
    SetType(ACTOR_ENEMY);
    SetPower(5 * op->GetDifficulty());
    SetScoreValue(100 * op->GetDifficulty());
    SetHit(false);

    rEnemyRect.top = 65;
    rEnemyRect.bottom = 123;
    rEnemyRect.left = 0;
    rEnemyRect.right = 60;

    m_nSoundID = CSGD_WaveManager::GetInstance()->LoadWave("Resource/sounds/JoA_Bark.wav");
    CSGD_WaveManager::GetInstance()->SetVolume(m_nSoundID,COptions::GetInstance()->GetSFXVolume()-40);


}
开发者ID:jakneute,项目名称:Earthworm-Jim-Full-Sail-Game-Project,代码行数:28,代码来源:EnemyDemon.cpp

示例3: strcpy

BOOL CAdminSocket::Init()
{
	char *buffer = new char[100];
	char *p = buffer;
	strcpy(buffer, "FZS");
	p += 3;

	*p++ = 0;
	*p++ = 4;
	memcpy(p, &SERVER_VERSION, 4);
	p += 4;

	*p++ = 0;
	*p++ = 4;

	memcpy(p, &PROTOCOL_VERSION, 4);
	p += 4;

	COptions options;
	CStdString pass = options.GetOption(OPTION_ADMINPASS);
	CStdString peerAddress;
	UINT port = 0;
	if (GetPeerName(peerAddress, port) && IsLocalhost(peerAddress) && pass == _T("")) {
		BOOL res = Send(buffer, p-buffer) == p - buffer;
		delete [] buffer;
		if (!res) {
			Close();
			return FALSE;
		}
		return FinishLogon();
	}
	else {
		*p++ = 0;

		DWORD len = 20;
		memcpy(p, &len, 4);
		p += 4;

		*p++ = 0;
		*p++ = 8;

		int i;
		for (i = 0; i < 8; ++i) {
			m_Nonce1[i] = std::uniform_int_distribution<unsigned int>(0, 255)(std::random_device());
			*p++ = m_Nonce1[i];
		}

		*p++ = 0;
		*p++ = 8;

		for (i = 0; i < 8; ++i) {
			m_Nonce2[i] = std::uniform_int_distribution<unsigned int>(0, 255)(std::random_device());
			*p++ = m_Nonce2[i];
		}
	}

	int res = Send(buffer, p-buffer) == p-buffer;
	delete [] buffer;
	return res;
}
开发者ID:alioxp,项目名称:vc,代码行数:60,代码来源:AdminSocket.cpp

示例4: HandleEvent

void CEnemyBusiness::HandleEvent(CEvent *pEvent)
{
	CSGD_ObjectFactory<string, CBase> *pOF		= CSGD_ObjectFactory<string, CBase>::GetInstance();
	CSGD_ObjectManager *pOM						= CSGD_ObjectManager::GetInstance();
 	CSGD_TextureManager *pTM = CSGD_TextureManager::GetInstance();
	COptions *op = COptions::GetInstance();

	if (pEvent->GetEventID() == "businessman fire")
	{
		m_fFireReady = 5.0f;
		bIsFiring = true;

		pBullet = pOF->CreateObject("CBulletPaper");
		pBullet->SetImageID(GetImageID());

		if (GetXFlip() == -1)
			pBullet->SetVelX(500);
		else
			pBullet->SetVelX(-500);

		pBullet->SetVelY(0);
		pBullet->SetPosX(GetPosX() - (GetXFlip() * 48));
		pBullet->SetPosY(GetPosY());
		pBullet->SetType(ACTOR_BULLET);

		pBullet->SetHeight(20);
		pBullet->SetWidth(20);
		pBullet->SetPower(5 * op->GetDifficulty());

		pOM->AddObject(pBullet);
	}

}
开发者ID:jakneute,项目名称:Earthworm-Jim-Full-Sail-Game-Project,代码行数:33,代码来源:EnemyBusiness.cpp

示例5: LoadPage

bool COptionsPageEdit::LoadPage()
{
	bool failure = false;

	COptions* pOptions = COptions::Get();

	wxString editor = pOptions->GetOption(OPTION_EDIT_DEFAULTEDITOR);
	if (editor.empty() || editor[0] == '0')
		SetRCheck(XRCID("ID_DEFAULT_NONE"), true, failure);
	else if (editor[0] == '1')
		SetRCheck(XRCID("ID_DEFAULT_TEXT"), true, failure);
	else
	{
		if (editor[0] == '2')
			editor = editor.Mid(1);

		SetRCheck(XRCID("ID_DEFAULT_CUSTOM"), true, failure);
		SetText(XRCID("ID_EDITOR"), editor, failure);
	}

	if (pOptions->GetOptionVal(OPTION_EDIT_ALWAYSDEFAULT))
		SetRCheck(XRCID("ID_USEDEFAULT"), true, failure);
	else
		SetRCheck(XRCID("ID_USEASSOCIATIONS"), true, failure);

	SetCheckFromOption(XRCID("ID_EDIT_TRACK_LOCAL"), OPTION_EDIT_TRACK_LOCAL, failure);

	if (!failure)
		SetCtrlState();

	return !failure;
}
开发者ID:ErichKrause,项目名称:filezilla,代码行数:32,代码来源:optionspage_edit.cpp

示例6: DisplayUpdateAvailability

void CUpdateWizard::DisplayUpdateAvailability(bool showDialog)
{
	COptions* pOptions = COptions::Get();

	if (CBuildInfo::GetVersion() == _T("custom build"))
		return;

	const wxString& newVersion = pOptions->GetOption(OPTION_UPDATECHECK_NEWVERSION);
	if (newVersion == _T(""))
		return;

	wxLongLong v = CBuildInfo::ConvertToVersionNumber(newVersion);
	if (v <= CBuildInfo::ConvertToVersionNumber(CBuildInfo::GetVersion()))
	{
		pOptions->SetOption(OPTION_UPDATECHECK_NEWVERSION, _T(""));
		return;
	}

	if (!m_menuUpdated)
	{
		m_menuUpdated = true;

#ifdef __WXMSW__
		// All open menus need to be closed or app will become unresponsive.
		::EndMenu();
#endif

		CMainFrame* pFrame = (CMainFrame*)m_parent;

		wxMenu* pMenu = new wxMenu();
		const wxString& name = wxString::Format(_("&Version %s"), pOptions->GetOption(OPTION_UPDATECHECK_NEWVERSION).c_str());
		pMenu->Append(XRCID("ID_CHECKFORUPDATES"), name);
		wxMenuBar* pMenuBar = pFrame->GetMenuBar();
		if (pMenuBar)
			pMenuBar->Append(pMenu, _("&New version available!"));
	}

	if (showDialog && !m_updateShown)
	{
		if (wxDialogEx::ShownDialogs())
		{
			m_busy_timer.Start(1000, true);
			return;
		}

		m_updateShown = true;

#ifdef __WXMSW__
		// All open menus need to be closed or app will become unresponsive.
		::EndMenu();
#endif

		CUpdateWizard dlg(m_parent);
		if (dlg.Load())
			dlg.Run();
	}
}
开发者ID:madnessw,项目名称:thesnow,代码行数:57,代码来源:updatewizard.cpp

示例7: SavePage

bool COptionsPageEditAssociations::SavePage()
{
	COptions* pOptions = COptions::Get();

	SetOptionFromText(XRCID("ID_ASSOCIATIONS"), OPTION_EDIT_CUSTOMASSOCIATIONS);
	
	pOptions->SetOption(OPTION_EDIT_INHERITASSOCIATIONS, GetCheck(XRCID("ID_INHERIT")) ? 1 : 0);
		
	return true;
}
开发者ID:AbelTian,项目名称:filezilla,代码行数:10,代码来源:optionspage_edit_associations.cpp

示例8: LoadPage

bool COptionsPageEditAssociations::LoadPage()
{
	bool failure = false;

	COptions* pOptions = COptions::Get();

	SetTextFromOption(XRCID("ID_ASSOCIATIONS"), OPTION_EDIT_CUSTOMASSOCIATIONS, failure);
	SetCheck(XRCID("ID_INHERIT"), pOptions->GetOptionVal(OPTION_EDIT_INHERITASSOCIATIONS) != 0, failure);

	return !failure;
}
开发者ID:AbelTian,项目名称:filezilla,代码行数:11,代码来源:optionspage_edit_associations.cpp

示例9: SavePage

bool COptionsPageEdit::SavePage()
{
	COptions* pOptions = COptions::Get();

	if (GetRCheck(XRCID("ID_DEFAULT_CUSTOM")))
		pOptions->SetOption(OPTION_EDIT_DEFAULTEDITOR, _T("2") + GetText(XRCID("ID_EDITOR")));
	else 
		pOptions->SetOption(OPTION_EDIT_DEFAULTEDITOR, GetRCheck(XRCID("ID_DEFAULT_TEXT")) ? _T("1") : _T("0"));

	if (GetRCheck(XRCID("ID_USEDEFAULT")))
		pOptions->SetOption(OPTION_EDIT_ALWAYSDEFAULT, 1);
	else
		pOptions->SetOption(OPTION_EDIT_ALWAYSDEFAULT, 0);

	SetOptionFromCheck(XRCID("ID_EDIT_TRACK_LOCAL"), OPTION_EDIT_TRACK_LOCAL);
		
	return true;
}
开发者ID:ErichKrause,项目名称:filezilla,代码行数:18,代码来源:optionspage_edit.cpp

示例10:

CEnemyPsycrow::CEnemyPsycrow()
{
	CSGD_EventSystem *pES = CSGD_EventSystem::GetInstance();
	CSGD_TextureManager *pTM = CSGD_TextureManager::GetInstance();
	COptions *op = COptions::GetInstance();

	pES->RegisterClient("psycrow fire", this);
	pES->RegisterClient("state transition 1", this);
	pES->RegisterClient("state transition 2", this);
	pES->RegisterClient("state transition 3", this);
	pES->RegisterClient("state transition 4", this);

	m_nState = PSYCROW_STATE1;
	m_nSoundID = CSGD_WaveManager::GetInstance()->LoadWave("Resource/sounds/JoA_Squawk.wav");
	CSGD_WaveManager::GetInstance()->SetVolume(m_nSoundID, op->GetSFXVolume() - 40);
	m_fFireReady = 5.0f;
	m_fHitTimer = 0.4f;
	m_nOffset = 0;
	bIsFired = false;
	m_fFiringTimer = 0.5f;
	m_fSineFloat = 3.14f;
	m_nColor = 255;
	m_nScale = 1.5f;

	SetHP(250 * op->GetDifficulty());
	SetVelX(75 * op->GetDifficulty());
	SetVelY(0.0f);
	SetXFlip(-1);
	SetHeight(84);
	SetWidth(70);
	SetPosX(320);
	SetPosY(240);
	SetPower(0);
	SetType(ACTOR_ENEMY);
	SetScoreValue(1000 * op->GetDifficulty());
	SetHit(false);
	pBullet = NULL;

	bIsFiring = false;

}
开发者ID:jakneute,项目名称:Earthworm-Jim-Full-Sail-Game-Project,代码行数:41,代码来源:EnemyPsycrow.cpp

示例11:

CEnemyBusiness::CEnemyBusiness()
{
	CSGD_EventSystem *pES = CSGD_EventSystem::GetInstance();
	CSGD_TextureManager *pTM = CSGD_TextureManager::GetInstance();
	COptions *op = COptions::GetInstance();
	CSGD_WaveManager *pWM = CSGD_WaveManager::GetInstance();

	pES->RegisterClient("businessman fire", this);

	SetHP(50 *op->GetDifficulty());
	SetVelX(-50.0f * op->GetDifficulty());
	SetVelY(0.0f);
	SetXFlip(-1);
	SetHeight(63);
	SetWidth(86);
	SetPosX(1000);
	SetPosY(220);
	SetPower(0);
	SetType(ACTOR_ENEMY);
	SetScoreValue(200 * op->GetDifficulty());
	SetHit(false);
	pBullet = NULL;

	bIsFiring = false;

	m_fFireReady = 5.0f;
	m_fHitTimer = 1.0f;
	m_nOffset = 0;
	m_fFiringTimer = 1.0f;

	rEnemyRect.top = 18;
	rEnemyRect.bottom = 61;
	rEnemyRect.left = 2;
	rEnemyRect.right = 54;

	m_nSoundID = pWM->LoadWave("Resource/sounds/JoA_Scream.wav");
	pWM->SetVolume(m_nSoundID,op->GetSFXVolume() - 25);
	

}
开发者ID:jakneute,项目名称:Earthworm-Jim-Full-Sail-Game-Project,代码行数:40,代码来源:EnemyBusiness.cpp

示例12: Init

//---------------------------------------------------------------------------//
// Init
//
//---------------------------------------------------------------------------//
bool CFilterDll::Init(COptions &aOptions)
{
  m_Ok = false;

  const string &sFile = aOptions.Option("library");
  if (sFile == "")
  {
    GLOG(("ERR: Library file not specified\n"));
    return false;
  }
  m_hLibrary = LoadLibrary(sFile.c_str());
  if (!m_hLibrary)
  {
    GLOG(("ERR: Can't load library %s\n", sFile.c_str()));
    return false;
  }

  if (!LoadFunctions())
  {
    GLOG(("ERR: FilterDLL version from file %s is not compatible with current version (%d)\n", sFile.c_str(), FILTER_VERSION));
    FreeLibrary(m_hLibrary);
    return false;
  }

  // Filter init
  int iErr = m_pFncInit(FILTER_VERSION, this, g_DisplayDevice.GetD3DDevice(), aOptions.Options(), &m_uID);
  if (iErr)
  {
    if (iErr == -1)
      GLOG(("ERR: FilterDLL version from file %s is not compatible with this one (%d)\n", sFile.c_str(), FILTER_VERSION));
    else
      GLOG(("ERR: FilterDLL can't load library %s. Return code = %d\n", sFile.c_str(), iErr));
    FreeLibrary(m_hLibrary);
    return false;
  }

  m_Ok = true;
  return m_Ok;
}
开发者ID:EQ4,项目名称:neonv2,代码行数:43,代码来源:FilterDll.cpp

示例13: Run

bool CUpdateWizard::Run()
{
	COptions* pOptions = COptions::Get();

	if (CBuildInfo::GetVersion() == _T("custom build"))
		return false;

	const wxString& newVersion = pOptions->GetOption(OPTION_UPDATECHECK_NEWVERSION);
	if (newVersion == _T(""))
		return RunWizard(m_pages.front());

	if (CBuildInfo::ConvertToVersionNumber(newVersion) <= CBuildInfo::ConvertToVersionNumber(CBuildInfo::GetVersion()))
	{
		pOptions->SetOption(OPTION_UPDATECHECK_NEWVERSION, _T(""));
		return RunWizard(m_pages.front());
	}

	// Force another check
	PrepareUpdateCheckPage();
	m_start_check = true;
	m_currentPage = 0;

	return RunWizard(m_pages[0]);
}
开发者ID:madnessw,项目名称:thesnow,代码行数:24,代码来源:updatewizard.cpp

示例14: InitAutoUpdateCheck

void CUpdateWizard::InitAutoUpdateCheck()
{
	COptions* pOptions = COptions::Get();
	wxASSERT(pOptions->GetOptionVal(OPTION_UPDATECHECK));

	if (CBuildInfo::GetVersion() == _T("custom build"))
		return;

	// Check every hour if allowed to check for updates

	m_autoCheckTimer.Start(1000 * 3600);
	if (!CanAutoCheckForUpdateNow())
	{
		DisplayUpdateAvailability(false);
		return;
	}
	else
	{
		m_autoUpdateCheckRunning = true;
		const wxDateTime& now = wxDateTime::Now();
		pOptions->SetOption(OPTION_UPDATECHECK_LASTDATE, now.Format(_T("%Y-%m-%d %H:%M:%S")));
		StartUpdateCheck();
	}
}
开发者ID:madnessw,项目名称:thesnow,代码行数:24,代码来源:updatewizard.cpp

示例15: if

LRESULT CALLBACK CServer::WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	CServer *pServer=(CServer *)GetWindowLongPtr(hWnd, GWLP_USERDATA);

	if (message == WM_CLOSE) {
		pServer->OnClose();
		return 0;
	}
	else if (hWnd && message == WM_DESTROY) {
		ASSERT (hWnd == pServer->m_hWnd);
		HANDLE *handle = new HANDLE[pServer->m_ThreadArray.size()];
		unsigned int i = 0;
		for (auto iter = pServer->m_ThreadArray.begin(); iter != pServer->m_ThreadArray.end(); ++iter, ++i) {
			handle[i] = (*iter)->m_hThread;
			(*iter)->PostThreadMessage(WM_QUIT, 0, 0);
		}
		for (i = 0; i < pServer->m_ThreadArray.size(); ++i) {
			int res = WaitForSingleObject(handle[i], INFINITE);
			if (res == WAIT_FAILED)
				res = GetLastError();
		}
		delete [] handle;
		handle = new HANDLE[pServer->m_ClosedThreads.size()];
		i = 0;
		for (auto iter = pServer->m_ClosedThreads.begin(); iter != pServer->m_ClosedThreads.end(); ++iter, ++i) {
			handle[i] = (*iter)->m_hThread;
			(*iter)->PostThreadMessage(WM_QUIT, 0, 0);
		}
		for (i = 0; i < pServer->m_ClosedThreads.size(); ++i) {
			int res = WaitForSingleObject(handle[i], INFINITE);
			if (res == WAIT_FAILED)
				res = GetLastError();
		}
		delete [] handle;
		pServer->m_AdminListenSocketList.clear();
		delete pServer->m_pAdminInterface;
		pServer->m_pAdminInterface = NULL;
		delete pServer->m_pOptions;
		pServer->m_pOptions = NULL;
		if (pServer->m_nTimerID) {
			KillTimer(pServer->m_hWnd, pServer->m_nTimerID);
			pServer->m_nTimerID = 0;
		}
		PostQuitMessage(0);
		return 0;
	}
	else if (message == WM_TIMER)
		pServer->OnTimer(wParam);
	else if (message == WM_FILEZILLA_RELOADCONFIG) {
		COptions options;
		options.ReloadConfig();
		CPermissions perm = CPermissions(std::function<void()>());
		perm.ReloadConfig();
	}
	else if (message >= WM_FILEZILLA_SERVERMSG) {
		UINT index = message - WM_FILEZILLA_SERVERMSG;
		if (index >= pServer->m_ThreadNotificationIDs.size())
			return 0;

		CServerThread *pThread = pServer->m_ThreadNotificationIDs[index];
		if (pThread) {
			std::list<CServerThread::t_Notification> notifications;
			pThread->GetNotifications(notifications);
			for (std::list<CServerThread::t_Notification>::const_iterator iter = notifications.begin(); iter != notifications.end(); iter++)
				if (pServer->OnServerMessage(pThread, iter->wParam, iter->lParam) != 0)
					break;
		}
		return 0;
	}

	return ::DefWindowProc(hWnd, message, wParam, lParam);
}
开发者ID:soulic,项目名称:FileZilla-Server,代码行数:72,代码来源:Server.cpp


注:本文中的COptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。