Exemplo n.º 1
0
int ArchivePanel::Extract(
		const ArchiveItemArray& items, 
		const TCHAR* lpDestDiskPath, 
		bool bWithoutPath
		)
{
	OnStartOperation(OPERATION_EXTRACT, nullptr);

	string strDestDiskPath = lpDestDiskPath;
	AddEndSlash(strDestDiskPath);

	int nResult = m_pArchive->Extract(items, strDestDiskPath, bWithoutPath);

	if ( nResult == RESULT_ERROR )
	{
		string strCommand;

		if ( GetCommand(bWithoutPath?COMMAND_EXTRACT_WITHOUT_PATH:COMMAND_EXTRACT, strCommand) )
		{
			ExecuteStruct ES(items);

			ES.lpCommand = strCommand;
			ES.lpCurrentDiskPath = strDestDiskPath;

			nResult = m_pArchive->ExecuteAsOperation(OPERATION_EXTRACT, ExecuteCommand, &ES);
		}
	}

	if ( nResult == RESULT_ERROR )
		msgError(_T("Extract failed"));

	if ( nResult == RESULT_PARTIAL )
		msgError(_T("Extract succeded partially"));

	if ( nResult == RESULT_CANCEL )
		msgError(_T("Extract was aborted by user"));

//	if ( nResult == RESULT_SUCCESS )
//		msgError(_T("Extract success"));

	return nResult;
}
Exemplo n.º 2
0
conf 
readConf( int verbose ) {
	conf confNMs;
	
	char fd[] = "./server.list";
	char fl[] = "./nms.log";
	char mf[] = "*****@*****.**";
	char ms[] = "NMs: change status to %status";
	char mm[] = "ALERT : your %server:%port change status to %status";
	char msrv[] = "mail.tyneo.com";


	confNMs.fileLog = (char *) malloc( 1 + strlen( fl ) );
	if( NULL == confNMs.fileLog )
		msgError( ERR_MALL );
	strcpy( confNMs.fileLog , fl );
	
	confNMs.fileData = (char *) malloc( 1 + strlen( fd ) );
	if( NULL == confNMs.fileData )
		msgError( ERR_MALL );
	strcpy( confNMs.fileData , fd );
	
	confNMs.mailFrom = (char *) malloc( 1 + strlen( mf ) );
	if( NULL == confNMs.mailFrom )
		msgError( ERR_MALL );
	strcpy( confNMs.mailFrom , mf );
	
	confNMs.mailSubject = (char *) malloc( 1 + strlen( ms ) );
	if( NULL == confNMs.mailSubject )
		msgError( ERR_MALL );
	strcpy( confNMs.mailSubject , ms );
	
	confNMs.mailMsg = (char *) malloc( 1 + strlen( mm ) );
	if( NULL == confNMs.mailMsg )
		msgError( ERR_MALL );
	strcpy( confNMs.mailMsg , mm );
	
	confNMs.mailServeur = (char *) malloc( 1 + strlen( msrv ) );
	if( NULL == confNMs.mailServeur )
		msgError( ERR_MALL );
	strcpy( confNMs.mailServeur , msrv );
	
	return confNMs;
}
Exemplo n.º 3
0
void AppWin::compareDisp()
{
  QString item,cstr;
  int i, pos, p1, p2,  n, d, comp, idx;
  bool ok, comparable;

  Ui::DCompareDisp ui;
  QDialog *dialog = new QDialog;
  ui.setupUi(dialog);

  // set up the data
  for (i=0; i<tabWidget->count(); i++) {
    item = plotWidget[i]->FName;
    
    // only the file name is printed
    item = QDir::current().relativeFilePath(item);
    ui.plot1->addItem(item);
    ui.plot2->addItem(item);
  }

  dialog->exec();
  ok = dialog->result()==QDialog::Accepted;

  if (ok) {
    p1 = ui.plot1->currentRow();
    p2 = ui.plot2->currentRow();
    if (p1==p2) {
      msgInfo(info_CompareSamePlots);
      return;
    }

    comp = EDGE * ui.compEdge->isChecked() + SCREW * ui.compScrew->isChecked();
    if (comp==EDGE) 
      cstr = QString(" (edge)");
    else 
      cstr = QString(" (screw)");

    // create a new widget
    PltWin *pw = new PltWin(tabWidget);
    *pw = *plotWidget[p1];
    
    // set the plot-specific parameters
    if (comp==EDGE)
      pw->DispComponent = DIFF_EDGE;  
    else if (comp==SCREW)
      pw->DispComponent = DIFF_SCREW;     
    pw->FName = tabWidget->tabText(p1) + " (-) " + tabWidget->tabText(p2) + cstr.toLatin1().data();

    comparable = pw->CompareDisp(plotWidget[p2], comp);
    if (!comparable) {
      delete(pw);
      msgError(err_CannotComparePlots);
      return;
    }

    plotWidget.append(pw);
    tabWidget->addTab(pw, pw->FName);
    tabWidget->setCurrentIndex(tabWidget->count()-1);
    tabWidget->show();

    idx = tabWidget->currentIndex();
    actFirstPlot->setEnabled(idx > 0);
    actPrevPlot->setEnabled(idx > 0);
    actNextPlot->setEnabled(idx < tabWidget->count()-1);
    actLastPlot->setEnabled(idx < tabWidget->count()-1);

    repaintStatusBar();
  }
}
Exemplo n.º 4
0
void AppWin::calcDPosPeierlsNabarro_interm()
{
  int icurr = tabWidget->currentIndex();
  PltWin *pwthis = plotWidget[icurr];
  PltWin *pw;
  FILE *f;
  DVector ubat, dpos(2);
  IVector at;
  double ubmin, ubmax;
  int i, istart, iend, nat, j;
  bool ok;

  //  if (pwthis->nchain==0) {
  //    f = fopen("ub_pos.dat", "w+");
  //    fclose(f);
  //  }

  if (pwthis->applyHow==0)
    istart = iend = icurr;
  else {
    istart = 0;
    iend = tabWidget->count()-1;
  }

  at.Allocate(30); at.EnlargeStep(10);
  ubat.Allocate(30); ubat.EnlargeStep(10);  

  for (i=istart; i<=iend; i++) {
    pw = plotWidget[i];
    if (!pw->isSelected) continue;

    if (i != icurr) {
      pw->applyHow = pwthis->applyHow;
      pw->napicked = pwthis->napicked;
      pw->apicked = pwthis->apicked;
    }

    ok = findDPosPeierlsNabarro(pw, dpos, nat, at, ubat, ubmin, ubmax);
    if (!ok) {
      msgError(err_DPosPeierlsNabarro);
      at.Free();
      ubat.Free();
      pw->napicked = 0;
      pwthis->repaint();
      return;
    }

    if (pw->nchain == 0) {
      pw->dposchain.Allocate(6,2); pw->dposchain.EnlargeStep(2,0);
      pw->nachain.Allocate(6); pw->nachain.EnlargeStep(2);
      pw->achain.Allocate(6,30); pw->achain.EnlargeStep(2,10);
      pw->ubchain.Allocate(6,30); pw->ubchain.EnlargeStep(2,10);
      pw->ubchain_min.Allocate(6); pw->ubchain_min.EnlargeStep(2);
      pw->ubchain_max.Allocate(6); pw->ubchain_max.EnlargeStep(2);
    }

    pw->nchain++;
    pw->dposchain(pw->nchain,1) = dpos(1);
    pw->dposchain(pw->nchain,2) = dpos(2);
    pw->nachain(pw->nchain) = nat;
    pw->ubchain_min(pw->nchain) = ubmin;
    pw->ubchain_max(pw->nchain) = ubmax;
    for (j=1; j<=nat; j++) {
      pw->achain(pw->nchain,j) = at(j);
      pw->ubchain(pw->nchain,j) = ubat(j);
    }

    pw->napicked = 0;
  }

  at.Free();
  ubat.Free();
  pwthis->repaint();
}
Exemplo n.º 5
0
void AtlantikNetwork::processNode(QDomNode n)
{
	QDomAttr a;

	for ( ; !n.isNull() ; n = n.nextSibling() )
	{
		QDomElement e = n.toElement();
		if(!e.isNull())
		{
			if (e.tagName() == "server")
			{
				a = e.attributeNode( QString("version") );
				if ( !a.isNull() )
					m_serverVersion = a.value();

				emit receivedHandshake();
			}
			else if (e.tagName() == "msg")
			{
				a = e.attributeNode(QString("type"));
				if (!a.isNull())
				{
					if (a.value() == "error")
						emit msgError(e.attributeNode(QString("value")).value());
					else if (a.value() == "info")
						emit msgInfo(e.attributeNode(QString("value")).value());
					else if (a.value() == "chat")
						emit msgChat(e.attributeNode(QString("author")).value(), e.attributeNode(QString("value")).value());
				}
			}
			else if (e.tagName() == "display")
			{
				int estateId = -1;

				a = e.attributeNode(QString("estateid"));
				if (!a.isNull())
				{
					estateId = a.value().toInt();
					Estate *estate;
					estate = m_atlanticCore->findEstate(a.value().toInt());

					emit displayDetails(e.attributeNode(QString("text")).value(), e.attributeNode(QString("cleartext")).value().toInt(), e.attributeNode(QString("clearbuttons")).value().toInt(), estate);

					bool hasButtons = false;
					for( QDomNode nButtons = n.firstChild() ; !nButtons.isNull() ; nButtons = nButtons.nextSibling() )
					{
						QDomElement eButton = nButtons.toElement();
						if (!eButton.isNull() && eButton.tagName() == "button")
						{
							emit addCommandButton(eButton.attributeNode(QString("command")).value(), eButton.attributeNode(QString("caption")).value(), eButton.attributeNode(QString("enabled")).value().toInt());
							hasButtons = true;
						}
					}

					if (!hasButtons)
						emit addCloseButton();
				}
			}
			else if (e.tagName() == "client")
			{
				a = e.attributeNode(QString("playerid"));
				if (!a.isNull())
					m_playerId = a.value().toInt();

				a = e.attributeNode(QString("cookie"));
				if (!a.isNull())
					emit clientCookie(a.value());
			}
			else if (e.tagName() == "configupdate")
			{
				int configId = -1;
				a = e.attributeNode(QString("configid"));
				if (!a.isNull())
				{
					configId = a.value().toInt();
					ConfigOption *configOption;
					if (!(configOption = m_atlanticCore->findConfigOption(configId)))
						configOption = m_atlanticCore->newConfigOption( configId );

					a = e.attributeNode(QString("name"));
					if (configOption && !a.isNull())
						configOption->setName(a.value());

					a = e.attributeNode(QString("description"));
					if (configOption && !a.isNull())
						configOption->setDescription(a.value());

					a = e.attributeNode(QString("edit"));
					if (configOption && !a.isNull())
						configOption->setEdit(a.value().toInt());

					a = e.attributeNode(QString("value"));
					if (configOption && !a.isNull())
						configOption->setValue(a.value());

					if (configOption)
						configOption->update();
				}

				int gameId = -1;
				a = e.attributeNode(QString("gameid"));
				if (!a.isNull())
				{
					gameId = a.value().toInt();
					for( QDomNode nOptions = n.firstChild() ; !nOptions.isNull() ; nOptions = nOptions.nextSibling() )
					{
						QDomElement eOption = nOptions.toElement();
						if (!eOption.isNull() && eOption.tagName() == "option")
							emit gameOption(eOption.attributeNode(QString("title")).value(), eOption.attributeNode(QString("type")).value(), eOption.attributeNode(QString("value")).value(), eOption.attributeNode(QString("edit")).value(), eOption.attributeNode(QString("command")).value());
					}
					emit endConfigUpdate();
				}
			}
			else if (e.tagName() == "deletegame")
			{
				a = e.attributeNode(QString("gameid"));
				if (!a.isNull())
				{
					int gameId = a.value().toInt();

					Game *game = m_atlanticCore->findGame(gameId);
					if (game)
						m_atlanticCore->removeGame(game);
				}
			}
			else if (e.tagName() == "gameupdate")
			{
				int gameId = -1;

				a = e.attributeNode(QString("gameid"));
				if (!a.isNull())
				{
					gameId = a.value().toInt();

					Player *playerSelf = m_atlanticCore->playerSelf();
					if ( playerSelf && playerSelf->game() )
						kdDebug() << "gameupdate for " << QString::number(gameId) << " with playerSelf in game " << QString::number(playerSelf->game()->id()) << endl;
					else
						kdDebug() << "gameupdate for " << QString::number(gameId) << endl;


					Game *game = 0;
					if (gameId == -1)
					{
						a = e.attributeNode(QString("gametype"));
						if ( !a.isNull() && !(game = m_atlanticCore->findGame(a.value())) )
							game = m_atlanticCore->newGame(gameId, a.value());
					}
					else if (!(game = m_atlanticCore->findGame(gameId)))
						game = m_atlanticCore->newGame(gameId);

					a = e.attributeNode(QString("canbejoined"));
					if (game && !a.isNull())
						game->setCanBeJoined(a.value().toInt());

					a = e.attributeNode(QString("description"));
					if (game && !a.isNull())
						game->setDescription(a.value());

					a = e.attributeNode(QString("name"));
					if (game && !a.isNull())
						game->setName(a.value());

					a = e.attributeNode(QString("players"));
					if (game && !a.isNull())
						game->setPlayers(a.value().toInt());

					a = e.attributeNode(QString("master"));
					if (game && !a.isNull())
					{
						// Ensure setMaster succeeds by creating player if necessary
						Player *player = m_atlanticCore->findPlayer( a.value().toInt() );
						if ( !player )
							player = m_atlanticCore->newPlayer( a.value().toInt() );
						game->setMaster( player );
					}

					QString status = e.attributeNode(QString("status")).value();
					if ( m_serverVersion.left(4) == "0.9." || (playerSelf && playerSelf->game() == game) )
					{
						if (status == "config")
							emit gameConfig();
						else if (status == "init")
							emit gameInit();
						else if (status == "run")
							emit gameRun();
						else if (status == "end")
							emit gameEnd();
					}

					if (game)
						game->update();
				}
			}
			else if (e.tagName() == "deleteplayer")
			{
				a = e.attributeNode(QString("playerid"));
				if (!a.isNull())
				{
					int playerId = a.value().toInt();

					Player *player = m_atlanticCore->findPlayer(playerId);
					if (player)
						m_atlanticCore->removePlayer(player);
				}
			}
			else if (e.tagName() == "playerupdate")
			{
				int playerId = -1;

				a = e.attributeNode(QString("playerid"));
				if (!a.isNull())
				{
					playerId = a.value().toInt();

					Player *player;
					if (!(player = m_atlanticCore->findPlayer(playerId)))
						player = m_atlanticCore->newPlayer( playerId, (m_playerId == playerId) );

					// Update player name
					a = e.attributeNode(QString("name"));
					if (player && !a.isNull())
						player->setName(a.value());

					// Update player game
					a = e.attributeNode(QString("game"));
					if (player && !a.isNull())
					{
						int gameId = a.value().toInt();
						if (gameId == -1)
							player->setGame( 0 );
						else
						{
							// Ensure setGame succeeds by creating game if necessary
							Game *game = m_atlanticCore->findGame(a.value().toInt());
							if (!game)
								game = m_atlanticCore->newGame(a.value().toInt()); // 
							player->setGame( game );
						}
					}

					// Update player host
					a = e.attributeNode(QString("host"));
					if (player && !a.isNull())
						player->setHost(a.value());

					// Update player image/token
					a = e.attributeNode(QString("image"));
					if (player && !a.isNull())
						player->setImage(a.value());

					// Update player money
					a = e.attributeNode(QString("money"));
					if (player && !a.isNull())
						player->setMoney(a.value().toInt());

					a = e.attributeNode(QString("bankrupt"));
					if (player && !a.isNull())
						player->setBankrupt(a.value().toInt());

					a = e.attributeNode(QString("hasdebt"));
					if (player && !a.isNull())
						player->setHasDebt(a.value().toInt());

					a = e.attributeNode(QString("hasturn"));
					if (player && !a.isNull())
						player->setHasTurn(a.value().toInt());

					// Update whether player can roll
					a = e.attributeNode(QString("can_roll"));
					if (player && !a.isNull())
						player->setCanRoll(a.value().toInt());

					// Update whether player can buy
					a = e.attributeNode(QString("can_buyestate"));
					if (player && !a.isNull())
						player->setCanBuy(a.value().toInt());

					// Update whether player can auction
					a = e.attributeNode(QString("canauction"));
					if (player && !a.isNull())
						player->setCanAuction(a.value().toInt());

					// Update whether player can use a card
					a = e.attributeNode(QString("canusecard"));
					if (player && !a.isNull())
						player->setCanUseCard(a.value().toInt());

					// Update whether player is jailed
					a = e.attributeNode(QString("jailed"));
					if (player && !a.isNull())
					{
						player->setInJail(a.value().toInt());
						// TODO: emit signal with player ptr so board can setText and display something
					}

					// Update player location
					a = e.attributeNode(QString("location"));
					if (!a.isNull())
					{
						m_playerLocationMap[player] = a.value().toInt();

						bool directMove = false;

						Estate *estate = m_atlanticCore->findEstate(a.value().toInt());

						a = e.attributeNode(QString("directmove"));
						if (!a.isNull())
							directMove = a.value().toInt();

						if (player && estate)
						{
							if (directMove)
								player->setLocation(estate);
							else
								player->setDestination(estate);
						}
					}

					if (player)
						player->update();
				}
			}
			else if (e.tagName() == "estategroupupdate")
			{
				a = e.attributeNode(QString("groupid"));
				if (!a.isNull())
				{
					int groupId = a.value().toInt();

					EstateGroup *estateGroup = 0;
					bool b_newEstateGroup = false;
					
					if (!(estateGroup = m_atlanticCore->findEstateGroup(groupId)))
					{
						// Create EstateGroup object
						estateGroup = m_atlanticCore->newEstateGroup(a.value().toInt());
						b_newEstateGroup = true;
					}

					a = e.attributeNode(QString("name"));
					if (estateGroup && !a.isNull())
						estateGroup->setName(a.value());

					// Emit signal so GUI implementations can create view(s)
					// TODO:  port to atlanticcore and create view there
					if (estateGroup)
					{
						if (b_newEstateGroup)
							emit newEstateGroup(estateGroup);
						estateGroup->update();
					}
				}
			}
			else if (e.tagName() == "estateupdate")
			{
				int estateId = -1;

				a = e.attributeNode(QString("estateid"));
				if (!a.isNull())
				{
					estateId = a.value().toInt();
					
					Estate *estate = 0;
					bool b_newEstate = false;

					// FIXME: allow any estateId, GUI should not use it to determin its geometry
					if (estateId >= 0 && estateId < 100 && !(estate = m_atlanticCore->findEstate(a.value().toInt())))
					{
						// Create estate object
						estate = m_atlanticCore->newEstate(estateId);
						b_newEstate = true;

						QObject::connect(estate, SIGNAL(estateToggleMortgage(Estate *)), this, SLOT(estateToggleMortgage(Estate *)));
						QObject::connect(estate, SIGNAL(estateHouseBuy(Estate *)), this, SLOT(estateHouseBuy(Estate *)));
						QObject::connect(estate, SIGNAL(estateHouseSell(Estate *)), this, SLOT(estateHouseSell(Estate *)));
						QObject::connect(estate, SIGNAL(newTrade(Player *)), this, SLOT(newTrade(Player *)));

						// Players without estate should get one
						Player *player = 0;
						QPtrList<Player> playerList = m_atlanticCore->players();
						for (QPtrListIterator<Player> it(playerList); (player = *it) ; ++it)
							if (m_playerLocationMap[player] == estate->id())
								player->setLocation(estate);
					}

					a = e.attributeNode(QString("name"));
					if (estate && !a.isNull())
						estate->setName(a.value());

					a = e.attributeNode(QString("color"));
					if (estate && !a.isNull() && !a.value().isEmpty())
						estate->setColor(a.value());

					a = e.attributeNode(QString("bgcolor"));
					if (estate && !a.isNull())
						estate->setBgColor(a.value());

					a = e.attributeNode(QString("owner"));
					Player *player = m_atlanticCore->findPlayer(a.value().toInt());
					if (estate && !a.isNull())
						estate->setOwner(player);

					a = e.attributeNode(QString("houses"));
					if (estate && !a.isNull())
						estate->setHouses(a.value().toInt());

					a = e.attributeNode(QString("mortgaged"));
					if (estate && !a.isNull())
						estate->setIsMortgaged(a.value().toInt());

					a = e.attributeNode(QString("group"));
					if (!a.isNull())
					{
						EstateGroup *estateGroup = m_atlanticCore->findEstateGroup(a.value().toInt());
						if (estate)
							estate->setEstateGroup(estateGroup);
					}

					a = e.attributeNode(QString("can_toggle_mortgage"));
					if (estate && !a.isNull())
						estate->setCanToggleMortgage(a.value().toInt());

					a = e.attributeNode(QString("can_be_owned"));
					if (estate && !a.isNull())
						estate->setCanBeOwned(a.value().toInt());

					a = e.attributeNode(QString("can_buy_houses"));
					if (estate && !a.isNull())
						estate->setCanBuyHouses(a.value().toInt());

					a = e.attributeNode(QString("can_sell_houses"));
					if (estate && !a.isNull())
						estate->setCanSellHouses(a.value().toInt());

					a = e.attributeNode(QString("price"));
					if (estate && !a.isNull())
						estate->setPrice(a.value().toInt());

					a = e.attributeNode(QString("houseprice"));
        				if (estate && !a.isNull())
                				estate->setHousePrice(a.value().toInt());

        				a = e.attributeNode(QString("sellhouseprice"));
        				if (estate && !a.isNull())
                				estate->setHouseSellPrice(a.value().toInt());
						
					a = e.attributeNode(QString("mortgageprice"));
        				if (estate && !a.isNull())
                				estate->setMortgagePrice(a.value().toInt());

        				a = e.attributeNode(QString("unmortgageprice"));
        				if (estate && !a.isNull())
                				estate->setUnmortgagePrice(a.value().toInt());
						
					a = e.attributeNode(QString("money"));
					if (estate && !a.isNull())
						estate->setMoney(a.value().toInt());

					// Emit signal so GUI implementations can create view(s)
					// TODO:  port to atlanticcore and create view there
					if (estate)
					{
						if (b_newEstate)
							emit newEstate(estate);
						estate->update();
					}
				}
			}
Exemplo n.º 6
0
int ExecuteCommand(Archive* pArchive, void* pParam)
{
	ExecuteStruct* pES = (ExecuteStruct*)pParam;

	int nResult = RESULT_ERROR;

	ParamStruct psParam;
	FarPanelInfo info;
		
	TCHAR* lpTempPath = psParam.strTempPath.GetBuffer(260);
	GetTempPath (260, lpTempPath);
	psParam.strTempPath.ReleaseBuffer();

	TCHAR* lpListFileName = psParam.strListFileName.GetBuffer(260);
#ifdef UNICODE
	FSF.MkTemp (lpListFileName, 260, _T("NALT"));
#else
	FSF.MkTemp (lpListFileName, _T("NALT"));
#endif
	psParam.strListFileName.ReleaseBuffer();

	string strFileName = pArchive->GetFileName();
	string strPath;
		
	if ( pES->lpCurrentDiskPath )
		strPath = pES->lpCurrentDiskPath;
	else
	{
		strPath = strFileName;
		CutToSlash(strPath);
	}

	QuoteSpaceOnly(psParam.strTempPath);
	QuoteSpaceOnly(psParam.strListFileName);
	QuoteSpaceOnly(strFileName);
		
	psParam.strArchiveName = strFileName;
	psParam.strShortArchiveName = strFileName;
	psParam.strPassword = pES->lpPassword;
	psParam.strPathInArchive = pArchive->GetCurrentDirectory();
	psParam.strAdditionalCommandLine = pES->lpAdditionalCommandLine;

	string strExecuteString;
	int nStartItemNumber = 0;

	while ( true )
	{
		int nParseResult = ParseString(
				pES->items,
				pES->lpCommand,
				strExecuteString,
				&psParam,
				nStartItemNumber
				);

		if ( (nParseResult == PE_SUCCESS) || (nParseResult == PE_MORE_FILES) )
		{
			PROCESS_INFORMATION pInfo;
			STARTUPINFO sInfo;

			memset (&sInfo, 0, sizeof (STARTUPINFO));
			sInfo.cb = sizeof (STARTUPINFO);

			apiExpandEnvironmentStrings(strExecuteString, strExecuteString);

			HANDLE hScreen = Info.SaveScreen(0, 0, -1, -1);

#ifdef UNICODE
			Info.Control(INVALID_HANDLE_VALUE, FCTL_GETUSERSCREEN, 0, 0);
#else
			Info.Control(INVALID_HANDLE_VALUE, FCTL_GETUSERSCREEN, 0);
#endif
			if ( CreateProcess (
					NULL,
					strExecuteString.GetBuffer(),
					NULL,
					NULL,
					TRUE,
					0,
					NULL,
					strPath, 
					&sInfo,
					&pInfo
					) )
			{
				WaitForSingleObject(pInfo.hProcess, INFINITE);

				DWORD dwExitCode;
				GetExitCodeProcess(pInfo.hProcess, &dwExitCode);

				CloseHandle (pInfo.hProcess);
				CloseHandle (pInfo.hThread);

				nResult = (dwExitCode == 0)?RESULT_SUCCESS:RESULT_ERROR;
			}
			else
			{
				string strError;
				strError.Format(_T("CreateProcess failed - %d\n%s"), GetLastError(), strExecuteString.GetString());
				msgError(strError);
			}

#ifdef UNICODE
			Info.Control(INVALID_HANDLE_VALUE, FCTL_SETUSERSCREEN, 0, 0);
#else
			Info.Control(INVALID_HANDLE_VALUE, FCTL_SETUSERSCREEN, 0);
#endif

			Info.RestoreScreen(NULL);
			Info.RestoreScreen(hScreen);
		}

		if ( nParseResult != PE_MORE_FILES )
			break;
	}
		
	DeleteFile (psParam.strListFileName); //WARNING!!!

	return nResult;
}
Exemplo n.º 7
0
LONG_PTR __stdcall hndFilterOneFormat(FarDialog* D, int nMsg, int nParam1, LONG_PTR nParam2)
{
	ArchiveFilterEntry* pFE = (ArchiveFilterEntry*)D->GetDlgData();

	if ( (nMsg == DN_LISTCHANGE) && (nParam1 == ID_FOF_ACTIONLIST) )
	{
		if ( nParam2 == 1 ) //do block
		{	
			FarListPos pos;

			D->ListGetCurrentPos(ID_FOF_MODULELIST, &pos);


			FarListInsert ins;

			ins.Index = 0;
			ins.Item.Flags = 0;
#ifdef UNICODE
			ins.Item.Text = _T("All");
#else
			strcpy(ins.Item.Text, _T("All"));
#endif

			int index = D->ListInsert(ID_FOF_MODULELIST, &ins);
			D->ListSetDataEx(ID_FOF_MODULELIST, index, (void*)0, sizeof(void*));

			pos.SelectPos++;
			D->ListSetCurrentPos(ID_FOF_MODULELIST, &pos);

		}
		else
		{
			FarListDelete del;

			del.StartIndex = 0;
			del.Count = 1;

			D->ListDelete(ID_FOF_MODULELIST, &del);
////////////
			FarListPos pos;
			D->ListGetCurrentPos(ID_FOF_MODULELIST, &pos);

			if ( pos.SelectPos != -1 )
			{
				ArchiveModule* pModule = (ArchiveModule*)D->ListGetData(ID_FOF_MODULELIST, pos.SelectPos);

				UpdatePlugins(D, pModule, NULL);
			}

			return TRUE;
//////////////


		}

		return TRUE;
	}
	else

	if ( (nMsg == DN_LISTCHANGE) && (nParam1 == ID_FOF_MODULELIST) )
	{
		FarListPos pos;
		D->ListGetCurrentPos(ID_FOF_MODULELIST, &pos);

		if ( pos.SelectPos != -1 )
		{
			ArchiveModule* pModule = (ArchiveModule*)D->ListGetData(ID_FOF_MODULELIST, pos.SelectPos);

			UpdatePlugins(D, pModule, NULL);
		}

		return TRUE;
	}
	else

	if ( (nMsg == DN_LISTCHANGE) && (nParam1 == ID_FOF_PLUGINLIST) )
	{
		FarListPos pos;
		D->ListGetCurrentPos(ID_FOF_PLUGINLIST, &pos);

		if ( pos.SelectPos != -1 )
		{
			ArchivePlugin* pPlugin = (ArchivePlugin*)D->ListGetData(ID_FOF_PLUGINLIST, pos.SelectPos);

			UpdateFormats(D, pPlugin, NULL);
		}

		return TRUE;
	}
	else

	if ( nMsg == DN_INITDIALOG )
	{
		FarListPos pos;

		D->ListAddStr(ID_FOF_ACTIONLIST, _T("Process"));
		D->ListAddStr(ID_FOF_ACTIONLIST, _T("Block"));

		pos.SelectPos = pFE->IsExclude()?1:0;

		D->ListSetCurrentPos(ID_FOF_ACTIONLIST, &pos);
		
		pos.SelectPos = 0;
		pos.TopPos = -1;

		Array<ArchiveModule*> modules;
		
		pManager->GetModules(modules);

		for (unsigned int i = 0; i < modules.count(); i++)
		{
			const ArchiveModule* pModule = modules[i];

			int index = D->ListAddStr(ID_FOF_MODULELIST, FSF.PointToName(pModule->GetModuleName()));
			D->ListSetDataEx(ID_FOF_MODULELIST, index, (void*)pModule, sizeof(void*));

			if ( pFE && !pFE->IsAllModules() && pFE->GetModule() && (pFE->GetModule()->GetUID() == pModule->GetUID()) )
				pos.SelectPos = index;
		}

		D->ListSetCurrentPos(ID_FOF_MODULELIST, &pos); 

		ArchiveModule* pModule = (ArchiveModule*)D->ListGetData(ID_FOF_MODULELIST, pos.SelectPos);
		UpdatePlugins(D, pModule, pFE); 

		//return TRUE; hmm
	}
	else

	if ( (nMsg == DN_CLOSE) && (nParam1 == D->FirstButton()) )
	{
		string strName = D->GetConstTextPtr(ID_FOF_NAMEEDIT);

		if ( strName.IsEmpty() )
		{
			msgError(_T("name empty"));
			return FALSE;
		}

		string strMask = D->GetConstTextPtr(ID_FOF_MASKEDIT);

		if ( strMask.IsEmpty() )
		{
			msgError(_T("mask empty"));
			return FALSE;
		}

		FarListPos pos;

		D->ListGetCurrentPos(ID_FOF_ACTIONLIST, &pos);

		pFE->SetExclude(pos.SelectPos == 1);
		pFE->SetName(strName);
		pFE->SetMask(strMask);

		pFE->SetAllFormats(true);
		pFE->SetAllModules(true);
		pFE->SetAllPlugins(true);

		D->ListGetCurrentPos(ID_FOF_MODULELIST, &pos);
		ArchiveModule* pModule = (ArchiveModule*)D->ListGetData(ID_FOF_MODULELIST, pos.SelectPos);

		if ( pModule )
		{
			pFE->SetModule(pModule);

			D->ListGetCurrentPos(ID_FOF_PLUGINLIST, &pos);
			ArchivePlugin* pPlugin = (ArchivePlugin*)D->ListGetData(ID_FOF_PLUGINLIST, pos.SelectPos);

			if ( pPlugin )
			{
				pFE->SetPlugin(pPlugin);

				D->ListGetCurrentPos(ID_FOF_FORMATLIST, &pos);
				ArchiveFormat* pFormat = (ArchiveFormat*)D->ListGetData(ID_FOF_FORMATLIST, pos.SelectPos);

				if ( pFormat )
					pFE->SetFormat(pFormat);
			}
		}

		return TRUE;
	}
	
	return D->DefDlgProc(nMsg, nParam1, nParam2);
}