//-------------------------------------------------------------------------- // 功能:读取以前的的登陆选择 //-------------------------------------------------------------------------- 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); } }
BOOL CChatFilter::Initialize() { Error_SetErrorString("CChatFilter::Initialize()"); if (m_pTextFilter) { return TRUE; } KPakFile FileChatFlt; if (FileChatFlt.Open((char*)file_chatflt) == FALSE) { Error_SetErrorCode(ERR_T_FILE_NO_FOUND); Error_SetErrorString(file_chatflt); return FALSE; } if (SUCCEEDED(g_libFilterText.CreateTextFilter(&m_pTextFilter))) { char* pBuffer = NULL; int nSize = FileChatFlt.Size(); if (nSize) pBuffer = (char*)_alloca(nSize + 1); if (pBuffer) { int nFinalSize = FileChatFlt.Read(pBuffer, nSize); if (nFinalSize >= nSize) pBuffer[nSize] = 0; else memset(pBuffer + nFinalSize, 0, nSize - nFinalSize + 1); char* pLineHeader = pBuffer; do { char* pLineEnd = strchr(pLineHeader, 0x0a); int nLineLen; if (pLineEnd) { *pLineEnd = 0; nLineLen = pLineEnd - pLineHeader; } else { nLineLen = nFinalSize - (pLineHeader - pBuffer); } if (pLineHeader[0] && nLineLen > 0) { if (pLineHeader[nLineLen - 1] == 0x0d) pLineHeader[--nLineLen] = 0; if (nLineLen) { EDOneTimePad_Decipher(pLineHeader, nLineLen); m_pTextFilter->AddExpression(pLineHeader); } } pLineHeader = pLineEnd ? pLineEnd + 1: NULL; }while(pLineHeader); } } FileChatFlt.Close(); if(m_pTextFilter) { return TRUE; } else { Error_SetErrorCode(ERR_T_MODULE_INIT_FAILED); return FALSE; } }