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 }
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())); }
gcString DesuraJSBranchInfo::getBranchName(gcRefPtr<UserCore::Item::BranchInfoI> branch) { return branch->getName(); }
gcException IPCToolMain::installTool(gcRefPtr<UserCore::ToolInfo> info) { gcString exe(info->getExe()); gcString args(info->getArgs()); if (!UTIL::FS::isValidFile(exe.c_str())) return gcException(ERR_INVALIDFILE); if (exe.size() > 0 && args == "GAME_LIBRARY") { size_t pos = exe.find_last_of(".bz2"); if (pos == (exe.size()-1)) { UTIL::FS::Path pd(exe.c_str(), "", true); pd += UTIL::FS::File(info->getName()); gcString dest = pd.getFullPath(); uint64 size = UTIL::FS::getFileSize(exe.c_str()); try { UTIL::FS::FileHandle srcFh(exe.c_str(), UTIL::FS::FILE_READ); UTIL::FS::FileHandle destFh(dest.c_str(), UTIL::FS::FILE_WRITE); UTIL::MISC::BZ2Worker bz2(UTIL::MISC::BZ2_DECOMPRESS); srcFh.read(size, [&bz2, &destFh](const unsigned char* buff, uint32 size) -> bool { UTIL::FS::FileHandle *pDest = &destFh; bz2.write((const char*)buff, size, [&pDest](const unsigned char* buff, uint32 size) -> bool { pDest->write((const char*)buff, size); return false; }); return false; }); } catch (gcException &e) { return e; } info->overridePath(dest.c_str()); UTIL::FS::delFile(exe.c_str()); } else { info->overridePath(exe.c_str()); } } else if (args.find("PRECHECK_") == 0) { info->setInstalled(); } else { return gcException(ERR_TOOLINSTALL, gcString("Un-supported tool install [{0}]", info->getName())); } return gcException(ERR_COMPLETED); }