//---------------------------------------------------------------------------
//  compareFiles
//---------------------------------------------------------------------------
void CDaliDeploymentEngine::compareFiles(const char *newFile, const char *oldFile)
{
    //BUG: 9254 - Deploy Wizard's "compare" for Dali looks in wrong folder
    //If filename is in deploy folder then compare file in folder above it.
    //
    StringBuffer installPath;
    getInstallPath(oldFile, installPath);

   Owned<IDeployTask> task = createDeployTask(*m_pCallback, "Compare File", m_process.queryName(), m_name.get(),
     m_curInstance, newFile, installPath.str(), m_curSSHUser.str(), m_curSSHKeyFile.str(),
     m_curSSHKeyPassphrase.str(), m_useSSHIfDefined);
   m_pCallback->printStatus(task);
   task->compareFile(DTC_CRC | DTC_SIZE);
   m_pCallback->printStatus(task);
   checkAbort(task);
}
//---------------------------------------------------------------------------
//  deployInstance
//---------------------------------------------------------------------------
void CConfigGenEngine::deployInstance(IPropertyTree& instanceNode, bool useTempDir)
{
    StringAttr hostDir(m_outDir);
    StringAttr destDir(useTempDir ? getDeployDir(instanceNode).str() : hostDir.get());
    
    const char* pszHostDir = hostDir.get();
    if (pszHostDir && *pszHostDir==PATHSEPCHAR && *(pszHostDir+1)==PATHSEPCHAR)
        connectToHost(instanceNode);
    beforeDeployInstance(instanceNode, destDir);
    copyInstallFiles(instanceNode, destDir);
    afterDeployInstance(instanceNode, destDir);
    
    if (!m_compare && useTempDir)
    {
        checkAbort();
        EnvMachineOS os= m_envDepEngine.lookupMachineOS(instanceNode);
        renameDir(hostDir, NULL, os);
        renameDir(destDir, hostDir, os);
    }
}
Exemple #3
0
bool VideoPlayer::playFrame(int slot, Properties &properties) {
	Video *video = getVideoBySlot(slot);
	if (!video)
		return false;

	bool primary = slot == 0;

	if (video->decoder->getCurFrame() != properties.startFrame) {

		if (properties.startFrame != -1) {
			// Seek into the middle of the video

			if (video->decoder->hasSound()) {
				// But there's sound

				if (properties.forceSeek) {
					// And we force seeking => Seek

					video->decoder->disableSound();
					video->decoder->seek(properties.startFrame + 1, SEEK_SET, true);
				}

			} else
				// No sound => We can safely seek
				video->decoder->seek(properties.startFrame + 1, SEEK_SET, true);

		} else {
			// Seek to the start => We can safely seek

			video->decoder->disableSound();
			video->decoder->seek(0, SEEK_SET, true);
			video->decoder->enableSound();
		}

	}

	if (video->decoder->getCurFrame() > properties.startFrame)
		// If the video is already beyond the wanted frame, skip
		return true;

	bool modifiedPal = false;

	if (primary) {
		// Pre-decoding palette and blitting, only for primary videos

		if ((properties.startFrame == properties.palFrame) ||
		    ((properties.startFrame == properties.endFrame) && (properties.palCmd == 8))) {

			modifiedPal = true;
			_vm->_draw->_applyPal = true;

			if (properties.palCmd >= 4)
				copyPalette(*video, properties.palStart, properties.palEnd);
		}

		if (modifiedPal && (properties.palCmd == 8) && (video->surface != _vm->_draw->_backSurface))
			_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);

		if (_needBlit)
			_vm->_draw->forceBlit();
	}

	const Graphics::Surface *surface = video->decoder->decodeNextFrame();

	WRITE_VAR(11, video->decoder->getCurFrame());

	uint32 ignoreBorder = 0;
	if (_woodruffCohCottWorkaround && (properties.startFrame == 31)) {
		// WORKAROUND: This frame mistakenly masks Coh Cott, making her vanish
		// To prevent that, we'll never draw that part
		ignoreBorder = 50;
	}

	if (surface && primary) {
		// Post-decoding palette and blitting, only for primary videos

		if (_needBlit)
			_vm->_draw->forceBlit(true);

		if (modifiedPal && (properties.palCmd == 16)) {
			if (video->surface == _vm->_draw->_backSurface)
				_vm->_draw->forceBlit();
			_vm->_palAnim->fade(_vm->_global->_pPaletteDesc, -2, 0);
			_vm->_draw->_noInvalidated = true;
			_vm->_video->dirtyRectsAll();
		}

		if (video->decoder->hasPalette() && (properties.palCmd > 1)) {
			copyPalette(*video, properties.palStart, properties.palEnd);

			if (video->surface != _vm->_draw->_backSurface)
				_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
			else
				_vm->_draw->_applyPal = true;
		}

		const Common::List<Common::Rect> &dirtyRects = video->decoder->getDirtyRects();

		if (modifiedPal && (properties.palCmd == 8) && (video->surface == _vm->_draw->_backSurface))
			_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);

		if (video->surface == _vm->_draw->_backSurface) {

			for (Common::List<Common::Rect>::const_iterator rect = dirtyRects.begin(); rect != dirtyRects.end(); ++rect)
				_vm->_draw->invalidateRect(rect->left + ignoreBorder, rect->top, rect->right - 1, rect->bottom - 1);
			if (!video->live)
				_vm->_draw->blitInvalidated();

		} else if (video->surface == _vm->_draw->_frontSurface) {
			for (Common::List<Common::Rect>::const_iterator rect = dirtyRects.begin(); rect != dirtyRects.end(); ++rect)
				_vm->_video->dirtyRectsAdd(rect->left + ignoreBorder, rect->top, rect->right - 1, rect->bottom - 1);

		}

		if (!video->live && ((video->decoder->getCurFrame() - 1) == properties.startFrame))
			// Only retrace if we're playing the frame we actually want to play
			_vm->_video->retrace();

		int32 subtitle = video->decoder->getSubtitleIndex();
		if (subtitle != -1)
			_vm->_draw->printTotText(subtitle);

		if (modifiedPal && ((properties.palCmd == 2) || (properties.palCmd == 4)))
			_vm->_palAnim->fade(_vm->_global->_pPaletteDesc, -2, 0);
	}

	if (primary && properties.waitEndFrame)
		checkAbort(*video, properties);

	if ((video->decoder->getCurFrame() - 1) < properties.startFrame)
		// The video played a frame we actually didn't want, so we have to adjust
		properties.startFrame--;

	return true;
}
Exemple #4
0
 foreach( QString dir, dirs )
 {
     if ( checkAbort() ) return;
     getTracksFromDir( dir, output );
 }
