本文整理汇总了C++中AppDelegate::base64_xxtea_decode方法的典型用法代码示例。如果您正苦于以下问题:C++ AppDelegate::base64_xxtea_decode方法的具体用法?C++ AppDelegate::base64_xxtea_decode怎么用?C++ AppDelegate::base64_xxtea_decode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppDelegate
的用法示例。
在下文中一共展示了AppDelegate::base64_xxtea_decode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateFlow
std::string GameWin::updateFlow()
{
AppDelegate *app = (AppDelegate*)Application::getInstance();
std::string strLocal=DataAccess::getParamValue("LocalFlow");
if (strLocal.length() > 0)
{
strLocal = app->base64_xxtea_decode(strLocal);//format:x,x,x,x,x,x,
string::size_type pos;
string sSub;
for (int i = 0; i < 6; i++)
{
pos = strLocal.find(",");
if (pos != string::npos)//found
{
sSub = strLocal.substr(0, pos);
strLocal = strLocal.substr(pos + 1, strLocal.size() - 1);
m_iLocal[i] = atoi(sSub.c_str());
}
else return "\0";//wrong
}
m_iLocal[m_iCurrentGameID - 1] += iReward;
}
else m_iLocal[m_iCurrentGameID - 1] = iReward;
char cFlow[20] = "\0";
std::string strFlow = "";
for (int i = 0; i < 6; i++)
{
if (m_iLocal[i]>0)
{
sprintf(cFlow, "%d:%d,\0", i + 1, m_iLocal[i]);
strFlow += cFlow;
}
}
return strFlow;
}
示例2: onHttpRequestCompleted
void RegisterView::onHttpRequestCompleted(HttpClient *sender, HttpResponse *response)
{
std::string title = "\0";
std::string msg = "\0";
if (!response)
{
title = "Register Error\0";
msg = "Register Error.\0";
ShowMsg(title, msg);
return;
}
// You can get original request type from: response->request->reqType
if (0 != strlen(response->getHttpRequest()->getTag()))
{
log("%s completed", response->getHttpRequest()->getTag());
}
int statusCode = response->getResponseCode();
char statusString[64] = {};
sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag());
log("response code: %d", statusCode);
if (!response->isSucceed())
{
log("response failed");
log("error buffer: %s", response->getErrorBuffer());
title = "Register Error\0";
msg = "Register Error.\0";
ShowMsg(title, msg);
return;
}
if (statusCode != 200){
log("response code failed");
log("error buffer: %s", response->getErrorBuffer());
title = "Register Error\0";
msg = "Register Error.\0";
ShowMsg(title, msg);
return;
}
// dump data
std::vector<char> *buffer = response->getResponseData();
string sXml(buffer->begin(),buffer->end());
pugi::xml_document doc;
pugi::char_t cXml[1024];
strcpy(cXml,sXml.c_str());
pugi::xml_parse_result result = doc.load_string(cXml);
pugi::xml_node nodes = doc.child("mobileAppRegister");
std::string strError=nodes.child_value("error");
char p[100];
strcpy(p,strError.c_str());
if(atoi(p)==0)
{
//get user guid
string strUserGuid=nodes.child_value("UserGuid");
/*UserDefault::getInstance()->setStringForKey("UserGuid", strUserGuid);
UserDefault::getInstance()->setIntegerForKey("remember_me", 1);
UserDefault::getInstance()->setStringForKey("tweebaa_username", sUserName);
UserDefault::getInstance()->setStringForKey("tweebaa_Password", sPassword);
UserDefault::getInstance()->flush();*/
AppDelegate *app = (AppDelegate*)Application::getInstance();
sUserName = app->base64_xxtea_encode(sUserName);
sPassword = app->base64_xxtea_encode(sPassword);
string strTool = DataAccess::getParamValue("Total_Tool_Num","\0");
int iTool=0;
if (strTool.length() > 0)
{
iTool = atoi(app->base64_xxtea_decode(strTool).c_str());
}
DataAccess::addUser(strUserGuid, sUserName, sPassword);
_UserInfo userInfo = DataAccess::getUserInfoByName(sUserName);
m_UserID = userInfo.nUserID;
UserDefault::getInstance()->setIntegerForKey("CurrentUserId", m_UserID);
app->UpdateUserScore(1, 50);
char sTool[10];
sprintf(sTool, "%d", iTool + 10);
strTool = sTool;
strTool = app->base64_xxtea_encode(strTool);
DataAccess::setParamValue("Total_Tool_Num", strTool);
//get it
//string s=CCUserDefault::sharedUserDefault()->getStringForKey("UserGuid");
//auto scene = CollageMainTab::createScene();
/*auto scene = ChooseLayer::createScene();
TransitionScene *transition = TransitionFade::create(1, scene);
Director::getInstance()->replaceScene(transition);*/
this->cleanup();
m_Refresh = 1;
Director::getInstance()->popScene();
}
if(atoi(p)==-1){
title = "Input Error\0";
//.........这里部分代码省略.........
示例3: LoadResources
//.........这里部分代码省略.........
fileInfo._object7th=vT.sSeventhEle; //country
fileInfo._object8th=vT.sEighthEle; //sharecount
fileInfo._Cat = kPTypeNone;
fileInfo.id=vT.id;
HttpConnection::v_design_time_info.push_back(fileInfo); //save info for BrowseLayer
//判断文件是否存在
ifstream ifs(fileInfo.cache_filename);
if(!ifs)
{
std::strcpy(sUrl,Design_URL);
std::strcat(sUrl,vT.strListImage);
http_connect->HttpReqToCache(sUrl,vT.strListImage,fileInfo.cache_filename.c_str());
}
else
{
HttpConnection::numberOfLoadSprites++;
}
}
CC_SAFE_DELETE(pCTL);
////////////////////////////////loading published design//////////
std::strcpy(sUrl,Req_URL);
fileName = TEMP_filePath + "Design_Like.xml";
//G_UNM = UserDefault::getInstance()->getStringForKey("tweebaa_username");
AppDelegate *app = dynamic_cast<AppDelegate*>(Application::getInstance());
_UserInfo userInfo = DataAccess::getUserInfoByID(m_UserID);
G_UID = userInfo.strUserGuid;
G_UNM = app->base64_xxtea_decode(userInfo.strUserName);
//G_UNM = "dragon2934";
//G_UID = "eff4dca6-fedc-4bd9-bbe5-79dec2bb39d8";
if(G_UID.empty())
{
//HttpConnection::numberOfLoadSprites++;
HttpConnection::v_design_like_info.clear();
std::remove(fileName.c_str());
}
else
{
//Number_Resources--; //re-caculate with init number temporarily
pCTL = CollageTemplateList::LoadXMLFromDB("Collage.db3","CollageDesigns","user",G_UNM.c_str());
if(pCTL)
{
Number_Resources+=pCTL->vTemplate.size()>MAX_CacheFile?MAX_CacheFile:pCTL->vTemplate.size();
i=0;
for(auto vT: pCTL->vTemplate )
{
i++;
if(i==MAX_CacheFile+1) break; //装载的缓冲文件个数
if(!strcmp(vT.strListImage,"None"))
{
i--;
continue;
}
sprintf(filenamebuffer,"$D_%s",strrchr(vT.strListImage,'/')+1);
fileInfo.cache_filename= TEMP_filePath+Cache_Path +filenamebuffer;