Beispiel #1
0
bool GatherInfoTask::handleInvalidBranch()
{
	MCFBranch branch = getMcfBranch();

	if (m_bCanceled || (m_pGIHH && !m_pGIHH->selectBranch(branch)))
	{
		completeStage();
		return false;
	}

	if (branch == UINT_MAX)
	{
		//means the item was set as a link and needs to be launched
		getItemHandle()->getInternal()->goToStageLaunch();
		return false;
	}
	else
	{
		if (branch.isGlobal())
			branch = getItemInfo()->getInternal()->getBestBranch(branch);

		UserCore::Item::BranchInfoI* branchInfo = getItemInfo()->getBranchById(branch);
		checkNullBranch(branchInfo);
	}

	m_uiMcfBranch = branch;
	return true;
}
bool VSCheckInstall::checkInstallComplex(bool completeMcf)
{
	if (HasAnyFlags(getItemInfo()->getStatus(), UserCore::Item::ItemInfoI::STATUS_INSTALLCOMPLEX) == false)
		return false;

	auto pItem = getItemInfo();
	auto pParent = getParentItemInfo();

	if (pParent)
	{
		if (!pParent->getInstalledModId().isOk() || pParent->getInstalledModId() != pItem->getId())
		{
			if (completeMcf)
				setResult(RES_COMPLETE);
			else
				setResult(RES_DOWNLOADMISSING);

			return true;
		}
	}
	else if (pItem->getInstalledModId().isOk())
	{
		setResult(RES_COMPLETE);
		return true;
	}

	return false;
}
bool UIUpdateServiceTask::initService()
{
	if (!UIBaseServiceTask::initService())
	{
		onComplete();
		return false;
	}

	gcString oldBranchMcf = getBranchMcf(getItemInfo()->getId(), getItemInfo()->getInstalledBranch(), getMcfBuild());

	m_pIPCIM = getServiceMain()->newUninstallBranch();
			
	if (!m_pIPCIM)
	{
		gcException eFailCrtBrnch(ERR_NULLHANDLE, "Failed to create uninstall update mcf service!\n");
		onErrorEvent(eFailCrtBrnch);
		return false;
	}

	m_pIPCIM->onCompleteEvent += delegate(this, &UIUpdateServiceTask::onComplete);
	m_pIPCIM->onProgressEvent += delegate(&onMcfProgressEvent);
	m_pIPCIM->onErrorEvent += delegate((UIBaseServiceTask*)this, &UIBaseServiceTask::onServiceError);

	m_pIPCIM->start(oldBranchMcf.c_str(), m_szPath.c_str(), getItemInfo()->getPath(), "");

	return true;
}
bool VSInstallMissing::doTask()
{
    const char* val = getUserCore()->getCVarValue("gc_corecount");
    gcException errFailMCFServ(ERR_NULLHANDLE, "Failed to create uninstall MCF service!\n");

    m_pIPCIM = getUserCore()->getServiceMain()->newInstallMcf();
    if (!m_pIPCIM)
    {
        onErrorEvent(errFailMCFServ);
        return false;
    }

    uint8 workers = 1;

    if (val)
        workers = atoi(val);

    if (workers == 0)
        workers = 1;

    m_pIPCIM->onCompleteEvent += delegate(this, &VSInstallMissing::onComplete);
    m_pIPCIM->onProgressEvent += delegate(&onProgressEvent);
    m_pIPCIM->onErrorEvent += delegate(&onErrorEvent);
    m_pIPCIM->start(m_hMcf->getFile(), getItemInfo()->getPath(), getItemInfo()->getInstallScriptPath(), workers);

    m_WaitCond.wait();

    m_bFinished = true;

    return isStopped() == false;
}
Beispiel #5
0
void VerifyServiceTask::checkHooks()
{
	refreshInfo();

	const char* hookPath = getItemInfo()->getInstallScriptPath();
	const char* insPath = getItemInfo()->getPath();

	if (hookPath && UTIL::FS::isValidFile(hookPath))
		getUserCore()->getServiceMain()->runInstallScript(hookPath, insPath, "PostInstall");
}
Beispiel #6
0
void VerifyServiceTask::finishVerify(UserCore::Misc::VerifyComplete::VSTATUS status, const char* installpath, bool endStage)
{
	if (m_bError)
		return;

	MCFCore::Misc::ProgressInfo prog;
	prog.percent = 100;
	onMcfProgressEvent(prog);

	UserCore::Item::ItemInfo* pItem = getItemInfo();

	if (pItem)
	{
		pItem->delSFlag(UserCore::Item::ItemInfoI::STATUS_VERIFING);

		if (status == UserCore::Misc::VerifyComplete::V_COMPLETE)
			pItem->addSFlag(UserCore::Item::ItemInfoI::STATUS_READY);
	
		if (status == UserCore::Misc::VerifyComplete::V_RESET)
		{
			uint32 flags = UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER|UserCore::Item::ItemInfoI::STATUS_DOWNLOADING|UserCore::Item::ItemInfoI::STATUS_INSTALLING|UserCore::Item::ItemInfoI::STATUS_UPDATING|UserCore::Item::ItemInfoI::STATUS_INSTALLED|UserCore::Item::ItemInfoI::STATUS_UPDATEAVAL;

			pItem->resetInstalledMcf();
			pItem->delSFlag(flags);
		}
	}

	UserCore::Misc::VerifyComplete vInstallPath(status, installpath);
	onVerifyCompleteEvent(vInstallPath);

	if (status == UserCore::Misc::VerifyComplete::V_INSTALL)
	{
		getItemInfo()->addToAccount();
		getItemHandle()->goToStageInstall(installpath, getMcfBranch());
	}
	else if (status == UserCore::Misc::VerifyComplete::V_DOWNLOAD)
	{
		getItemInfo()->addToAccount();

		if (installpath)
			getItemHandle()->goToStageDownload(installpath);
		else
			getItemHandle()->goToStageDownload(getItemInfo()->getCurrentBranch()->getBranchId(), m_McfBuild);	
	}
	else if (status == UserCore::Misc::VerifyComplete::V_SWITCHBRANCH)
	{
		getItemInfo()->addToAccount();
		getItemHandle()->switchBranch(m_McfBranch);	
	}
	else if (endStage)
	{
		getItemHandle()->completeStage(true);
	}
}
Beispiel #7
0
bool VerifyServiceTask::checkFiles()
{
	if (HasAnyFlags(m_uiOldStatus, UserCore::Item::ItemInfoI::STATUS_DOWNLOADING))
	{
		gcString path;

		if (checkMcfDownload(path))
			finishVerify(UserCore::Misc::VerifyComplete::V_DOWNLOAD, path.c_str());
		else
			finishVerify(UserCore::Misc::VerifyComplete::V_DOWNLOAD);

		return false;
	}
	else if (HasAnyFlags(m_uiOldStatus, (UserCore::Item::ItemInfoI::STATUS_INSTALLED|UserCore::Item::ItemInfoI::STATUS_INSTALLING)))
	{
		m_hMcf->getProgEvent() += delegate(this, &VerifyServiceTask::onProgress);
		m_hMcf->getErrorEvent() += delegate(this, &VerifyServiceTask::onError);

		bool completeMcf = false;

		if (m_McfBuild == 0)
			m_McfBuild = getItemInfo()->getInstalledBuild();

		setTier(VERIFYMCF);

		if (!checkMcf(completeMcf))
			return false;

		setTier(VERIFYINSTALL);

		if (!checkInstall(completeMcf))
			return false;

		setTier(DOWNLOADMISSINGFILES);

		if (completeMcf == false && !downloadMissingFiles())
			return false;

		setTier(INSTALLMISSINGFILES);

		if (!installMissingFiles())
			return false;
	}
	else
	{
		getItemInfo()->delSFlag(UserCore::Item::ItemInfoI::STATUS_READY);
		finishVerify(UserCore::Misc::VerifyComplete::V_RESET);
		return false;
	}

	return true;
}
void UIComplexModServiceTask::onComplete()
{
	if (HasAllFlags(getItemInfo()->getStatus(), UserCore::Item::ItemInfoI::STATUS_INSTALLCOMPLEX))
	{
		UserCore::MCFManager *mm = UserCore::GetMCFManager();
		mm->delMcfBackup(getItemInfo()->getParentId(), m_idLastInstalledMod);
	}

	if (HasAllFlags(getItemInfo()->getStatus(), UserCore::Item::ItemInfoI::STATUS_LINK))
	{
		if (m_uiCompleteAction == CA_LAUNCH)
			getItemHandle()->goToStageLaunch();
	}
	else
	{
		switch (m_uiCompleteAction)
		{
		case CA_INSTALL:
			getItemHandle()->goToStageInstallComplex(getMcfBranch(), getMcfBuild());
			break;

		case CA_UNINSTALL_BRANCH:
			getItemHandle()->goToStageUninstallBranch(getMcfBranch(), getMcfBuild());
			break;

		case CA_UNINSTALL:
			getItemInfo()->delSFlag(	UserCore::Item::ItemInfoI::STATUS_INSTALLED|
										UserCore::Item::ItemInfoI::STATUS_READY|
										UserCore::Item::ItemInfoI::STATUS_DOWNLOADING|
										UserCore::Item::ItemInfoI::STATUS_VERIFING|
										UserCore::Item::ItemInfoI::STATUS_INSTALLING|
										UserCore::Item::ItemInfoI::STATUS_UPDATING|
										UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER|
										UserCore::Item::ItemInfoI::STATUS_PAUSED|
										UserCore::Item::ItemInfoI::STATUS_PAUSABLE);

			completeUninstall(m_bRemoveAll, m_bRemoveAcc);
			break;

		case CA_UIPATCH:
			getItemHandle()->goToStageUninstallPatch(getMcfBranch(), getMcfBuild());
			break;
		};
	}

	if (m_bEndStage)
		getItemHandle()->completeStage(true);

	UIBaseServiceTask::onComplete();
}
Beispiel #9
0
bool VerifyServiceTask::checkItem()
{
	gcException eBadItem(ERR_BADITEM);
	gcException eBrchNull(ERR_BADITEM, "Item branch is null");
	
	UserCore::Item::ItemInfo* pItem = getItemInfo();

	if (!pItem)
	{
		onError(eBadItem);
		return true;
	}

	if (!pItem->isDownloadable())
	{
		finishVerify(UserCore::Misc::VerifyComplete::V_COMPLETE);
		return true;
	}

	if (!pItem->getCurrentBranch())
	{
		if (HasAnyFlags(pItem->getStatus(), UserCore::Item::ItemInfoI::STATUS_INSTALLED|UserCore::Item::ItemInfoI::STATUS_DOWNLOADING|UserCore::Item::ItemInfoI::STATUS_INSTALLING))
			onError(eBrchNull);
		else
			finishVerify(UserCore::Misc::VerifyComplete::V_RESET);

		return true;
	}

	return false;
}
SimObject* SimTreeView::getObject( HTREEITEM hItem )
{
   TV_ITEM *tvi;
   SimObject *obj=NULL;
   if ( hItem )
      if ( (tvi = getItemInfo( hItem )) != NULL )
         obj = targetManager->findObject(tvi->lParam);
   return obj;
}   
Beispiel #11
0
UserCore::Item::ItemInfo* BaseItemTask::getParentItemInfo()
{
	UserCore::Item::ItemInfo* item = getItemInfo();

	if (!m_pUserCore || !item)
		return NULL;

	return dynamic_cast<UserCore::Item::ItemInfo*>(m_pUserCore->getItemManager()->findItemInfo(item->getParentId()));
}
Beispiel #12
0
void CDKInfo::onButtonClicked(wxCommandEvent& event)
{
	if (event.GetId() == m_butClose->GetId())
	{
		GetParent()->Close();
	}
	else if (event.GetId() == m_imgCopyAll->GetId() || (m_vSplitKey.size() == 0 && event.GetId() == m_imgCopyPart->GetId()))
	{
		if (wxTheClipboard->Open())
		{
			wxTheClipboard->SetData(new wxTextDataObject(m_tbCdKey->GetValue()));
			wxTheClipboard->Close();
		}	

		m_tbCdKey->SetSelection(-1,-1);
	}
	else if (event.GetId() == m_imgCopyPart->GetId())
	{
		SplitInfo *info = m_vSplitKey[m_uiCurIndex];

		m_uiCurIndex++;

		if (m_uiCurIndex >= m_vSplitKey.size())
			m_uiCurIndex = 0;
		
		if (wxTheClipboard->Open())
		{
			wxTheClipboard->SetData(new wxTextDataObject(info->text));
			wxTheClipboard->Close();
		}

		m_tbCdKey->SetSelection(info->start,info->end);

		gcString label(Managers::GetString("#CDK_COPYPART"));

		if (m_uiCurIndex != 0)
			label = gcString(Managers::GetString("#CDK_COPYPART_X"), m_uiCurIndex+1);

		m_imgCopyPart->SetToolTip(label);
	}
	else if (m_butLaunch && m_butLaunch->GetId() == event.GetId())
	{
		g_pMainApp->handleInternalLink(getItemId(), ACTION_LAUNCH, FormatArgs("cdkey", std::string("exe=") + m_szExe));
		GetParent()->Close();
	}
	else if (m_butActivate && m_butActivate->GetId() == event.GetId())
	{
		UserCore::Item::ItemInfoI* info = getItemInfo();

		if (info && info->isLaunchable())
			info->addSFlag(UserCore::Item::ItemInfoI::STATUS_LAUNCHED);

#ifdef WIN32
		UTIL::WIN::runAs("steam://open/activateproduct");
#endif
	}
}
void DownloadToolTask::validateTools()
{
	std::vector<DesuraId> toolList;
	getItemInfo()->getCurrentBranch()->getToolList(toolList);

	if (toolList.size() == 0)
		return;

	auto pToolManager = getUserCore()->getToolManager();

	if (pToolManager->areAllToolsValid(toolList))
		return;

	pToolManager->reloadTools(getItemId());
	getItemInfo()->getCurrentBranch()->getToolList(toolList);

	if (!pToolManager->areAllToolsValid(toolList))
		throw gcException(ERR_INVALID, "Tool ids cannot be resolved into tools.");
}
void DownloadToolTask::onDLProgress(UserCore::Misc::ToolProgress &p)
{
	MCFCore::Misc::ProgressInfo m;

	m.doneAmmount = p.done;
	m.totalAmmount = p.total;
	m.percent = p.percent;

	onMcfProgressEvent(m);
	getItemInfo()->setPercent(p.percent);
}
Beispiel #15
0
bool VSDownloadMissing::checkComplex()
{
	if (HasAnyFlags(getItemInfo()->getStatus(), UserCore::Item::ItemInfoI::STATUS_INSTALLCOMPLEX))
	{
		UserCore::Item::ItemInfoI* par = getParentItemInfo();

		if (par && (!par->getInstalledModId().isOk() || par->getInstalledModId() != getItemId()))
		{		
			setResult(RES_COMPLETE);
		}
		else if (getItemInfo()->getInstalledModId().isOk())
		{
			setResult(RES_COMPLETE);
		}

		return false;
	}

	return true;
}
bool VSCheckInstall::doTask(bool completeMcf)
{
	if (HasAnyFlags(getItemInfo()->getStatus(), UserCore::Item::ItemInfoI::STATUS_INSTALLED))
	{
		if (checkInstallComplex(completeMcf))
		{
			return true;
		}
		else
		{
			bool res = checkInstall();

			if (isStopped())
				return false;

			if (res)
			{
				setResult(RES_COMPLETE);
			}
			else
			{
				setResult(RES_DOWNLOADMISSING);
				m_hMcf->saveMCFHeader();
			}
		}
	}
	else if (HasAnyFlags(getItemInfo()->getStatus(), UserCore::Item::ItemInfoI::STATUS_INSTALLING))
	{
		//continue installing
		if (!completeMcf)
			setResult(RES_DOWNLOAD);
		else
			setResult(RES_INSTALL);
	}
	else
	{
		return false;
	}

	return true;
}
Beispiel #17
0
void CreateMCFThread::waitForItemInfo()
{
	m_pUserCore->getItemManager()->retrieveItemInfoAsync(getItemId());

	size_t count = 0;

	while (!isStopped() && !getItemInfo() && count < 100)
	{
		count++;
		gcSleep(500);
	}
}
bool VSCheckInstall::checkInstall()
{
	try
	{
		return m_hMcf->verifyInstall(getItemInfo()->getPath(), true);
	}
	catch (gcException &except)
	{
		onErrorEvent(except);
		return false;
	}
}
Beispiel #19
0
void InstallVerifyInfoPage::init()
{
	UserCore::Item::ItemInfoI *info = getItemInfo();

	if (!info)
	{
		Close();
		return;
	}

	m_labInfo->SetLabel(gcWString(Managers::GetString(L"#IF_VERIFYCONFIRM"), info->getName()));
	m_labInfo->Wrap( 360 );
}
void DownloadToolTask::doRun()
{
	uint32 per = 0;
	getItemInfo()->setPercent(per);

	if (m_ToolTTID == UINT_MAX)
		validateTools();

	std::vector<DesuraId> toolList;
	getItemInfo()->getCurrentBranch()->getToolList(toolList);

	UserCore::Misc::ToolTransaction* tt = new UserCore::Misc::ToolTransaction();

	tt->onCompleteEvent += delegate(this, &DownloadToolTask::onDLComplete);
	tt->onErrorEvent += delegate(this, &DownloadToolTask::onDLError);
	tt->onProgressEvent += delegate(this, &DownloadToolTask::onDLProgress);
	tt->toolsList = toolList;
	
	if (m_ToolTTID != UINT_MAX)
	{
		bool res = getUserCore()->getToolManager()->updateTransaction(m_ToolTTID, tt);

		if (!res) //must be complete
		{
			onComplete();
			return;
		}
	}
	else
	{
		m_ToolTTID = getUserCore()->getToolManager()->downloadTools(tt);
	}

	if (m_ToolTTID != UINT_MAX)
		m_WaitCond.wait();

	onComplete();
}
void DownloadToolTask::onComplete()
{
	bool notComplete = isStopped() || m_bCancelled;

	getUserCore()->getToolManager()->removeTransaction(m_ToolTTID, notComplete);
	m_ToolTTID = UINT_MAX;

	std::vector<DesuraId> toolList;
	getItemInfo()->getCurrentBranch()->getToolList(toolList);

	if (!m_bCancelled && !getUserCore()->getToolManager()->areAllToolsDownloaded(toolList))
	{
		gcException e(ERR_INVALID, "Failed to download tools.");
		onErrorEvent(e);
		notComplete = true;
	}

	if (notComplete)
	{
		getItemHandle()->completeStage(true);
		return;
	}

	uint32 blank = 0;
	onCompleteEvent(blank);

	if (m_bInstallAfter)
	{
		getItemHandle()->goToStageInstallTools(m_bLaunch);
	}
	else
	{
		if (HasAllFlags(getItemInfo()->getStatus(), UserCore::Item::ItemInfoI::STATUS_INSTALLCOMPLEX))
			getItemHandle()->goToStageInstallComplex(getMcfBranch(), getMcfBuild());
		else
			getItemHandle()->goToStageInstall(m_szDownloadPath.c_str(), getMcfBranch());
	}
}
Beispiel #22
0
void ItemHandle::doLaunch(Helper::ItemLaunchHelperI* helper)
{
	preLaunchCheck();
	
	bool needElevation = false;

	size_t x=0;
	while (g_ElevatedGames[x].isOk())
	{
		if (getItemInfo()->getId() == g_ElevatedGames[x] || getItemInfo()->getParentId() == g_ElevatedGames[x])
		{
			needElevation = true;
			break;
		}

		x++;
	}
	
	UserCore::Item::Misc::ExeInfoI* ei = getItemInfo()->getActiveExe();

	gcString args;
	gcString ea(ei->getExeArgs());
	gcString ua(ei->getUserArgs());
	
	if (ea.size() > 0)
		args += " " + ea;

	if (ua.size() > 0)
		args += " " + ua;

	m_pUserCore->getItemManager()->setRecent(getItemInfo()->getId());

	bool res = UTIL::WIN::launchExe(ei->getExe(), args.c_str(), needElevation, m_pUserCore->getMainWindowHandle());

	if (!res)
		throw gcException(ERR_LAUNCH, GetLastError(), gcString("Failed to create {0} process. [{1}: {2}].\n", getItemInfo()->getName(), GetLastError(), ei->getExe()));
}
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.");
}
Beispiel #24
0
void CSIM_ext::MeasureItem(LPMEASUREITEMSTRUCT lpmis)
{
    if (lpmis->CtlType != ODT_MENU)
        return;
    ItemInfo info = getItemInfo(lpmis->itemID);
    if (info.icon == NULL)
        return;
    HDC hDC = CreateCompatibleDC(NULL);
    SelectObject(hDC, GetStockObject(DEFAULT_GUI_FONT));
    SIZE s;
    GetTextExtentPoint32(hDC, info.text.c_str(), info.text.length(), &s);
    lpmis->itemWidth  = s.cx + GetSystemMetrics(SM_CXMENUCHECK) + GetSystemMetrics(SM_CXFRAME) * 2;
    lpmis->itemHeight = GetSystemMetrics(SM_CYMENU);
    DeleteDC(hDC);
}
Beispiel #25
0
void CDKeyTask::doTask()
{
	if (!getItemInfo() || !getWebCore())
	{
		CDKeyEventInfo<gcException> cdei;
		cdei.task = this;
		cdei.t = gcException(ERR_NULLHANDLE, "Item info or web core are null");
		cdei.id = getItemId();

		onErrorEvent(cdei);
		return;
	}

	MCFBranch branch = getItemInfo()->getInstalledBranch();

	try
	{
		gcString key = getWebCore()->getCDKey(getItemId(), branch);

		CDKeyEventInfo<gcString> cdei;
		cdei.task = this;
		cdei.t = key;
		cdei.id = getItemId();

		onCompleteEvent(cdei);
	}
	catch (gcException &e)
	{
		CDKeyEventInfo<gcException> cdei;
		cdei.task = this;
		cdei.t = e;
		cdei.id = getItemId();

		onErrorEvent(cdei);
	}
}
Beispiel #26
0
void VerifyServiceTask::onProgress(MCFCore::Misc::ProgressInfo& prog)
{
	if (m_pCurTask)
		m_pCurTask->onProgress(prog);


	MCFCore::Misc::ProgressInfo p(&prog);
	uint32 percent = 0;

	switch (m_iTier)
	{
		case START: 
			percent = 00 + ((uint32)prog.percent/20);  
			p.flag = 0;
			break;

		case VERIFYMCF: 
			percent = 20 + ((uint32)prog.percent/20); 
			p.flag = 1;
			break;

		case VERIFYINSTALL: 
			percent = 40 + ((uint32)prog.percent/20); 
			p.flag = 2;
			break;

		case DOWNLOADMISSINGFILES: 
			percent = 60 + ((uint32)prog.percent/20); 
			p.flag = 3;
			break;

		case INSTALLMISSINGFILES: 
			percent = 80 + ((uint32)prog.percent/20);
			p.flag = 4;
			break;
	}
	
	if (m_uiLastPercent != percent || p.doneAmmount > 0)
	{
		p.percent = percent;
		onMcfProgressEvent(p);

		getItemInfo()->setPercent(percent);

		m_uiLastPercent = percent;
	}
}
Beispiel #27
0
void ItemHandle::doLaunch(Helper::ItemLaunchHelperI* helper)
{
	char magicBytes[5] = {0};
	UserCore::Item::Misc::ExeInfoI* ei = getItemInfo()->getActiveExe();
	
	const char* exe = ei->getExe();
	const char* args = getUserCore()->getCVarValue("gc_linux_launch_globalargs");
	gcString globalExe = getUserCore()->getCVarValue("gc_linux_launch_globalbin");
	
	if (globalExe.size() > 0)
	{
		if (!UTIL::FS::isValidFile(globalExe.c_str()))
		{
			Warning(gcString("Couldn't find global exe [{0}], ignoring.\n", globalExe));
			globalExe = "";
			exe = ei->getExe();
		}
		else
		{
			exe = globalExe.c_str();
		}
	}
	
	try
	{
		UTIL::FS::FileHandle fh(exe, UTIL::FS::FILE_READ);
		fh.read(magicBytes, 5);
	}
	catch (gcException& e)
	{
		throw gcException(ERR_LAUNCH, e.getSecErrId(), gcString("Failed to read [{0}]: {1}\n", exe, e));
	}

	UTIL::LIN::BinType type = UTIL::LIN::getFileType(magicBytes, 5);

	if (type == UTIL::LIN::BT_WIN && helper)
		helper->showWinLaunchDialog();
	
	//if we are not using globalExe set exe to Null so that we use the proper exe
	if (globalExe.size() == 0 || type == UTIL::LIN::BT_UNKNOWN)
		exe = NULL;

	doLaunch(type == UTIL::LIN::BT_UNKNOWN, exe, args);
}
void CreateProgPage::run()
{
	if (!getItemInfo() && !GetUserCore()->isAdmin())
		return;

	Show(true);
	Raise();

	if (m_pThread)
		return;

	m_pThread = GetThreadManager()->newCreateMCFThread(getItemId(), m_szFolderPath.c_str());

	*m_pThread->getMcfProgressEvent() += guiDelegate(this, &CreateProgPage::onProgress);
	*m_pThread->getErrorEvent() += guiDelegate(this, &CreateProgPage::onError);
	*m_pThread->getCompleteStringEvent() += guiDelegate(this, &CreateProgPage::onComplete);

	m_pThread->start();
}
Beispiel #29
0
void VerifyServiceTask::updateStatus()
{
	UserCore::Item::ItemInfo* pItem = getItemInfo();

	m_uiOldStatus = pItem->getStatus();

	uint32 addFlags = UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER|UserCore::Item::ItemInfoI::STATUS_VERIFING;
	uint32 delFlags = UserCore::Item::ItemInfoI::STATUS_READY|UserCore::Item::ItemInfoI::STATUS_PAUSED|UserCore::Item::ItemInfoI::STATUS_PAUSABLE|UserCore::Item::ItemInfoI::STATUS_LINK|UserCore::Item::ItemInfoI::STATUS_DELETED;

	UserCore::Item::ItemInfo* parent = getParentItemInfo();

	if (parent)
		parent->delSFlag(UserCore::Item::ItemInfoI::STATUS_DELETED);

	pItem->addSFlag(addFlags);
	pItem->delSFlag(delFlags);

	pItem->setPercent(0);
}
Beispiel #30
0
bool VerifyServiceTask::checkTools()
{
	refreshInfo();

	std::vector<DesuraId> toolList;
	getItemInfo()->getCurrentBranch()->getToolList(toolList);

	if (toolList.size() == 0)
		return false;

	getUserCore()->getToolManager()->invalidateTools(toolList);

	if (!getUserCore()->getToolManager()->areAllToolsDownloaded(toolList))
		getItemHandle()->goToStageDownloadTools(false);
	else
		getItemHandle()->goToStageInstallTools(false);

	return true;
}