本文整理汇总了C++中KIniFile::GetInteger方法的典型用法代码示例。如果您正苦于以下问题:C++ KIniFile::GetInteger方法的具体用法?C++ KIniFile::GetInteger怎么用?C++ KIniFile::GetInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KIniFile
的用法示例。
在下文中一共展示了KIniFile::GetInteger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadScheme
/*********************************************************************
* 功能:载入界面方案
**********************************************************************/
void KUiPortrait::LoadScheme(const char* pScheme)
{
if(ms_pSelf)
{
char Buff[128];
KIniFile Ini;
sprintf(Buff, "%s\\%s", pScheme, UI_PORTRAIT_INI);
if (Ini.Load(Buff))
{
ms_pSelf->Init(&Ini, "Main");
ms_pSelf->m_Confirm.Init(&Ini, "Confirm");
ms_pSelf->m_Cancel.Init(&Ini, "Cancel");
ms_pSelf->m_ScrollBar.Init(&Ini, "ScrollBar");
Ini.GetInteger("Set", "Column", 0, &ms_pSelf->m_nColumnCount);
Ini.GetInteger("Set", "Line", 0, &ms_pSelf->m_nLineCount);
Ini.GetInteger("Set", "SpacingH", 0, &ms_pSelf->m_nSpacingH);
Ini.GetInteger("Set", "SpacingV", 0, &ms_pSelf->m_nSpacingV);
Ini.GetInteger("Set", "ListLeft", 0, (int *)&ms_pSelf->m_LTPosition.x);
Ini.GetInteger("Set", "ListTop", 0, (int *)&ms_pSelf->m_LTPosition.y);
ms_pSelf->m_ScrollBar.SetValueRange(0, ms_pSelf->m_PortraitParam.nPortraitCount / ms_pSelf->m_nColumnCount - 2);
}
}
}
示例2: LoadScheme
//--------------------------------------------------------------------------
// 功能:载入窗口的界面方案
//--------------------------------------------------------------------------
void KUiConnectInfo::LoadScheme(const char* pScheme)
{
char Buff[128];
KIniFile Ini;
sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI);
if (Ini.Load(Buff))
{
Init(&Ini, "RuningImgBg");
m_ConfirmBtn.Init(&Ini, "ConfirmBtn");
m_InputPwdWnd.Init(&Ini, "Password");
m_DelRoleBtn.Init(&Ini, "DelRole");
m_DelRoleBgImg.Init(&Ini, "DelRoleBgImg");
m_CancelDelRoleBtn.Init(&Ini, "CancelDelRole");
Ini.GetString("Message", "MsgColor", "0,0,0", Buff, sizeof(Buff));
m_uMsgColor = GetColor(Buff);
Ini.GetString("Message", "MsgBorderColor", "0,0,0", Buff, sizeof(Buff));
m_uMsgBorderColor = GetColor(Buff);
Ini.GetString("Message", "MsgColor2", "0,0,0", Buff, sizeof(Buff));
m_uMsgColor2= GetColor(Buff);
Ini.GetString("Message", "MsgBorderColor2", "0,0,0", Buff, sizeof(Buff));
m_uMsgBorderColor2= GetColor(Buff);
Ini.GetInteger("Message", "ColorChangeInterval", 0, (int*)&m_uMsgColorChangeInterval);
Ini.GetInteger("Message", "Font", 12, &m_nFont);
int x, y, w, h;
Ini.GetInteger2("Message", "Pos", &x, &y);
Ini.GetInteger2("Message", "Size", &w, &h);
m_nTextCentreX = x + w / 2;
m_nTextCentreY = y;
Ini.GetString("RuningImgBg", "LoginBg", "", m_szLoginBg, sizeof(m_szLoginBg));
}
}
示例3: Init
//--------------------------------------------------------------------------
// 功能:初始化
//--------------------------------------------------------------------------
int KUiBase::Init()
{
if (g_pIme)
{
g_pIme->DisableLanguageChange();
g_pIme->CloseIME();
g_pIme->TurnOn();
}
KIniFile* pSetting = GetCommSettingFile();
char SchemeName[32] = "";
int nInterval = 20;
if (pSetting)
{
pSetting->GetString("Main", "LastUsedScheme", "", SchemeName, 32);
pSetting->GetInteger("Main", "WndMoveInterval", 20, &nInterval);
#ifdef _DEBUG
int nValue;
pSetting->GetInteger("Main", "ShowDebugFrameText", 0, &nValue);
WND_SHOW_DEBUG_FRAME_TEXT = nValue;
pSetting->GetInteger("Main", "ShowMouseOverWnd", 0, &nValue);
WND_SHOW_MOUSE_OVER_WND = nValue;
#endif
CloseCommSettingFile(false);
}
g_CreatePath(UI_USER_DATA_FOLDER);
g_CreatePath(UI_USER_DATA_TEMP_FOLDER);
KWndShowAnimate::SetInterval(nInterval);
LoadScheme(SchemeName);
return true;
}
示例4: GetServerList
//--------------------------------------------------------------------------
// 功能:登陆服务器列表获取
//--------------------------------------------------------------------------
KLoginServer* KLogin::GetServerList(int nRegion, int& nCount, int& nAdviceChoice)
{
KLoginServer* pServers = NULL;
nCount = 0;
nAdviceChoice = 0;
if (nRegion < 0)
{
KIniFile* pSetting = g_UiBase.GetCommSettingFile();
if (pSetting)
{
pSetting->GetInteger($LOGIN, "SelServerRegion", 0, &nRegion);
g_UiBase.CloseCommSettingFile(false);
}
}
KIniFile File;
int i;
if (File.Load(SERVER_LIST_FILE))
{
int nReadCount = 0;
char szSection[32], szKey[32], szBuffer[32];
File.GetInteger("List", "RegionCount", 0, &nReadCount); //区域的数目
if (nReadCount > 0 || nRegion >= 0 && nRegion < nReadCount)
{
m_Choices.nServerRegionIndex = nRegion;
sprintf(szSection, "Region_%d", nRegion);
File.GetInteger(szSection, "Count", 0, &nReadCount); //该区域服务器的数目
if (nReadCount > 0)
{
pServers = (KLoginServer*)malloc(sizeof(KLoginServer) * nReadCount);
if (pServers)
{
for (i = 0; i < nReadCount; i++)
{
sprintf(szKey, "%d_Address", i);
if (!File.GetString(szSection, szKey, "", szBuffer, sizeof(szBuffer)) ||
GetIpAddress(szBuffer, pServers[nCount].Address) == false)
{
continue;
}
sprintf(szKey, "%d_Title", i);
if (File.GetString(szSection, szKey, "", pServers[nCount].Title,
sizeof(pServers[nCount].Title)) &&
pServers[nCount].Title[0])
{
nCount ++;
}
}
if (nCount == 0)
{
free(pServers);
pServers = NULL;
}
}
}
}
}
if (nCount)
{
for (i = 0; i < nCount; i++)
{
if (strcmp(pServers[i].Title, m_Choices.AccountServer.Title) == 0)
{
nAdviceChoice = i;
break;
}
}
if (i >= nCount)
strcpy(m_Choices.AccountServer.Title, pServers[nAdviceChoice].Title);
m_Choices.AccountServer.Address[0] = pServers[nAdviceChoice].Address[0];
m_Choices.AccountServer.Address[1] = pServers[nAdviceChoice].Address[1];
m_Choices.AccountServer.Address[2] = pServers[nAdviceChoice].Address[2];
m_Choices.AccountServer.Address[3] = pServers[nAdviceChoice].Address[3];
}
return pServers;
}
示例5: LoadScheme
// -------------------------------------------------------------------------
// 函数 : KUiSelPlayer::LoadScheme
// 功能 : 载入界面方案
// -------------------------------------------------------------------------
void KUiSelPlayer::LoadScheme(const char* pScheme)
{
char Buff[128];
KIniFile Ini;
sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI_SELPLAYER);
if (Ini.Load(Buff))
{
Init(&Ini, "SelRole"); // 窗口背景数据
Ini.GetString("SelRole", "LoginBg", "", m_szLoginBg, sizeof(m_szLoginBg));
Ini.GetString("SelRole", "PlayerImgPrefix", "", m_szPlayerImgPrefix, sizeof(m_szPlayerImgPrefix));
Buff[0] = '\0'; // 清空缓存
m_btnOk.Init(&Ini, "Ok");
m_btnCancel.Init(&Ini, "Cancel");
m_btnDel.Init(&Ini, "Del");
m_btnNew.Init(&Ini, "New");
m_ButterflyWnd.Init(&Ini, "Butterfly");
m_player[0].Init(&Ini, "Player");
m_Name[0].Init(&Ini, "Name");
m_Level[0].Init(&Ini, "Level");
m_PlayerInfoBg[0].Init(&Ini, "PlayerInfoBg");
for (int i = 1; i < MAX_PLAYER_PER_ACCOUNT; i ++)
{
m_player[0].Clone(&m_player[i]);
m_Name[0].Clone(&m_Name[i]);
m_Level[0].Clone(&m_Level[i]);
m_PlayerInfoBg[0].Clone(&m_PlayerInfoBg[i]);
}
Ini.GetInteger("SelRole", "Player2Pos_0", 0, &m_ChildWndXOffset[0]);
Ini.GetInteger("SelRole", "Player2Pos_1", 0, &m_ChildWndXOffset[1]);
Ini.GetInteger("SelRole", "Player3Pos_0", 0, &m_ChildWndXOffset[2]);
Ini.GetInteger("SelRole", "Player3Pos_1", 0, &m_ChildWndYOffset);
Ini.GetInteger("SelRole", "Player3Pos_2", 0, &m_ChildWndXOffset[3]);
m_player[0].GetPosition(&m_ChildPos[0], NULL);
m_Name[0].GetPosition(&m_ChildPos[1], NULL);
m_Level[0].GetPosition(&m_ChildPos[2], NULL);
m_PlayerInfoBg[0].GetPosition(&m_ChildPos[3], NULL);
m_LifeTimeText.Init(&Ini, "LifeTime");
}
}
示例6: ConnectAccountServer
//--------------------------------------------------------------------------
// 功能:连接游戏服务
//--------------------------------------------------------------------------
int KLogin::ConnectAccountServer(const unsigned char* pIpAddress)
{
KIniFile IniFile;
if (pIpAddress && IniFile.Load("\\Config.ini"))
{
int nPort;
IniFile.GetInteger("Server", "GameServPort", 8888, &nPort);
return g_NetConnectAgent.ClientConnectByNumericIp(pIpAddress, nPort);
}
return false;
}
示例7: LoadLoginChoice
//--------------------------------------------------------------------------
// 功能:读取以前的的登陆选择
//--------------------------------------------------------------------------
void KLogin::LoadLoginChoice()
{
if (m_Choices.bLoaded)
return;
memset(&m_Choices, 0, sizeof(m_Choices));
ClearAccountPassword(true, true);
m_Choices.bLoaded = true;
KIniFile* pSetting = g_UiBase.GetCommSettingFile();
char szAccount[32];
KSG_PASSWORD Password;
if (pSetting)
{
pSetting->GetInteger($LOGIN, "SelServerRegion", 0, &m_Choices.nServerRegionIndex);
pSetting->GetString($LOGIN, "LastGameServer", "", m_Choices.AccountServer.Title, sizeof(m_Choices.AccountServer.Title));
szAccount[0] = 0;
pSetting->GetStruct($LOGIN, $LAST_ACCOUNT, szAccount, sizeof(szAccount));
if (szAccount[0])
{
EDOneTimePad_Decipher(szAccount, strlen(szAccount));
m_Choices.bRememberAccount = true;
SetAccountPassword(szAccount, NULL);
Password.szPassword[0] = '\0';
pSetting->GetStruct($LOGIN, $LAST_PASSWORD, Password.szPassword, sizeof(Password.szPassword));
if (Password.szPassword[0])
{
EDOneTimePad_Decipher(Password.szPassword, strlen(Password.szPassword));
m_Choices.bRememberAll = true;
SetAccountPassword(NULL, &Password);
memset(&Password, 0, sizeof(Password));
}
}
if (szAccount[0])
{
KIniFile* pPrivate = g_UiBase.GetPrivateSettingFile();
if (pPrivate)
{
if (pPrivate->GetString("Main", "LastSelCharacter", "",
m_Choices.szProcessingRoleName, sizeof(m_Choices.szProcessingRoleName)))
{
EDOneTimePad_Decipher(m_Choices.szProcessingRoleName, strlen(m_Choices.szProcessingRoleName));
}
}
g_UiBase.ClosePrivateSettingFile(false);
}
g_UiBase.CloseCommSettingFile(false);
}
}
示例8: SchemeCount
//--------------------------------------------------------------------------
// 功能:获得界面方案的数目
//--------------------------------------------------------------------------
int KUiBase::SchemeCount()
{
int nCount = 0;
KIniFile* pIni = GetCommConfigFile();
if (pIni)
{
pIni->GetInteger(THEME_SECTION, "Count", 0, &nCount);
if (nCount < 0)
nCount = 0;
CloseCommConfigFile();
}
return nCount;
}
示例9: itoa
/*
.-~~-.--. : )
.~ ~ -.\ /.- ~~ . > `. .' <
( .- -. ) `- -.-~ `- -' ~-.- -'
( : ) _ _ .-:
~--. : .--~ .-~ .-~ }
~-.-^-.-~ \_ .~ .-~ .~
\ \' \ '_ _ -~
`.`. //
. - ~ ~-.__`.`-.//
.-~ . - ~ }~ ~ ~-.~-.
.' .-~ .-~ :/~-.~-./:
/_~_ _ . - ~ ~-.~-._
~-.<
(给你,最可爱的人 :)
//初始化头像
*/
int KUiPortrait::InitializeProtrait()
{
KIniFile Ini;
if(Ini.Load(PORTRAIT_IMAGE_INI))
{
Ini.GetInteger("Main", "Count", 0, &m_PortraitParam.nPortraitCount);
Ini.GetInteger("Main", "Width", 0, &m_PortraitParam.nPortraitWidth);
Ini.GetInteger("Main", "Height", 0, &m_PortraitParam.nPortraitHeight);
if(m_pImage)
{
delete m_pImage;
m_pImage = NULL;
}
m_pImage = new KUiImageRef[m_PortraitParam.nPortraitCount + 1];
if(m_pImage)
{
char szBuf[8];
for(int i = 1;i < m_PortraitParam.nPortraitCount + 1;i++)
{
IR_InitUiImageRef(m_pImage[i]);
Ini.GetString("Image", itoa(i, szBuf, 10), "", m_pImage[i].szImage, sizeof(m_pImage[i].szImage));
m_pImage[i].bRenderFlag = RUIMAGE_RENDER_FLAG_REF_SPOT;
m_pImage[i].nType = ISI_T_SPR;
m_pImage[i].nFlipTime = 0;
m_pImage[i].nInterval = 0;
m_pImage[i].nNumFrames = 0;
m_pImage[i].Color.Color_b.r = 0;
m_pImage[i].Color.Color_b.g = 0;
m_pImage[i].Color.Color_b.b = 0;
m_pImage[i].Color.Color_b.a = LOLIGHT_ALPHA;
}
return 1;
}
}
return 0;
}
示例10: OnEnableAutoLogin
void KUiLogin::OnEnableAutoLogin()
{
KIniFile* pSetting = g_UiBase.GetCommConfigFile();
int nAutoLogin = false;
if (pSetting)
{
pSetting->GetInteger("Main", "AutoLogin", 0, &nAutoLogin);
g_UiBase.CloseCommConfigFile();
}
if (nAutoLogin == 6323)
{
g_LoginLogic.SetRememberAllFlag(true);
m_RememberAccount.CheckButton(true);
}
}
示例11: Init
BOOL KInlinePicSink::Init(iRepresentShell* pShell)
{
m_pRepShell = pShell;
if (!m_pRepShell)
return FALSE;
KIniFile ini;
#define CHAR_BUFFER_LEN 32
char szBuffer[CHAR_BUFFER_LEN * 2], szIndex[8];
int nPicCount = 0, i = 0;
KUiImageRef CurrentImg;
KImageParam Param;
if (!ini.Load(CHAT_FACE_INI_FILE))
return FALSE;
//ini.GetString("Main", "Path", "\\spr\\Ui\\聊天\\表情", szPath, CHAR_BUFFER_LEN);
ini.GetInteger("List", "Count", 0, &nPicCount);
if (nPicCount > MAX_SYSTEM_INLINE_PICTURES)
nPicCount = MAX_SYSTEM_INLINE_PICTURES;
for (i = 0; i < nPicCount; i++)
{
sprintf(szIndex, "Face%d", i + 1);
if (!ini.GetString(szIndex, "Spr", "", szBuffer, CHAR_BUFFER_LEN))
{
_ASSERT(0);
break;
}
IR_InitUiImageRef(CurrentImg);
CurrentImg.nFlipTime = 0;
CurrentImg.nInterval = 0;
CurrentImg.nNumFrames = 0;
strncpy(CurrentImg.szImage, szBuffer, sizeof(CurrentImg.szImage));
CurrentImg.szImage[sizeof(CurrentImg.szImage) - 1] = 0;
CurrentImg.bRenderFlag = RUIMAGE_RENDER_FLAG_REF_SPOT;
CurrentImg.nType = ISI_T_SPR;
memset(&Param, 0, sizeof(Param));
pShell->GetImageParam(CurrentImg.szImage, &Param, CurrentImg.nType);
m_Images.push_back(CurrentImg);
m_ImageParams.push_back(Param);
}
if (FAILED(m_pRepShell->AdviseRepresent(this)))
return FALSE;
if (FAILED(AdviseEngine(this)))
return FALSE;
return TRUE;
}
示例12: DefaultScheme
//重新初始化界面
void KUiHeaderControlBar::DefaultScheme(const char* pScheme)
{
char Buff[128];
KIniFile Ini;
if (m_pSelf)
{
sprintf(Buff, "%s\\"SCHEME_INI, pScheme);
if (Ini.Load(Buff))
{
int nValue1, nValue2;
Ini.GetInteger("Main", "Left", 0, &nValue1);
Ini.GetInteger("Main", "Top", 0, &nValue2);
m_pSelf->SetPosition(nValue1, nValue2);
}
}
}
示例13: LoadScheme
//载入界面方案
void KMouseOver::LoadScheme(const char* pScheme)
{
if (pScheme == NULL)
return;
char Buff[128];
KIniFile Ini;
sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI);
if (Ini.Load(Buff))
{
Ini.GetInteger("Main", "ImgWidth", 0, &m_nImgWidth);
Ini.GetInteger("Main", "ImgHeight", 0, &m_nImgHeight);
Ini.GetInteger("Main", "Indent", 0, &m_nIndent);
Ini.GetInteger("Main", "Font", 0, &m_nFontSize);
if(m_nImgWidth < 0)
m_nImgWidth = 0;
if(m_nImgHeight < 0)
m_nImgWidth = 0;
if(m_nFontSize < 8)
m_nFontSize = 8;
int nValue;
Ini.GetInteger("Main", "ImgType", 0, &nValue);
if (nValue == 1)
{
m_Image.nType = ISI_T_BITMAP16;
m_Image.bRenderStyle = IMAGE_RENDER_STYLE_OPACITY;
}
else
{
m_Image.nType = ISI_T_SPR;
m_Image.bRenderStyle = IMAGE_RENDER_STYLE_ALPHA;
m_Image.Color.Color_b.a = 255;
}
m_Image.uImage = 0;
m_Image.nISPosition = IMAGE_IS_POSITION_INIT;
Ini.GetString("Main", "Image", "" , m_Image.szImage, sizeof(m_Image.szImage));
Ini.GetInteger("Main", "Frame", 0, &nValue);
m_Image.nFrame = nValue;
Ini.GetString("Main", "TitleBgColor", "0, 0, 0", Buff, sizeof(Buff));
m_uTitleBgColor = ((GetColor(Buff) & 0xffffff) | 0x0a000000);
Ini.GetString("Main", "PropBgColor", "0, 0, 0", Buff, sizeof(Buff));
m_uPropBgColor = ((GetColor(Buff) & 0xffffff) | 0x0a000000);
Ini.GetString("Main", "DescBgColor", "0, 0, 0", Buff, sizeof(Buff));
m_uDescBgColor = ((GetColor(Buff) & 0xffffff) | 0x0a000000);
Update((m_nLeft + m_nWndWidth) / 2, m_nTop);
}
}
示例14:
//--------------------------------------------------------------------------
// 功能:获取服务器区域的列表
//--------------------------------------------------------------------------
KLoginServer* KLogin::GetServerRegionList(int& nCount, int& nAdviceChoice)
{
KLoginServer* pServers = NULL;
nCount = 0;
nAdviceChoice = 0;
KIniFile File;
int i;
if (File.Load(SERVER_LIST_FILE))
{
int nReadCount = 0;
char szKey[32];
File.GetInteger("List", "RegionCount", 0, &nReadCount);
if (nReadCount > 0)
{
pServers = (KLoginServer*)malloc(sizeof(KLoginServer) * nReadCount);
if (pServers)
{
for (i = 0; i < nReadCount; i++)
{
sprintf(szKey, "Region_%d", i);
if (File.GetString("List", szKey, "", pServers[nCount].Title,
sizeof(pServers[nCount].Title)) &&
pServers[nCount].Title[0])
{
nCount ++;
}
}
if (nCount == 0)
{
free(pServers);
pServers = NULL;
}
}
}
}
if (m_Choices.nServerRegionIndex < 0 || m_Choices.nServerRegionIndex >= nCount)
m_Choices.nServerRegionIndex = 0;
nAdviceChoice = m_Choices.nServerRegionIndex;
return pServers;
}
示例15: OnAutoLogin
void KUiInit::OnAutoLogin()
{
g_LoginLogic.LoadLoginChoice();
if (g_LoginLogic.IsAutoLoginEnable())
{
KIniFile* pSetting = g_UiBase.GetCommConfigFile();
int nAutoLogin = false;
if (pSetting)
{
pSetting->GetInteger("Main", "AutoLogin", 0, &nAutoLogin);
g_UiBase.CloseCommConfigFile();
}
if (nAutoLogin == 6323)
{
CloseWindow();
KUiConnectInfo::OpenWindow(CI_MI_CONNECTING, LL_S_IN_GAME);
g_LoginLogic.AutoLogin();
}
}
}