예제 #1
0
void UninstallAllThread::removeDesuraCache()
{
	gcString logStr("{0}\n", Managers::GetString("#DUN_THREAD_CACHE"));
	onLogEvent(logStr);

	m_iTotalPos++;
	std::pair<uint32,uint32> pair(m_iTotalPos*100/m_iTotal, 0);
	onProgressEvent(pair);

	UTIL::FS::Path path(getCachePath(), "", false);
	std::vector<std::string> extList;

	extList.push_back("mcf");

	for (size_t x=0; x<20; x++)
		extList.push_back(gcString("part_{0}", x));

	UTIL::FS::Path dbDir(UTIL::OS::getAppDataPath(), L"", false);

	delLeftOverMcf(path, extList);
	delLeftOverMcf(dbDir, extList);

	UTIL::FS::Path mcfUploads = dbDir;
	UTIL::FS::Path mcfStore = dbDir;

	mcfUploads += UTIL::FS::File("mcf_uploads.sqlite");
	mcfStore += UTIL::FS::File("mcfstoreb.sqlite");

	UTIL::FS::delFile(mcfUploads);
	UTIL::FS::delFile(mcfStore);
}
예제 #2
0
void UninstallAllThread::removeGameExplorerInfo()
{
	gcString logStr("{0}\n", Managers::GetString("#DUN_THREAD_GAMEEXPLORER"));
	onLogEvent(logStr);

	m_iTotalPos++;
	std::pair<uint32,uint32> pair(m_iTotalPos*100/m_iTotal, 0);
	onProgressEvent(pair);

	std::vector<std::string> regKeys;
	UTIL::WIN::getAllRegKeys("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\GameUX\\Games", regKeys, true);

	for (size_t x=0; x<regKeys.size(); x++)
	{
		gcString regKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\GameUX\\Games\\{0}\\AppExePath", regKeys[x]);
		std::string value = UTIL::WIN::getRegValue(regKey, true);

		if (value.find("desura://") != 0)
			continue;

		regKey = gcString("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\GameUX\\Games\\{0}", regKeys[x]);
		UTIL::WIN::delRegTree(regKey.c_str(), true);
	}

	UTIL::FS::Path gdfFolder(UTIL::OS::getAppDataPath(), L"", false);
	gdfFolder += "GDF";

	UTIL::FS::delFolder(gdfFolder);
}
예제 #3
0
    void log_handler(uv_async_t *handle)
    {
        auto adapter = static_cast<Adapter *>(handle->data);

        if (adapter != nullptr)
        {
            adapter->onLogEvent(handle);
        }
        else
        {
            std::cerr << "No AddOn adapter to process log event." << std::endl;
            std::terminate();
        }
    }
예제 #4
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QAction *action1 = new QAction("Settings",this);
    QAction *action2 = new QAction("Reset Accel",this);

    QMenu *menu = this->menuBar()->addMenu("&Main");
    menu->addAction(action1);
    connect(action1,SIGNAL(triggered()),this,SLOT(openSettingsForm()));
    menu->addAction(action2);
    connect(action2,SIGNAL(triggered()),this,SLOT(resetState()));

    monitor = new Monitor(this);
    connect(monitor,SIGNAL(logEvent(QString)),this,SLOT(onLogEvent(QString)));
    monitor->start();
}
예제 #5
0
void UninstallAllThread::removeUninstallInfo()
{
	gcString logStr("{0}\n", Managers::GetString("#DUN_THREAD_UNINSTALL"));
	onLogEvent(logStr);

	m_iTotalPos++;
	std::pair<uint32,uint32> pair(m_iTotalPos*100/m_iTotal, 0);
	onProgressEvent(pair);

	std::vector<std::string> regKeys;
	UTIL::WIN::getAllRegKeys("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall", regKeys);

	for (size_t x=0; x<regKeys.size(); x++)
	{
		std::string key = regKeys[x];

		if (key.find("Desura") != 0)
			continue;

		gcString regKey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{0}", key);
		UTIL::WIN::delRegTree(regKey.c_str());
	}
}
예제 #6
0
void UninstallAllThread::removeDesuraSettings()
{
	gcString logStr("{0}\n", Managers::GetString("#DUN_THREAD_SETTINGS"));
	onLogEvent(logStr);

	m_iTotalPos++;
	std::pair<uint32,uint32> pair(m_iTotalPos*100/m_iTotal, 0);
	onProgressEvent(pair);

	UTIL::FS::Path dbDir(UTIL::OS::getAppDataPath(), L"", false);
	
	std::vector<UTIL::FS::Path> fileList;
	std::vector<UTIL::FS::Path> folderList;

	UTIL::FS::getAllFiles(dbDir, fileList, nullptr);
	UTIL::FS::getAllFolders(dbDir, folderList);

	for (size_t x=0; x<fileList.size(); x++)
	{
		std::string fileName = fileList[x].getFile().getFile();

		if (fileName == "mcfstoreb.sqlite" || fileName == "mcf_uploads.sqlite")
			continue;

		UTIL::FS::delFile(fileList[x]);
	}

	for (size_t x=0; x<folderList.size(); x++)
	{
		std::string folderName = folderList[x].getLastFolder();

		if (folderName == "mods" || folderName == "games" || folderName == "GDF")
			continue;

		UTIL::FS::delFolder(folderList[x]);
	}
}
예제 #7
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();
}