bool CheckUpdate(const wchar_t* path)
{
	UMcf updateMcf;
	updateMcf.setFile(path);

	return (updateMcf.parseMCF() == UMCF_OK && updateMcf.isValidInstaller());
}
Beispiel #2
0
int InstallFilesForTest()
{
	UMcf updateMcf;
	UpdateForm up;

	try
	{
		updateMcf.setFile(UPDATEFILE_W);
		
		if (updateMcf.parseMCF() != 0)
			return -1;

		updateMcf.isValidInstaller();

		up.installOnly();

		if (!updateMcf.checkFiles())
			return -2;
	}
	catch (gcException &e)
	{
		return e.getErrId();
	}
	catch (...)
	{
		return -3;
	}

	return 0;
}
Beispiel #3
0
UINT InstallFilesForTest()
{
	UMcf updateMcf;

	try
	{
		updateMcf.setFile(UPDATEFILE_W);
		
		if (updateMcf.parseMCF() != 0)
			return -1;

		updateMcf.isValidInstaller();

		AppUpdateInstall aui(NULL, true);
		int res = aui.run();

		if (res != 0)
			return res;

		if (!updateMcf.checkFiles())
			return -2;
	}
	catch (gcException &e)
	{
		return e.getErrId();
	}
	catch (...)
	{
		return -3;
	}

	return 0;
}
Beispiel #4
0
bool CheckUpdate(const char* path)
{
	ERROR_OUTPUT(__func__);
	wchar_t wPath[PATH_MAX];

	if (mbstowcs(wPath, path, PATH_MAX) == UINT_MAX)
	{
		ERROR_OUTPUT("Couldn't convert multibyte string to wide-character array!");
		return false;
	}

	UMcf updateMcf;
	updateMcf.setFile(wPath);

	uint8 res = updateMcf.parseMCF();

	if (res != UMCF_OK)
	{
		// desura_update.mcf
		if (FileExists(UPDATEFILE))
			DeleteFile(UPDATEFILE);	
		ShowHelpDialog(gcString("Failed to parse MCF! [{0}]. Deleting file to allow a fresh update.", res).c_str());
		
		return false;		
	}

	if (!updateMcf.isValidInstaller())
	{
		// desura_update.mcf
		if (FileExists(UPDATEFILE))
			DeleteFile(UPDATEFILE);
		ShowHelpDialog("Error: Current MCF not a valid installer! Deleting file to allow a fresh update.");
		return false;		
	}
	
	return true;
}