MCFBranch InstallBranch::getGlobal() { wxClientData* val = m_cbBranchList->GetClientObject(m_cbBranchList->GetSelection()); BranchData* b = dynamic_cast<BranchData*>(val); if (b) return b->global; return MCFBranch(); }
void CreateMCFThread::retrieveBranchList(std::vector<UserCore::Item::BranchInfo*> &outList) { TiXmlDocument doc; getWebCore()->getItemInfo(getItemId(), doc, MCFBranch(), MCFBuild()); TiXmlNode *uNode = doc.FirstChild("iteminfo"); if (!uNode) throw gcException(ERR_BADXML); XML::for_each_child("platform", uNode->FirstChildElement("platforms"), [this, &outList](TiXmlElement* platform) { this->processGames(outList, platform); }); }
void DownloadToolTask::validateTools() { std::vector<DesuraId> toolList; getItemInfo()->getCurrentBranch()->getToolList(toolList); if (toolList.size() == 0) return; if (!getUserCore()->getToolManager()->areAllToolsValid(toolList)) { //missing tools. Gather info again TiXmlDocument doc; getWebCore()->getItemInfo(getItemId(), doc, MCFBranch(), MCFBuild()); TiXmlNode *uNode = doc.FirstChild("iteminfo"); if (!uNode) throw gcException(ERR_BADXML); TiXmlNode *toolNode = uNode->FirstChild("toolinfo"); if (toolNode) getUserCore()->getToolManager()->parseXml(toolNode); TiXmlNode *gameNode = uNode->FirstChild("games"); if (!gameNode) throw gcException(ERR_BADXML); getItemInfo()->getCurrentBranch()->getToolList(toolList); } if (!getUserCore()->getToolManager()->areAllToolsValid(toolList)) throw gcException(ERR_INVALID, "Tool ids cannot be resolved into tools."); }
void CreateMCFThread::doRun() { UserCore::Item::ItemInfo *item = getItemInfo(); if (!item && !getUserCore()->isAdmin()) throw gcException(ERR_BADITEM); if (!item) { waitForItemInfo(); item = getItemInfo(); } if (isStopped()) return; if (!item) throw gcException(ERR_BADITEM); const char* val = getUserCore()->getCVarValue("gc_corecount"); if (val && atoi(val) != 0) m_hMCFile->setWorkerCount(atoi(val)); m_hMCFile->parseFolder(m_szPath.c_str(), true); if (m_hMCFile->getFileCount() == 0) throw gcException(ERR_ZEROFILECOUNT, gcString("There are no files in the folder {0}. \nPlease check to see if you have the correct folder and try again.", m_szPath)); if (item->getBranchCount() == 0) { m_hMCFile->setHeader(getItemId(), MCFBranch(), MCFBuild()); m_hMCFile->getHeader()->setParent(0); } else { std::vector<UserCore::Item::BranchInfo*> vBranchList; try { retrieveBranchList(vBranchList); if (vBranchList.size() != 0) compareBranches(vBranchList); } catch (...) { } safe_delete(vBranchList); } if (isStopped()) return; createMcf(); if (isStopped()) return; m_bComplete = true; onCompleteStrEvent(m_szFilePath); }
void CreateMCFThread::compareBranches(std::vector<UserCore::Item::BranchInfo*> &vBranchList) { uint64 lastSize = 0; //uint32 lastIndex = 0; unused variable McfHandle lastMcf; m_hMCFile->setHeader(getItemId(), MCFBranch(), MCFBuild()); m_hMCFile->getHeader()->setParent(0); for (size_t x=0; x<vBranchList.size(); x++) { if (isStopped()) return; UserCore::Item::BranchInfo* bi = vBranchList[x]; McfHandle tempMcf; tempMcf->setHeader(getItemId(), bi->getBranchId(), MCFBuild()); tempMcf->getErrorEvent() += delegate(&onErrorEvent); try { MCFCore::Misc::UserCookies uc; getWebCore()->setMCFCookies(&uc); tempMcf->getDownloadProviders(getWebCore()->getMCFDownloadUrl(), &uc); } catch (gcException &except) { Warning(gcString("CreateMCF: Failed to get download providers for mcf: {0}\n", except)); continue; } if (tempMcf->getHeader()->getBuild() > 0) { try { tempMcf->dlHeaderFromWeb(); } catch (gcException &except) { Warning(gcString("CreateMCF: Failed to get dlHeaderFromWeb for mcf: {0}\n", except)); continue; } uint64 totalSize = 0; uint32 fileCount = 0; m_hMCFile->getPatchStats(tempMcf.handle(), &totalSize, &fileCount); if (lastSize == 0 || totalSize < lastSize) { lastSize = totalSize; //lastIndex = x; lastMcf.setHandle(tempMcf.releaseHandle()); // if there are no files just use this one if (fileCount == 0) break; } } } MCFBuild build = lastMcf->getHeader()->getBuild(); MCFBranch branch = lastMcf->getHeader()->getBranch(); m_hMCFile->setHeader(getItemId(), branch, build); if (build > 0) m_hMCFile->getHeader()->addFlags( MCFCore::MCFHeaderI::FLAG_PARTFILE ); else m_hMCFile->getHeader()->delFlags( MCFCore::MCFHeaderI::FLAG_PARTFILE ); m_hMCFile->getHeader()->setParent(lastMcf->getHeader()->getBuild()); m_hMCFile->makePatch(lastMcf.handle()); }
UIUpdateServiceTask::UIUpdateServiceTask(UserCore::Item::ItemHandle* handle, const char* path, MCFBuild lastBuild) : UIBaseServiceTask(UserCore::Item::ITEM_STAGE::STAGE_UNINSTALL_UPDATE, "UnInstallUpdate", handle, MCFBranch(), lastBuild) { m_pIPCIM = nullptr; m_szPath = path; }
DownloadToolTask::DownloadToolTask(UserCore::Item::ItemHandle* handle, bool launch) : BaseItemTask(UserCore::Item::ItemHandleI::STAGE_DOWNLOADTOOL, "DownloadTool", handle, MCFBranch(), MCFBuild()) { m_ToolTTID = UINT_MAX; m_bLaunch = launch; m_bInstallAfter = true; m_bCancelled = false; }
UI::Forms::ItemForm* InternalLink::showItemForm(DesuraId id, UI::Forms::INSTALL_ACTION action, bool showForm) { return showItemForm(id, action, MCFBranch(), MCFBuild(), showForm); }