Example #1
0
//---------------------------------------------------------------------------
bool TShortCuts::AddOwnerWithCode(TMenuItem *mi,AnsiString code,AnsiString Prefix, int level,int sortorder)
{
  if(mi->IsLine()) //skip separators
    return false;
  if(mi->Count)
    return false;
  if(IsBlockedOwner(mi))
    return false;

  TShortCutOwner sco;
  sco.mi=mi;
  sco.prefix=Prefix;
  sco.level=level;
  sco.name=StripHotkey(mi->Caption);
  sco.sortorder=sortorder;
  sco.code=code;
  shortcutowners.push_back(sco);
  if(mi)
  {
    TShortCut sc=GetShortCut(sco.GetPrefixedStr());
    if(sc!=65535)
    {
	  TShortCutOwner *sco=shortcutowners.end().operator ->()-1;
      AnsiString error;
      ChangeShortCut(sco,sc,error);
    }else if(mi->ShortCut)
      SetShortCut(mi->ShortCut,sco.GetPrefixedStr());
  }
  return true;
}
Example #2
0
long LogOpenQuiet( char *filename, __int64 *filelen )
{
	char	rawfileName[256];
	long	hnd = 0;

	DateFixFilename( filename, rawfileName );

	// Check if we trying to open a shortcut
	if ( IsShortCut( rawfileName ) ){
		char linkpath[256];
		mystrcpy( linkpath, rawfileName );
#if DEF_WINDOWS
		GetShortCut( linkpath, rawfileName );
#endif
	}

	// Now see if the we want to open a short cut to a URL
	if ( IsURLShortCut( rawfileName ) ){
		char linkpath[256];
		mystrcpy( linkpath, rawfileName );
#if DEF_WINDOWS
		GetURLShortCut( linkpath, rawfileName );
#endif
	}

	// Check for a just a plain URL
	if ( IsURL( rawfileName ) ){
		StatusSetID( IDS_REMOTELOG , strrchr( rawfileName,'/' ) );
		hnd = (long)INetOpen( rawfileName, filelen );
		return hnd;
	}

	// Check other types
	char format[100];
	// determine if its PKZIP file and if so... dont open it, YET
	if ( IsFileInvalid( rawfileName, format ) )
		return 0;

#ifndef DEF_MAC
	if ( IsPKZIP( rawfileName ) )
		hnd = (long)UnzipOpen( rawfileName, NULL );
	else
#ifdef _BZLIB_H
	if ( aIsBzFile( rawfileName ) )		// PLEASE DO THIS SOON FOR MAC.... at least for manual completeness, hey OSX people will love it.
		hnd = (long)BZ2_bzopen( rawfileName, "rb" );
	else 
#endif
#endif
	{
		hnd = (long)gzopen( rawfileName, "rb" );
	}

	if ( filelen && hnd )
		*filelen = GetFileLength( rawfileName );

	return hnd;
}
Example #3
0
static gzFile DBIO_OpenFile( const char *filename )
{
	char rawfileName[256];

	strcpy( rawfileName, filename );

	DateFixFilename( rawfileName, 0 );

	if ( IsShortCut( rawfileName ) ){
		char linkpath[256];
		mystrcpy( linkpath, rawfileName );
#if DEF_WINDOWS
		GetShortCut( linkpath, rawfileName );
#endif
	}

	gzFile fh=0;

	if ( !IsURL( rawfileName ) )
	{
		char format[256];

		// determine if its PKZIP file and if so... dont open it, YET
		if ( IsFileInvalid( rawfileName, format ) )
		{
			OutDebugs( "Cannot open %s because it is a %s file.", rawfileName, format );
			return 0;
		}
		else 
		{
			if ( IsBzFile( rawfileName ) )
				; // fh=bzopen( rawfileName, "rb" ); removed for compat build RHF
			else
				fh=gzopen( rawfileName, "rb" );
		}
	}
	return fh;
}