Esempio n. 1
0
void ZmqWorker::Run()
{
    while (!ProcessExit())
    {
        _poller->poll();
        if (_poller->events(*_taskQueue) & zmqpp::poller::poll_in)
            PerformWork();
    }
}
Esempio n. 2
0
void xrCompressor::ProcessTargetFolder()
{
	// collect files
	files_list			= FS.file_list_open	("$target_folder$",FS_ListFiles);
	R_ASSERT2			(files_list,	"Unable to open folder!!!");
	// collect folders
	folders_list		= FS.file_list_open	("$target_folder$",FS_ListFolders);
	R_ASSERT2			(folders_list,	"Unable to open folder!!!");
	// compress
	PerformWork			();
	// free lists
	FS.file_list_close	(folders_list);
	FS.file_list_close	(files_list);
}
Esempio n. 3
0
void CUILogsWnd::ReLoadNews()
{
	m_news_in_queue.clear();
	if ( !g_actor )
	{
		m_need_reload	= false;
		return;
	}

	LPCSTR date_str = InventoryUtilities::GetDateAsString( m_selected_period, InventoryUtilities::edpDateToDay ).c_str();
	m_period->SetText( date_str );
	Fvector2 pos = m_period_caption->GetWndPos();
	pos.x = m_period->GetWndPos().x - m_period_caption->GetWidth() - m_prev_period->GetWidth() - 5.0f;
	m_period_caption->SetWndPos( pos );

	ALife::_TIME_ID end_period = GetShiftPeriod( m_selected_period, 1 );

	VERIFY( m_filter_news && m_filter_talk );
	GAME_NEWS_VECTOR& news_vector = Actor()->game_news_registry->registry().objects();

//	u32 currentNews = 0;

	bool filter_news = m_filter_news->GetCheck();
	bool filter_talk = m_filter_talk->GetCheck();
	
	GAME_NEWS_VECTOR::iterator ib = news_vector.begin();
	GAME_NEWS_VECTOR::iterator ie =	news_vector.end();
	for ( u32 idx=0; ib != ie; ++ib,++idx )
	{
		bool add = false;
		GAME_NEWS_DATA& gn = (*ib);
		if ( gn.m_type == GAME_NEWS_DATA::eNews && filter_news )
		{
			add = true;
		}
		else if ( gn.m_type == GAME_NEWS_DATA::eTalk && filter_talk )
		{
			add = true;
		}
		if ( gn.receive_time < m_selected_period || end_period < gn.receive_time )
		{
			add = false;
		}

		if ( add )
		{
			m_news_in_queue.push_back(idx);
//			++currentNews;
		}
	}
	m_need_reload = false;
	
	if(!m_list->Empty())
	{
		m_items_cache.insert(m_items_cache.end(),m_list->Items().begin(),m_list->Items().end());
		m_list->Items().clear();

		std::for_each(m_items_cache.begin(),m_items_cache.end(),itemToCache);
	}
	PerformWork();
}
Esempio n. 4
0
void xrCompressor::ProcessLTX(CInifile& ltx)
{
	config_ltx	=&ltx;

	if (ltx.line_exist("options","exclude_exts"))
		_SequenceToList(exclude_exts, ltx.r_string("options","exclude_exts"));

	files_list				= xr_new< xr_vector<char*> >();
	folders_list			= xr_new< xr_vector<char*> >();

	if(ltx.section_exist("include_folders"))
	{
		CInifile::Sect& if_sect	= ltx.r_section("include_folders");

		for (CInifile::SectCIt if_it=if_sect.Data.begin(); if_it!=if_sect.Data.end(); ++if_it)
		{
			BOOL ifRecurse		= CInifile::IsBOOL(if_it->second.c_str());
			u32 folder_mask		= FS_ListFolders | (ifRecurse?0:FS_RootOnly);

			string_path path;
			LPCSTR _path		= 0==xr_strcmp(if_it->first.c_str(),".\\")?"":if_it->first.c_str();
			xr_strcpy			(path,_path);
			u32 path_len		= xr_strlen(path);
			if ((0!=path_len)&&(path[path_len-1]!='\\')) xr_strcat(path,"\\");

			Msg					("");
			Msg					("Processing folder: '%s'",path);
			BOOL efRecurse;
			BOOL val			= IsFolderAccepted(ltx,path,efRecurse);
			if (val || (!val&&!efRecurse))
			{ 
				if (val)		
					GatherFiles	(path);

				xr_vector<char*>*	i_fl_list	= FS.file_list_open	("$target_folder$",path,folder_mask);
				if (!i_fl_list)
				{
					Msg			("ERROR: Unable to open folder list:", path);
					continue;
				}

				xr_vector<char*>::iterator it	= i_fl_list->begin();
				xr_vector<char*>::iterator itE	= i_fl_list->end();
				for (;it!=itE;++it)
				{ 
					xr_string tmp_path	= xr_string(path)+xr_string(*it);
					bool val		= IsFolderAccepted(ltx,tmp_path.c_str(),efRecurse);
					if (val)
					{
						folders_list->push_back(xr_strdup(tmp_path.c_str()));
						Msg			("+F: %s",tmp_path.c_str());
						// collect files
						if (ifRecurse) 
							GatherFiles (tmp_path.c_str());
					}else
					{
						Msg			("-F: %s",tmp_path.c_str());
					}
				}
				FS.file_list_close	(i_fl_list);
			}else
			{
				Msg					("-F: %s",path);
			}
		}
	}//if(ltx.section_exist("include_folders"))
	
	if(ltx.section_exist("include_files"))
	{
		CInifile::Sect& if_sect	= ltx.r_section("include_files");
		for (CInifile::SectCIt if_it=if_sect.Data.begin(); if_it!=if_sect.Data.end(); ++if_it)
		{
		  files_list->push_back	(xr_strdup(if_it->first.c_str()));
		}	
	}

	PerformWork	();

	// free
	xr_vector<char*>::iterator it	= files_list->begin();
	xr_vector<char*>::iterator itE	= files_list->end();
	for (;it!=itE;++it) 
		xr_free(*it);
	xr_delete(files_list);

	it				= folders_list->begin();
	itE				= folders_list->end();
	for (;it!=itE;++it) 
		xr_free(*it);
	xr_delete(folders_list);

	exclude_exts.clear_and_free();
}