void DownloadImgTask::doTask() { if (!m_pItem) return; gcString path; if (m_Image == ICON) path = m_pItem->getIconUrl(); else path = m_pItem->getLogoUrl(); if (path == "") return; WebCore::Misc::DownloadImageInfo dii(m_pItem->getId(), path); try { getWebCore()->downloadImage(&dii, m_bStopped); if (m_Image == ICON) m_pItem->setIcon(dii.outPath.c_str()); else m_pItem->setLogo(dii.outPath.c_str()); } catch (gcException &e) { Warning("Failed to download image {0}: {1}\n", path, e); } }
//сохранить в временые файлы структуры поиска bool cOutResult::outFile_tmpDI_index(void) { bool fOk = false; cGloballRunable *_gr = cGloballRunable::Instance(); string fn_index = tmpDir +"/"+DI_idx; string fn_tmp = tmpDir +"/"+DI_tmp; try { ofstream outFile_index(fn_index.c_str(), ios::out | ios::app | ios::binary ); ofstream outFile_tmp(fn_tmp.c_str(), ios::out | ios::app); outFile_index.seekp(0, ios::end); for (unordered_map<uint8_t, vector<cDI_out> >::iterator it = _gr->mGen->DI_out.begin(); it !=_gr->mGen->DI_out.end(); ++it) { vector<cDI_out> &vDI = it->second; for(size_t i = 0; i < vDI.size() ; i++) { cDI_out &di = vDI[i]; if (di.isDupl) { outFile_tmp <<outFile_index.tellp() <<'\t'; cDIindex dii(_gr->mGen, static_cast<eDeleciya>(it->first), di); outFile_index.write(reinterpret_cast<char*>(&dii), sizeof(class cDIindex) ); } else { outFile_tmp <<"-1" <<'\t'; } //поля необходимые outFile_tmp <<_gr->mGen->file <<'\t' <<_gr->mGen->locus <<'\t' <<_gr->mGen->geneName <<'\t' <<di.toString(_gr->mGen) <<Deleciya_toString(static_cast<eDeleciya>(it->first)) <<'\t' <<di.duplDel <<'\t' <<di.duplInv <<'\t' <<di.duplDelInv <<endl; } } outFile_index.seekp(0,ios::end); outFile_tmp.close(); outFile_index.close(); fOk = true;// удалось записать } catch(...) { cout <<endl <<"ERROR add to '" <<fn_index <<"'!!!" <<endl; cout <<endl <<"ERROR add to '" <<fn_tmp <<"'!!!" <<endl; fOk = false; } return fOk; }
void WebCoreClass::downloadBanner(MCFCore::Misc::DownloadProvider* dlp, const char* saveFolder) { if (!dlp) throw gcException(ERR_BADITEM); WebCore::Misc::DownloadImageInfo dii(dlp->getBanner()); bool stop = false; downloadImage(&dii, stop); dlp->setBanner(dii.outPath.c_str()); }