Example #1
0
//--------------------------------------------------------------------------
//	功能:保存登陆选择设置
//--------------------------------------------------------------------------
void KLogin::SaveLoginChoice()
{

	KIniFile*	pSetting = g_UiBase.GetCommSettingFile();
	int	i;
	if (pSetting)
	{
		//----纪录选择的服务器----
		pSetting->WriteInteger($LOGIN, "SelServerRegion", m_Choices.nServerRegionIndex);
		if (m_Choices.AccountServer.Title[0])
		{
			pSetting->WriteString($LOGIN, "LastGameServer", m_Choices.AccountServer.Title);
		}

		char	szBuffer[32];
		//----纪录最后一次登陆账号----
		pSetting->EraseKey($LOGIN, $LAST_ACCOUNT);

		if (m_Choices.bRememberAccount)
		{
			GetAccountPassword(szBuffer, NULL);
			i = strlen(szBuffer);
			EDOneTimePad_Encipher(szBuffer, i);
			pSetting->WriteStruct($LOGIN, $LAST_ACCOUNT, szBuffer, sizeof(szBuffer));

			if (m_Choices.bRememberAll)
			{
                KSG_PASSWORD Password;
				GetAccountPassword(NULL, &Password);
				i = strlen(Password.szPassword);
				EDOneTimePad_Encipher(Password.szPassword, i);
				pSetting->WriteStruct($LOGIN, $LAST_PASSWORD, Password.szPassword, sizeof(Password.szPassword));
			}

			KIniFile*	pPrivate = g_UiBase.GetPrivateSettingFile();
			if (pPrivate)
			{
				if (m_Choices.szProcessingRoleName[0])
				{
					i = strlen(m_Choices.szProcessingRoleName);
					memcpy(szBuffer, m_Choices.szProcessingRoleName, i);
					szBuffer[i] = 0;
					EDOneTimePad_Encipher(szBuffer, i);
					pPrivate->WriteString("Main", "LastSelCharacter", szBuffer);
				}
				g_UiBase.ClosePrivateSettingFile(true);
			}
		}

		g_UiBase.CloseCommSettingFile(true);
	}
}
KUiFriendInterview::~KUiFriendInterview()
{
	if (m_pFirstSelf == NULL)
	{
		KIniFile* pSetting = g_UiBase.GetPrivateSettingFile();
		if (pSetting)
		{
			char	szColor[16];
			m_SelfTextColor.Color_dw = m_uLastTextColor;
			sprintf(szColor, "%d,%d,%d", m_SelfTextColor.Color_b.r,
				m_SelfTextColor.Color_b.g, m_SelfTextColor.Color_b.b);
			pSetting->WriteString("UiConfig", "ChatColor", szColor);
			g_UiBase.ClosePrivateSettingFile(true);
		}
	}
}
Example #3
0
//--------------------------------------------------------------------------
//	功能:存储配置纪录
//--------------------------------------------------------------------------
int KUiBase::SavePrivateConfig()
{
	if (m_UserAccountId[0] == 0)
		return true;

	KIniFile* pConfigFile = GetPrivateSettingFile();
	if (pConfigFile)
	{
		pConfigFile->Clear();

		pConfigFile->WriteString("Main", "Scheme", m_CurScheme);
		//----逐个窗口保存配置设定----
		KUiSkillTree::SaveConfig(pConfigFile);
		KUiPlayerBar::SavePrivateSetting(pConfigFile);
		KUiChatCentre::SavePrivateSetting(pConfigFile);
		KShortcutKeyCentre::SavePrivateSetting(pConfigFile);
		::SaveStallPrivateConfig(pConfigFile);		//摆摊标价存盘
		//----逐个窗口保存配置设定结束----
		ClosePrivateSettingFile(true);
		return true;
	}
	return false;
}