本文整理汇总了C++中RepositoryPtr::GetAddonHash方法的典型用法代码示例。如果您正苦于以下问题:C++ RepositoryPtr::GetAddonHash方法的具体用法?C++ RepositoryPtr::GetAddonHash怎么用?C++ RepositoryPtr::GetAddonHash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RepositoryPtr
的用法示例。
在下文中一共展示了RepositoryPtr::GetAddonHash方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Install
bool CAddonInstaller::Install(const std::string &addonID, bool force, const std::string &referer, bool background)
{
AddonPtr addon;
bool addonInstalled = CAddonMgr::Get().GetAddon(addonID, addon, ADDON_UNKNOWN, false);
if (addonInstalled && !force)
return true;
if (referer.empty())
{
if (!g_passwordManager.CheckMenuLock(WINDOW_ADDON_BROWSER))
return false;
}
// check whether we have it available in a repository
CAddonDatabase database;
database.Open();
if (database.GetAddon(addonID, addon))
{
std::string repo;
database.GetRepoForAddon(addonID,repo);
AddonPtr ptr;
CAddonMgr::Get().GetAddon(repo,ptr);
RepositoryPtr therepo = boost::dynamic_pointer_cast<CRepository>(ptr);
std::string hash;
if (therepo)
hash = therepo->GetAddonHash(addon);
return DoInstall(addon, hash, addonInstalled, referer, background);
}
return false;
}
示例2: GetAddonWithHash
bool CAddonInstallJob::GetAddonWithHash(const std::string& addonID, RepositoryPtr& repo,
ADDON::AddonPtr& addon, std::string& hash)
{
if (!CAddonMgr::GetInstance().FindInstallableById(addonID, addon))
return false;
AddonPtr tmp;
if (!CAddonMgr::GetInstance().GetAddon(addon->Origin(), tmp, ADDON_REPOSITORY))
return false;
repo = std::static_pointer_cast<CRepository>(tmp);
return repo->GetAddonHash(addon, hash);
}
示例3: Install
void CAddonInstaller::Install(const CStdString &addonID, bool force, const CStdString &referer, bool background)
{
AddonPtr addon;
bool addonInstalled = CAddonMgr::Get().GetAddon(addonID, addon);
if (addonInstalled && !force)
return;
// check whether we have it available in a repository
CAddonDatabase database;
database.Open();
if (database.GetAddon(addonID, addon))
{
CStdString repo;
database.GetRepoForAddon(addonID,repo);
AddonPtr ptr;
CAddonMgr::Get().GetAddon(repo,ptr);
RepositoryPtr therepo = boost::dynamic_pointer_cast<CRepository>(ptr);
CStdString hash;
if (therepo)
hash = therepo->GetAddonHash(addon);
// check whether we already have the addon installing
CSingleLock lock(m_critSection);
if (m_downloadJobs.find(addonID) != m_downloadJobs.end())
return; // already installing this addon
if (background)
{
unsigned int jobID = CJobManager::GetInstance().AddJob(new CAddonInstallJob(addon, hash, addonInstalled, referer), this);
m_downloadJobs.insert(make_pair(addon->ID(), CDownloadJob(jobID)));
}
else
{
m_downloadJobs.insert(make_pair(addon->ID(), CDownloadJob(0)));
lock.Leave();
CAddonInstallJob job(addon, hash, addonInstalled, referer);
if (!job.DoWork())
{ // TODO: dump something to debug log?
}
lock.Enter();
JobMap::iterator i = m_downloadJobs.find(addon->ID());
m_downloadJobs.erase(i);
}
}
}
示例4: GetAddonWithHash
bool CAddonInstallJob::GetAddonWithHash(const std::string& addonID, ADDON::AddonPtr& addon, std::string& hash)
{
CAddonDatabase database;
if (!database.Open())
return false;
if (!database.GetAddon(addonID, addon))
return false;
AddonPtr ptr = GetRepoForAddon(addon);
if (ptr == NULL)
return false;
RepositoryPtr repo = std::dynamic_pointer_cast<CRepository>(ptr);
if (repo == NULL)
return false;
hash = repo->GetAddonHash(addon);
return true;
}
示例5: Install
bool CAddonInstaller::Install(const CStdString &addonID, bool force, const CStdString &referer, bool background)
{
AddonPtr addon;
bool addonInstalled = CAddonMgr::Get().GetAddon(addonID, addon, ADDON_UNKNOWN, false);
if (addonInstalled && !force)
return true;
// check whether we have it available in a repository
CAddonDatabase database;
database.Open();
if (database.GetAddon(addonID, addon))
{
CStdString repo;
database.GetRepoForAddon(addonID,repo);
AddonPtr ptr;
CAddonMgr::Get().GetAddon(repo,ptr);
RepositoryPtr therepo = boost::dynamic_pointer_cast<CRepository>(ptr);
CStdString hash;
if (therepo)
hash = therepo->GetAddonHash(addon);
return DoInstall(addon, hash, addonInstalled, referer, background);
}
return false;
}