void WONVerifyVersion(const char *pVersion, const char *pRegion) { if (!pVersion || !pVersion[0]) g_pLTCSBase->CPrint("You need to provide a version number."); bool bSuccess = true; WONStatus nResult; GetDirOpPtr cGetDir = new GetDirOp(WONGetCurrentServerContext(g_lWONServerList)); cGetDir->SetPath(L"/" + g_sWONCommunity + L"/Patch"); cGetDir->SetFlags( DIR_GF_DECOMPSERVICES | DIR_GF_SERVADDNETADDR); nResult = cGetDir->Run(OP_MODE_BLOCK, OP_TIMEOUT_INFINITE); bSuccess &= (nResult == WS_Success); if (bSuccess) { bSuccess &= !cGetDir->GetDirEntityList().empty(); } if (!bSuccess) { g_pLTCSBase->CPrint("Unable to query patch server: %s", WONStatusToString(nResult)); return; } ServerContextPtr cServerContext = new ServerContext; cServerContext->AddAddressesFromDir(cGetDir->GetDirEntityList()); CheckValidVersionOpPtr pVersionOp = new CheckValidVersionOp(g_sWONProduct, cServerContext); pVersionOp->SetVersion(pVersion); pVersionOp->SetConfigName(pRegion); pVersionOp->SetGetPatchList(false); nResult = pVersionOp->Run(OP_MODE_BLOCK, OP_TIMEOUT_INFINITE); bSuccess &= (nResult == WS_Success); if (!bSuccess) { switch (nResult) { case WS_DBProxyServ_OutOfDate : case WS_DBProxyServ_ValidNotLatest : g_pLTCSBase->CPrint("Version is out of date, and there's an update available: %s", WONStatusToString(nResult)); break; case WS_DBProxyServ_OutOfDateNoUpdate : g_pLTCSBase->CPrint("Version is out of date, no updates available: %s", WONStatusToString(nResult)); break; default : g_pLTCSBase->CPrint("Unable to retrieve version info: %s", WONStatusToString(nResult)); break; } return; } g_pLTCSBase->CPrint("That version is the current, valid version"); return; }
void InitLogic::RunVersionOp() { ServerContext *aPatchServers = LobbyMisc::GetPatchServers(); LobbyConfig *aConfig = LobbyConfig::GetLobbyConfig(); if(aPatchServers==NULL || aConfig==NULL) return; LobbyEvent::BroadcastEvent(new LoginInitStatusEvent(LobbyContainer_CheckingVersion_String)); CheckValidVersionOpPtr anOp = new CheckValidVersionOp(aConfig->mProductName, aPatchServers); anOp->SetConfigName(aConfig->mLanguage); // set language anOp->SetVersion(aConfig->mVersion); anOp->SetGetPatchList(false); RunOpTrack(anOp,new InitLogicCompletion(CheckVersionCompletion,this)); }