예제 #1
0
void CUpdater::Init()
{
	raw_version_information_ = COptions::Get()->GetOption( OPTION_UPDATECHECK_NEWVERSION );
	
	UpdaterState s = ProcessFinishedData(FZ_AUTOUPDATECHECK);

	SetState(s);

	RunIfNeeded();

	update_timer_.SetOwner(this);
	update_timer_.Start(1000 * 3600);

	if( !instance ) {
		instance = this;
	}
}
예제 #2
0
void CUpdater::Init()
{
	if( state_ == UpdaterState::checking || state_ == UpdaterState::newversion_downloading ) {
		return;
	}

	raw_version_information_ = COptions::Get()->GetOption( OPTION_UPDATECHECK_NEWVERSION );

	UpdaterState s = ProcessFinishedData(FZ_AUTOUPDATECHECK);

	SetState(s);

	AutoRunIfNeeded();

	update_timer_.SetOwner(this);
	update_timer_.Start(1000 * 3600);

	if( !instance ) {
		instance = this;
	}
}
예제 #3
0
void CUpdater::ProcessOperation(CNotification* notification)
{
	if( state_ != checking && state_ != newversion_downloading ) {
		return;
	}

	UpdaterState s = failed;

	COperationNotification* operation = reinterpret_cast<COperationNotification*>(notification);
	if (operation->nReplyCode != FZ_REPLY_OK) {
		if( state_ != checking ) {
			s = newversion;
		}
	}
	else if( state_ == checking ) {
		s = ProcessFinishedData(true);
	}
	else {
		s = ProcessFinishedDownload();
	}
	SetState(s);
}
예제 #4
0
void CUpdater::ProcessOperation(COperationNotification const& operation)
{
	if( state_ != UpdaterState::checking && state_ != UpdaterState::newversion_downloading ) {
		return;
	}

	if (pending_commands_.empty()) {
		SetState(UpdaterState::failed);
		return;
	}


	UpdaterState s = UpdaterState::failed;

	int res = operation.nReplyCode;
	if (res == FZ_REPLY_OK || (operation.commandId == Command::disconnect && res & FZ_REPLY_DISCONNECTED)) {
		pending_commands_.pop_front();
		res = ContinueDownload();
		if (res == FZ_REPLY_WOULDBLOCK) {
			return;
		}
	}

	if (res != FZ_REPLY_OK) {
		if (state_ != UpdaterState::checking) {
			s = UpdaterState::newversion;
		}
	}
	else if( state_ == UpdaterState::checking ) {
		s = ProcessFinishedData(true);
	}
	else {
		s = ProcessFinishedDownload();
	}
	SetState(s);
}