Exemplo n.º 1
0
// Process
void Tree::Process() {

	switch (_step) {

		case 0:
			if (_initialize()) _step++;
			else return;
		case 1:
			if (_count()) _step++;
			else throw std::runtime_error("read error");
		case 2:
			if (_sum()) _step++;
			else return;
		case 3:
			if (_build()) _step++;
			else throw std::runtime_error("build error");
		case 4:
			if (_subtrees()) _step++;
			else throw std::runtime_error("subtree error");
		default:
			_fptree.free();
			FinishProcess();

	}

}
Exemplo n.º 2
0
long CPatcherWindow::OnTimer(WPARAM timerId)
{
	if((m_downloadComplete || m_patchComplete) && m_cancelPending)
	{
		Destroy();
		return FALSE;
	}
	if(m_downloadComplete)
	{
		m_downloadComplete = false;
		if(m_downloadResult == DOWNLOADER_SERVICE_RESULT_SUCCESS)
		{
			StepDownloader();
		}
		else
		{
			FinishProcess();
		}
		UpdateDownloaderStatus();
	}
	if(m_downloaderService.IsActive() && !m_cancelPending)
	{
		UpdateDownloaderStatus();
	}
	if(m_patchComplete)
	{
		m_patchComplete = false;
		if(m_patchResult == PATCHER_SERVICE_RESULT_SUCCESS)
		{
			StepPatcher();
		}
		else
		{
			FinishProcess();
		}
		UpdatePatcherStatus();
	}
	return FALSE;
}
Exemplo n.º 3
0
void CPatcherWindow::StepPatcher()
{
	if(m_patchIdx == m_patchPaths.size())
	{
		WriteVersionFiles();
		FinishProcess();
	}
	else
	{
		auto nextPatchPath = m_patchPaths[m_patchIdx];

		m_patcherService.Patch(nextPatchPath, m_gamePath,
			[&](const PATCHER_SERVICE_RESULT& result)
			{
				m_patchResult = result;
				m_patchIdx++;
				m_patchComplete = true;
			}
		);
	}
}