예제 #1
0
bool VSCheckInstall::checkInstallComplex(bool completeMcf)
{
	if (HasAnyFlags(getItemInfo()->getStatus(), UserCore::Item::ItemInfoI::STATUS_INSTALLCOMPLEX) == false)
		return false;

	UserCore::Item::ItemInfoI* pItem = getItemInfo();
	UserCore::Item::ItemInfoI* 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;
}
예제 #2
0
bool UpdateThreadOld::pollUpdates()
{
	if (!m_pWebCore || !m_pUser)
		return false;

	updateBuildVer();

	std::map<std::string, std::string> post;

#ifdef DESURA_NONGPL_BUILD
	post["appid"] = gcString("{0}", m_iAppId);
	post["build"] = gcString("{0}", m_iAppVersion);
#endif

	for (uint32 x=0; x< m_pUser->getItemManager()->getCount(); x++)
	{
		UserCore::Item::ItemInfoI* item = m_pUser->getItemManager()->getItemInfo(x);

		if (!item)
			continue;

		if (!(item->getStatus() & UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER) || (item->getStatus()&UserCore::Item::ItemInfoI::STATUS_ONACCOUNT))
			continue;

		DesuraId id = item->getId();

		if (id.getType() == DesuraId::TYPE_LINK)
			continue;

		gcString key("updates[{0}][{1}]", id.getTypeString().c_str(), id.getItem());
		post[key] = "1";
	}

	TiXmlDocument doc;

	try
	{
		m_pWebCore->getUpdatePoll(doc, post);
	}
	catch (gcException &e)
	{
		Warning(gcString("Update poll failed: {0}\n", e));
		return false;
	}

	parseXML(doc);

#ifdef WIN32
	checkFreeSpace();
#endif

	m_hHttpHandle->cleanPostInfo();
	m_hHttpHandle->cleanUp();
	m_hHttpHandle->clearCookies();

	return true;
}
예제 #3
0
void TaskBarIcon::tagItems()
{
	if (!GetUserCore())
		return;

	std::vector<UserCore::Item::ItemInfoI*> gList;
	GetUserCore()->getItemManager()->getGameList(gList, true);

	for (size_t x=0; x<gList.size(); x++)
	{
		UserCore::Item::ItemInfoI* game = gList[x];

		if (game->getStatus() & UserCore::Item::ItemInfoI::STATUS_DELETED || (!(game->getStatus() & (UserCore::Item::ItemInfoI::STATUS_ONACCOUNT|UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER)) && (game->getStatus() & UserCore::Item::ItemInfoI::STATUS_DEVELOPER)))
		{
			*game->getInfoChangeEvent() -= guiDelegate(this, &TaskBarIcon::onItemChanged);
			continue;
		}

		if (!(game->getStatus() & (UserCore::Item::ItemInfoI::STATUS_ONACCOUNT|UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER)))
			continue;

		*game->getInfoChangeEvent() += guiDelegate(this, &TaskBarIcon::onItemChanged);

#ifdef WIN32
		std::vector<UserCore::Item::ItemInfoI*> mList;
		GetUserCore()->getItemManager()->getModList(game->getId(), mList, true);

		for (size_t y=0; y<mList.size(); y++)
		{
			UserCore::Item::ItemInfoI* mod = mList[y];

			if (mod->getStatus() & UserCore::Item::ItemInfoI::STATUS_DELETED || (!(mod->getStatus() & (UserCore::Item::ItemInfoI::STATUS_ONACCOUNT|UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER)) && (mod->getStatus() & UserCore::Item::ItemInfoI::STATUS_DEVELOPER)))
			{
				*mod->getInfoChangeEvent() -= guiDelegate(this, &TaskBarIcon::onItemChanged);
				continue;
			}

			if (!(mod->getStatus() & (UserCore::Item::ItemInfoI::STATUS_ONACCOUNT|UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER)))
				continue;

			*mod->getInfoChangeEvent() += guiDelegate(this, &TaskBarIcon::onItemChanged);
		}
#endif
	}
}
예제 #4
0
void UploadInfoPage::resetAllValues()
{
	//m_dpFile->SetPath(wxT(""));
	m_butUpload->Enable( false );

	UserCore::Item::ItemInfoI *item = GetUserCore()->getItemManager()->findItemInfo(getItemId());

	gcString filePath;
	gcString cachePath = GetUserCore()->getMcfCachePath();

	if (!item)
		filePath = gcString("{0}{1}temp{1}", cachePath, DIRS_STR);
	else
		filePath = gcString("{0}{2}{1}", cachePath, item->getId().getFolderPathExtension().c_str(), DIRS_STR);

	gcWString wfilePath(filePath);
	m_tbItemFile->SetValue(wfilePath.c_str());
}
예제 #5
0
void UninstallInfoPage::init()
{
	UserCore::Item::ItemInfoI *info = getItemInfo();

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


	bool hasPaidBranch = false;

	for (size_t x=0; x<info->getBranchCount(); x++)
	{
		UserCore::Item::BranchInfoI* b = info->getBranch(x);

		if (b && HasAnyFlags(b->getFlags(), UserCore::Item::BranchInfoI::BF_ONACCOUNT) && !HasAnyFlags(b->getFlags(), UserCore::Item::BranchInfoI::BF_DEMO|UserCore::Item::BranchInfoI::BF_FREE|UserCore::Item::BranchInfoI::BF_TEST))
			hasPaidBranch = true;
	}

	if (hasPaidBranch)
	{
		m_cbAccount->Enable(false);
		m_cbAccount->SetValue(false);
	}

	if (info->getId().getType() == DesuraId::TYPE_LINK)
	{
		m_cbAccount->Enable(false);
		m_cbAccount->SetValue(true);

		m_cbComplete->Enable(false);
		m_cbComplete->SetValue(true);
	}


	m_labInfo->SetLabel(gcWString(Managers::GetString(L"#UNF_CONFIRM"), info->getName()));
	m_labInfo->Wrap( 360 );
}
예제 #6
0
wxMenu* TBIModMenu::createMenu(uint32 &lastMenuId)
{
	gcMenu* menu = new gcMenu();
	m_IdMapList.clear();

	if (!m_pItemManager && GetUserCore())
		m_pItemManager = GetUserCore()->getItemManager();

	if (!m_pItemManager)
		return menu;

	std::vector<UserCore::Item::ItemInfoI*> gList;
	m_pItemManager->getGameList(gList);

	std::sort(gList.begin(), gList.end(), [](UserCore::Item::ItemInfoI* left, UserCore::Item::ItemInfoI* right){
		return strcmp(left->getName(), right->getName()) <= 0;
	});

	for (size_t x=0; x<gList.size(); x++)
	{
		UserCore::Item::ItemInfoI *game = gList[x];

		std::vector<UserCore::Item::ItemInfoI*> mList;
		m_pItemManager->getModList(game->getId(), mList);

		if (mList.size() == 0)
			continue;

		gcMenu* gameMenu = new gcMenu();
		
		std::sort(mList.begin(), mList.end(), [](UserCore::Item::ItemInfoI* left, UserCore::Item::ItemInfoI* right){
			return strcmp(left->getName(), right->getName()) <= 0;
		});

		for (size_t y=0; y<mList.size(); y++)
		{
			UserCore::Item::ItemInfoI *mod = mList[y];

			wxMenuItem* menuItem = new gcMenuItem(gameMenu, lastMenuId, mod->getName());
			gameMenu->Append(menuItem);

			m_IdMapList[lastMenuId] = mod->getId();
			loadIcon(menuItem, mod->getIcon());

			lastMenuId++;
		}

		wxMenuItem* gameItem = new gcMenuItem(gameMenu, wxID_ANY, game->getName(), "", wxITEM_NORMAL, gameMenu);
		loadIcon(gameItem, game->getIcon());

		menu->Append(gameItem);
	}

	if (menu->GetMenuItemCount() == 0)
	{
		wxMenuItem* noItems = new gcMenuItem(menu, lastMenuId, Managers::GetString(L"#TB_NOITEMS"));
		lastMenuId++;

		menu->Append(noItems);
		noItems->Enable(false);
	}

	return menu;
}
예제 #7
0
void InternalLink::launchItem(DesuraId id, Args args)
{
	bool cdKeyArg = args.containsArg("cdkey");
	bool noUpdateArg = args.containsArg("noupdate");
	bool exeNumArg = args.containsArg("exe");
	std::string exe = args.getArgValue("exe");

	if (exe == "")
		exeNumArg = false;

	g_pMainApp->showPlay();

	if (checkForPreorder(id))
		return;

	UserCore::Item::ItemInfoI* item = GetUserCore()->getItemManager()->findItemInfo(id);
	bool delFlag=false;

	if (!item || !item->isLaunchable())
	{
		installItem(id, Args());
		return;
	}

	if (!item->hasAcceptedEula())
	{
		showPrompt(id, FormatArgs("prompt=eula"));
		return;
	}

	if (!exeNumArg && item->getExeCount(true) > 1)
	{
		showExeSelect(id, cdKeyArg);
		return;
	}
	else if (exe.size() > 0)
	{
		item->setActiveExe(exe.c_str());
	}

	bool hasCDKey = item->getCurrentBranch() && item->getCurrentBranch()->hasCDKey();
	bool hasDLCDKey = item->getCurrentBranch() && item->getCurrentBranch()->isCDKeyValid();

	if (!cdKeyArg && ((item->isFirstLaunch() && hasCDKey) || (hasCDKey && !hasDLCDKey)))
	{
		showCDKey(id, FormatArgs("launch=true", std::string("exe=") + exe));
		return;
	}

	bool shouldShowGameDisk = false;

	if (args.containsArg("gamedisk") == false && HasAnyFlags(item->getOptions(), UserCore::Item::ItemInfoI::OPTION_DONTPROMPTGAMEDISK) == false)
	{
		size_t x=0; 
		while (g_GameDiskList[x].isOk())
		{
			if (item->getId() == g_GameDiskList[x] || item->getParentId() == g_GameDiskList[x])
			{
				shouldShowGameDisk = true;
				break;
			}

			x++;
		}
	}

	if (shouldShowGameDisk)
	{
		showGameDisk(id, exe.c_str(), cdKeyArg);
		return;
	}

	if (noUpdateArg && !HasAnyFlags(item->getOptions(), UserCore::Item::ItemInfoI::OPTION_NOTREMINDUPDATE))
	{
		item->addOFlag(UserCore::Item::ItemInfoI::OPTION_NOTREMINDUPDATE);
		delFlag = true;
	}

	UI::Forms::ItemForm* form = showItemForm(id, UI::Forms::INSTALL_ACTION::IA_LAUNCH);

	if (!form)
		Warning(gcString("Cant find item (or item not ready) for launch [{0}].\n", id.toInt64()));

	if (item && delFlag)
		item->delOFlag(UserCore::Item::ItemInfoI::OPTION_NOTREMINDUPDATE);
}
예제 #8
0
void UninstallAllThread::run()
{
	if (!m_pUser)
		return;

	bool removeSimple	= HasAnyFlags(m_iFlags, REMOVE_SIMPLE);
	bool removeCache	= HasAnyFlags(m_iFlags, REMOVE_CACHE);
	bool removeSettings = HasAnyFlags(m_iFlags, REMOVE_SETTINGS);

	std::vector<UserCore::Item::ItemHandleI*> uninstallList;

	std::vector<UserCore::Item::ItemInfoI*> gamesList;
	m_pUser->getItemManager()->getGameList(gamesList);

	for (size_t x=0; x<gamesList.size(); x++)
	{
		UserCore::Item::ItemInfoI* game = gamesList[x];
		std::vector<UserCore::Item::ItemInfoI*> modList;

		for (size_t y=0; y<modList.size(); y++)
		{
			if (modList[x]->isInstalled() && (modList[x]->isComplex() || removeSimple))
				uninstallList.push_back(m_pUser->getItemManager()->findItemHandle(modList[x]->getId()));
		}

		if (removeSimple && game->isInstalled())
			uninstallList.push_back(m_pUser->getItemManager()->findItemHandle(game->getId()));
	}
	
	{
		gcString str("{0}\n", Managers::GetString("#DUN_THREAD_UNINSTALL"));
		onLogEvent(str);
	}
	m_iTotal = uninstallList.size() + (removeCache?1:0) + (removeSettings?1:0) + 2;

	for (size_t x=0; x<uninstallList.size(); x++)
	{
		m_iTotalPos++;
		std::pair<uint32,uint32> pair(m_iTotalPos*100/m_iTotal, 0);
		onProgressEvent(pair);

		if (isStopped())
			break;

		UserCore::Item::ItemHandleI* itemHandle = uninstallList[x];

		if (!itemHandle)
			continue;

		gcString logStr("\t{0}\n", gcString(Managers::GetString("#DUN_THREAD_UNINSTALL_SUB"), itemHandle->getItemInfo()->getName()));
		onLogEvent(logStr);
	
		itemHandle->addHelper(this);
		itemHandle->uninstall(this, true, false);

		m_WaitCondition.wait();

		itemHandle->delHelper(this);
	}

	m_pUser->logOut();

	removeUninstallInfo();
	removeGameExplorerInfo();

	if (removeCache)
		removeDesuraCache();

	if (removeSettings)
		removeDesuraSettings();

	gcString finalLogStr("{0}\n", Managers::GetString("#DUN_THREAD_FINAL"));
	onLogEvent(finalLogStr);

	UTIL::WIN::delRegValue(APPID);
	UTIL::WIN::delRegValue(APPBUILD);
	UTIL::WIN::delRegValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Desura\\DesuraApp\\InstallPath");

	UTIL::FS::Path path(UTIL::OS::getCommonProgramFilesPath(), L"", false);
	UTIL::FS::delFolder(path);
	UTIL::FS::delEmptyFolders(m_pUser->getAppDataPath());

	UTIL::WIN::delRegKey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Desura");
	onCompleteEvent();
}