void InstalledWizardThread::onItemFound(gcRefPtr<UserCore::Item::ItemInfoI> &item) { bool verify = (item->isInstalled() && item->isDownloadable() && !(item->getStatus()&UserCore::Item::ItemInfoI::STATUS_LINK)); if (verify) { if (!m_pTaskGroup) { auto im = gcRefPtr<UserCore::ItemManager>::dyn_cast(getUserCore()->getItemManager()); gcAssert(im); m_pTaskGroup = im->newTaskGroup(UserCore::Item::ItemTaskGroupI::A_VERIFY); m_pTaskGroup->start(); } item->addSFlag(UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER|UserCore::Item::ItemInfoI::STATUS_VERIFING); auto handle = getUserCore()->getItemManager()->findItemHandle(item->getId()); handle->setPauseOnError(true); m_pTaskGroup->addItem(item); } DesuraId id = item->getId(); onItemFoundEvent(id); }
void ToolManager::addJSTool(gcRefPtr<UserCore::Item::ItemInfo> item, uint32 branchId, gcString name, gcString exe, gcString args, gcString res) { if (!item) return; auto branch = item->getBranchById(branchId); if (!branch) return; auto realBranch = gcRefPtr<UserCore::Item::BranchInfo>::dyn_cast(branch); if (!realBranch) return; bool found = false; gcRefPtr<JSToolInfo> jsinfo; BaseManager<ToolInfo>::for_each([&](gcRefPtr<ToolInfo> info) { auto temp = gcRefPtr<JSToolInfo>::dyn_cast(info); if (!temp) return; if (item->getId() == temp->getItemId() && name == info->getName() && temp->getBranchId() == branchId) { jsinfo = temp; found = true; } }); if (found) { if (!jsinfo->isRealyInstalled()) jsinfo->setExePath(exe.c_str()); return; } DesuraId toolId(m_iLastCustomToolId, DesuraId::TYPE_TOOL); m_iLastCustomToolId--; auto tool = gcRefPtr<JSToolInfo>::create(item->getId(), realBranch->getBranchId(), toolId, name, exe, args, res); realBranch->addJSTool(toolId); addItem(tool); }
gcString MCFManager::getMcfPath(gcRefPtr<UserCore::Item::ItemInfoI> item, bool isUnAuthed) { if (!item || !item->getCurrentBranch()) return ""; return getMcfPath(item->getId(), item->getCurrentBranch()->getBranchId(), item->getInstalledBuild(), isUnAuthed); }
void ChangeLogForm::setInfo(gcRefPtr<UserCore::Item::ItemInfoI> item) { if (!item) return; if (item->getIcon() && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(item->getIcon()))) setIcon(item->getIcon()); m_uiItemId = item->getId(); gcWString title(Managers::GetString(L"#CL_TITLE"), item->getName()); SetTitle(title); gcWString type = gcWString(m_uiItemId.getTypeString()); gcWString shortName(item->getShortName()); gcWString url(L"{0}/{1}/{2}/changelog", GetWebCore()->getUrl(WebCore::Root), type, shortName); if (item->getCurrentBranch()) url += gcWString(L"/{0}", item->getCurrentBranch()->getBranchId()); m_ieBrowser->loadUrl(url); #ifdef NIX Refresh(false); #endif }
BranchInstallInfo::BranchInstallInfo(uint32 biId, gcRefPtr<BranchItemInfoI> itemInfo, UTIL::FS::UtilFSI* pFileSystem) : m_BiId(biId) , m_pItem(itemInfo) , m_ItemId(itemInfo->getId()) , m_uiInstallSize(0) , m_uiDownloadSize(0) , m_pFileSystem(pFileSystem) { }
std::vector<gcRefPtr<UserCore::Item::ItemInfoI>> DesuraJSBinding::getMods(gcRefPtr<UserCore::Item::ItemInfoI> game) { auto im = getItemManager(); if (!game || !im) return std::vector<gcRefPtr<UserCore::Item::ItemInfoI>>(); std::vector<gcRefPtr<UserCore::Item::ItemInfoI>> mList; im->getModList(game->getId(), mList); return mList; }
void LaunchItemDialog::setInfo(gcRefPtr<UserCore::Item::ItemInfoI> item) { if (!item) { Close(); return; } if (item->getIcon() && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(item->getIcon()))) setIcon(item->getIcon()); m_uiInternId = item->getId(); m_labItemName->SetLabel(gcWString(Managers::GetString(L"#LI_LABEL"), m_uiInternId.getTypeString(), item->getName())); SetTitle(gcWString(L"{0} {1}..", Managers::GetString(L"#LAUNCH"), item->getName())); }