Пример #1
0
void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
{
    for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
        if (mask & (1 << i))
            m_accountData[i] = AccountData();

    if (!result)
        return;

    do
    {
        Field *fields = result->Fetch();
        uint32 type = fields[0].GetUInt8();
        if (type >= NUM_ACCOUNT_DATA_TYPES)
        {
            sLog->outError("Table `%s` have invalid account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
            continue;
        }

        if ((mask & (1 << type)) == 0)
        {
            sLog->outError("Table `%s` have non appropriate for table  account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
            continue;
        }

        m_accountData[type].Time = time_t(fields[1].GetUInt32());
        m_accountData[type].Data = fields[2].GetString();
    }
    while (result->NextRow());
}
Пример #2
0
BOOL CBibexeApp::InitInstance()
{
	/* display the login dialog */
	CLoginDlg Ldlg;
	CBibDlg  *lpdlg;

        InitArborLocale();

	if (! (m_hGAL = LoadLibrary("gal.dll")))
	{
		CGuiMsg::GuiMessage( GUIMSG_GAL_DLL_LOAD_FAILED);
		return FALSE;
	}
	
	// initialize internationalized labels
	//-----gmf 24.03.00-----------------------------------------------------
	if (m_hbibResources)
        	::FreeLibrary(m_hbibResources);

    /* Look for a resource-only dll, regardless of language.
     */
   
    m_hbibResources = CArbResourceDLL::LoadResLibrary(_T("bibexe_res.dll"));
	
    if (! m_hbibResources)
	{
		AfxMessageBox(_T("Could not load application resource DLL.  Exiting..."));
		return FALSE;
	}

	AfxSetResourceHandle(m_hbibResources);
   CArborApp::InitInstance();

	//----------------------------------------------------------

 	Enable3dControls();

  CAccountData AccountData(TRUE, TRUE);

	//
	// Log in to the catalog database.
	//
	CArborCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	if( Ldlg.LoginToCatalog( AccountData, FALSE, &cmdInfo ) != ABP_SUCCESS )
		return FALSE;  // Logout done in destructor
	if (AccountData.LoginToAdmin() == FALSE)
		return FALSE;  // Logout done in destructor

	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Requires the securitytypes.h (or securityclass.h)
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//	if(!AccountData.m_lpSecurity->IsAllowed(SECURITY_BIB))
//	{
//		CGuiMsg::GuiMessage( GUIMSG_BIB_ACCESS_DENIED );
//		return FALSE; 
//	}


  LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	lpdlg = new CBibDlg ( AccountData );

	m_pMainWnd =  lpdlg;

	int nResponse = lpdlg->DoModal();
	delete lpdlg;
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	AccountData.Logout();

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}