int QueryThread::run()
{
  // Note: The m_abort flag does not actually abort, after the mysql_query function:
  // MySql documentation states:
  //    "When using mysql_use_result(), you must execute mysql_fetch_row() until
  //     a NULL value is returned, otherwise, the unfetched rows are returned as 
  //     part of the result set for your next query. The C API gives the error Commands 
  //     out of sync; you can't run this command now if you forget to do this!"
  // In otherwords: once we've started, we can't stop. So what we actually do is run the 
  // query in full, and just not post any events if this flag is set.

  MYSQL* sql = 0;

  {
    MutexLocker lock(m_resultInfo);
    m_columns.clear();
    m_columnType.clear();
  }

  if (checkAbort())
  {
    MutexLocker lock(m_resultInfo);
    m_abort = false;
    postEvent(QUERY_ABORTED);
    return 0;
  }

  sql = m_database->lockHandle();
  if (mysql_query(sql, m_query.c_str()) != 0)
	{
    MutexLocker lock(m_resultInfo);
    m_error = true;
    m_errorText = mysql_error(sql);
    postEvent( QUERY_ERROR );

    m_database->unlockHandle();
		return 0;
	}

  MYSQL_RES* pResult = mysql_use_result(sql);
  if (!pResult)
  {
    if (checkAbort())
    {
      m_database->unlockHandle();
      return 0;
    }

		if(mysql_errno(sql))
		{
      MutexLocker lock(m_resultInfo);
      m_error = true;
      m_errorText = mysql_error(sql);
      postEvent( QUERY_ERROR );
		}
		else
		{
      MutexLocker lock(m_resultInfo);
      m_error = false;
      m_lastInsert = mysql_insert_id(sql);
      m_affectedRows = mysql_affected_rows(sql);
      postEvent( QUERY_SUCCESS_NO_DATA );
		}
    m_database->unlockHandle();
		return 0;
  }

  int numColumns = mysql_num_fields(pResult);
  
  {
    {
      MutexLocker lock(m_resultInfo);
	    for(int i = 0; i < numColumns; i++)
      {
        MYSQL_FIELD* field = mysql_fetch_field_direct(pResult, i);
        if (field && field->name && strlen(field->name))
        {
          m_columns.push_back( std::string(field->name) );

          if (field->type == MYSQL_TYPE_TINY || field->type == MYSQL_TYPE_SHORT || field->type == MYSQL_TYPE_LONG || field->type == MYSQL_TYPE_LONG)
            m_columnType.push_back( INTEGER );
          else if (field->type == MYSQL_TYPE_FLOAT || field->type == MYSQL_TYPE_DOUBLE)
            m_columnType.push_back( FLOATING_POINT );
          else
            m_columnType.push_back( STRING );
        }
        else
        {
          std::stringstream col;
          col << (i+1);

          m_columns.push_back( col.str() );
          m_columnType.push_back( STRING );
        }
      }
    }

    if (!checkAbort())
      postEvent( QUERY_COLUMNS );
  }

	MYSQL_ROW CurrentRow = mysql_fetch_row(pResult);
	while (CurrentRow)
	{
    if (checkAbort())
    {
      CurrentRow = mysql_fetch_row(pResult);
      continue;
    }

    DataRow* row = new DataRow;

	  for(int i = 0; i < numColumns; i++)
	  {
		  if (CurrentRow[i])
		  {
        row->push_back( new std::string( CurrentRow[i] ) );
		  }
		  else
		  {
			  row->push_back( 0 );
		  }
	  }    

    postEvent( QUERY_DATA, row );

    CurrentRow = mysql_fetch_row(pResult);
  }

	if(mysql_errno(sql))
	{
    {
      MutexLocker lock(m_resultInfo);
      m_error = true;
      m_errorText = mysql_error(sql);
    }
    if (!checkAbort())
      postEvent( QUERY_ERROR );
    else
    {
      postEvent( QUERY_ABORTED );

      MutexLocker lock(m_resultInfo);
      m_abort = false;
    }
	}
	else
	{
    {
      MutexLocker lock(m_resultInfo);
      m_error = false;
      m_lastInsert = mysql_insert_id(sql);
      m_affectedRows = mysql_affected_rows(sql);
    }
    if (!checkAbort())
      postEvent( QUERY_SUCCESS );
    else
    {
      postEvent( QUERY_ABORTED );

      MutexLocker lock(m_resultInfo);
      m_abort = false;
    }
	}

  m_database->unlockHandle();

	mysql_free_result(pResult);

  return 0;
}