bool    DeleteDataFilter (long index) {
   if (_data_filters.IsValidIndex (index)) {
     if (_IsObjectLocked(index, HY_BL_DATASET_FILTER)) {
       return false;
     }
     _KillDataFilterParameters( *GetFilterName (index));
     _data_filters.Delete ((BaseRef)GetFilterName(index), true);
   }
   return true;
 }
AM_ERR CPacketFilterGraph::RunAllFilters()
{
  INFO("=== RunAllFilters");
  for (AM_UINT i = 0; i < mnFilters; i ++) {
    IPacketFilter *pFilter = mFilters[i].pFilter;
    INFO("Run %s (%d)", GetFilterName(pFilter), i + 1);
    EnableOutputPins(pFilter);
    AM_ERR err = pFilter->Run();
    if (err != ME_OK) {
      INFO("Run %s (%d) returns %d", GetFilterName(pFilter), i + 1, err);
      return err;
    }
  }
  INFO("RunAllFilters done");
  return ME_OK;
}
Example #3
0
void WinPreSave(ConfigFile& conf)
{
	strcpy(filterString, "output filter: ");
	for(int i=0;i<NUM_FILTERS;i++)
	{
		static char temp [256];
		sprintf(temp, "%d=%s%c ", i, GetFilterName((RenderFilter)i), i!=NUM_FILTERS-1?',':' ');
		strcat(filterString, temp);
	}
	strcpy(filterString2, "hi-res output filter: ");
	for(int i=0;i<NUM_FILTERS;i++)
	{
		if(GetFilterHiResSupport((RenderFilter)i))
		{
			static char temp [256];
			sprintf(temp, "%d=%s%c ", i, GetFilterName((RenderFilter)i), i!=NUM_FILTERS-1?',':' ');
			strcat(filterString2, temp);
		}
	}
	sprintf(snapVerString, "Snapshot save version. Must be between 1 and %d (inclusive)", SNAPSHOT_VERSION);

//	GetWindowRect (GUI.hWnd, &GUI.window_size);
	GUI.window_size.right -= GUI.window_size.left;
	GUI.window_size.bottom -= GUI.window_size.top;

	int extra_width  = 2*(GetSystemMetrics(SM_CXBORDER) +
						  GetSystemMetrics(SM_CXDLGFRAME));
	GUI.window_size.right -= extra_width;

	int extra_height = 2*(GetSystemMetrics(SM_CYBORDER) +
						  GetSystemMetrics(SM_CYDLGFRAME)) +
						 GetSystemMetrics(SM_CYCAPTION) +
						 GetSystemMetrics(SM_CYMENU) +
						 (GUI.HideMenu ? 0 : (
						  (GUI.window_size.right <= 392 ? GetSystemMetrics(SM_CYMENU) : 0) + // HACK: accounts for menu wrapping (when width is small)
						  (GUI.window_size.right <= 208 ? GetSystemMetrics(SM_CYMENU) : 0) +
						  (GUI.window_size.right <= 148 ? GetSystemMetrics(SM_CYMENU) : 0)));
	GUI.window_size.bottom -= extra_height;

	if(GUI.window_size.bottom < 10) GUI.window_size.bottom = 10;
	if(GUI.window_size.right < 10) GUI.window_size.right = 10;

	conf.DeleteKey("Sound::Mono");
	if(configSort == 2)
		conf.ClearLines();
}
void CPacketFilterGraph::PurgeAllFilters()
{
  INFO("=== PurgeAllFilters");
  for (AM_UINT i = 0; i < mnFilters; i ++) {
    INFO("Purge %s (%d)\n", GetFilterName(mFilters[i].pFilter), i + 1);
    PurgeFilter(mFilters[i].pFilter);
  }
  INFO("PurgeAllFilters done");
}
AM_ERR CPacketFilterGraph::Connect(IPacketFilter *pUpstreamFilter,
                                   AM_UINT indexUp,
                                   IPacketFilter *pDownstreamFilter,
                                   AM_UINT indexDown)
{
  IPacketPin *pOutput = pUpstreamFilter->GetOutputPin(indexUp);
  if (pOutput == NULL) {
    WARN("No such pin: %s[%d]\n", GetFilterName(pUpstreamFilter), indexUp);
    return ME_ERROR;
  }

  IPacketPin *pInput = pDownstreamFilter->GetInputPin(indexDown);
  if (pInput == NULL) {
    WARN("No such pin: %s[%d]\n", GetFilterName(pDownstreamFilter), indexDown);
    return ME_ERROR;
  }

  return CreateConnection(pOutput, pInput);
}
void CPacketFilterGraph::RemoveAllFilters()
{
  INFO("=== RemoveAllFilters");
  for (AM_UINT i = mnFilters; i > 0; i --) {
    INFO("Remove %s (%d)", GetFilterName(mFilters[i-1].pFilter), i);
    mFilters[i - 1].pFilter->Delete();
  }
  mnFilters = 0;
  INFO("RemoveAllFilters done");
}
void CPacketFilterGraph::StopAllFilters()
{
  INFO("=== StopAllFilters");
  for (AM_UINT i = mnFilters; i > 0; i --) {
    IPacketFilter *pFilter = mFilters[i - 1].pFilter;
    INFO("Stop %s (%d)\n", GetFilterName(pFilter), i);
    DisableOutputPins(pFilter);
    AM_ENSURE_OK_( pFilter->Stop());
  }
  INFO("StopAllFilters done");
}
AM_ERR CPacketFilterGraph::AddFilter(IPacketFilter *pFilter)
{
  if (mnFilters >= ARRAY_SIZE(mFilters)) {
    AM_ERROR("too many filters\n");
    return ME_TOO_MANY;
  }

  mFilters[mnFilters].pFilter = pFilter;
  mFilters[mnFilters].flags = 0;
  mnFilters ++;

  INFO("Added %s (%d)\n", GetFilterName(pFilter), mnFilters);

  return ME_OK;
}
Example #9
0
bool ExportManager::Export(IExport::ExportType type)
{
	exp = NULL;
	UINT cp;
	std::wstring encoding;
	bool isBin = false;
	switch(type) {
	case IExport::Txt:
		exp = new TxtExport();
		cp = Options::instance->codepageTxt;
		encoding = Options::instance->encodingTxt;
		isFlat = true;
		break;
	case IExport::PlainHtml:
		exp = new PlainHtmlExport();
		cp = Options::instance->codepageHtml1;
		encoding = Options::instance->encodingHtml1;
		break;
	case IExport::RichHtml:
		exp = new RichHtmlExport();
		cp = Options::instance->codepageHtml2;
		encoding = Options::instance->encodingHtml2;
		break;
	case IExport::Binary:
		exp = new BinaryExport();
		cp = CP_UTF8;
		encoding = L"UTF8";
		isFlat = true;
		oldOnTop = true;
		isBin = true;
		break;
	case IExport::Dat:
		exp = new DatExport();
		cp = CP_UTF8;
		encoding = L"UTF8";
		isFlat = true;
		oldOnTop = true;
		isBin = true;
		break;
	default:
		return false;
	}

	std::wstring fileName;
	if (file.empty())
		fileName = GetFile(exp->GetExt(), hwnd, false);
	else
		fileName = ReplaceExt(file, exp->GetExt());

	if (fileName.empty())
		return false;

	std::wofstream* stream;
	if (!isBin) {
		stream = new std::wofstream (fileName.c_str());
		if (!stream->is_open())
			return false;
	
		std::locale filelocale(std::locale(), new codecvt_CodePage<wchar_t>(cp));
		stream->imbue(filelocale);
		exp->SetStream(stream);
	}
	else {
		std::ofstream* cstream = new std::ofstream (fileName.c_str(), std::ios_base::binary);
		if (!cstream->is_open())
			return false;
	
		stream = (std::wofstream*)cstream;
		exp->SetStream(stream);
	}

	exp->WriteHeader(fileName, GetFilterName(), GetMyName(), GetMyId(), GetContactName(), GetProtocolName(), GetContactId(), GetBaseProtocol(), encoding);

	RefreshEventList();

	exp->WriteFooter();
	if (!isBin) {
		stream->close();
		delete stream;
	}
	else {
		std::ofstream* cstream = (std::ofstream*)stream;
		cstream->close();
		delete cstream;
	}

	delete exp;
	return true;
}