Example #1
0
    std::shared_ptr<CameraDriverInterface> GetDevice(const Uri& uri)
    {
        const Uri input_uri = Uri(uri.url);

        // Create input camera
        std::shared_ptr<CameraDriverInterface> input =
                DeviceRegistry<hal::CameraDriverInterface>::I().Create(input_uri);

        std::string filename = ExpandTildePath(
                    uri.properties.Get<std::string>("file", "cameras.xml")
                    );

        if(!FileExists(filename))
        {
            std::string dir = input->GetDeviceProperty(hal::DeviceDirectory);
            while(!dir.empty() && !FileExists(dir+"/"+filename)) {
                dir = DirUp(dir);
            }
            filename = (dir.empty() ? "" : dir + "/") + filename;
        }

        std::shared_ptr<calibu::Rig<double>> rig = calibu::ReadXmlRig( filename );

        UndistortDriver* pDriver = new UndistortDriver( input, rig );
        return std::shared_ptr<CameraDriverInterface>( pDriver );
    }
Example #2
0
    QObjectList loadAll(NodeObjectMap &map) {
        
        Nodes nodes;
        
        Triples candidates = m_s->match(Triple(Node(), Uri("a"), Node()));
        foreach (Triple t, candidates) {
            if (t.c.type != Node::URI) continue;
            nodes.push_back(t.a);
        }

        LoadState state;
        state.requested = nodes;
        state.map = map;
        state.loadFlags = LoadState::IgnoreUnknownTypes;

        collect(state);
        load(state);

        map = state.map;

        QObjectList objects;
        foreach (Node n, nodes) {
            QObject *o = map.value(n);
            if (o) objects.push_back(o);
        }
Example #3
0
    std::shared_ptr<CameraDriverInterface> GetDevice(const Uri& uri)
    {
        const Uri input_uri = Uri(uri.url);
        
        // Create input camera
        std::shared_ptr<CameraDriverInterface> input =
                DeviceRegistry<hal::CameraDriverInterface>::I().Create(input_uri);
 
        std::string filename = ExpandTildePath(
                    uri.properties.Get<std::string>("file", "cameras.xml")
                    );
 
        if(!FileExists(filename))
        {
            std::string dir = input->GetDeviceProperty(hal::DeviceDirectory);
            while(!dir.empty() && !FileExists(dir+"/"+filename)) {
                dir = DirUp(dir);
            }
            filename = (dir.empty() ? "" : dir + "/") + filename;
        }

        calibu::CameraRig rig = calibu::ReadXmlRig( filename );
        if(rig.cameras.size() != 2) {
            throw DeviceException("Unable to find 2 cameras in file '" + filename + "'");
        }

        RectifyDriver* rectify = new RectifyDriver( input, rig );
        return std::shared_ptr<CameraDriverInterface>( rectify );
    }
Example #4
0
int __stdcall main()
{
	/*
	 * a simple example shows how to download internet resources 
	 * while keeping the directory structure.
	 */
	String root    = _R("GitHub/"); // root dir to save files
	String files[] = {
		_R("https://github-windows.s3.amazonaws.com/Application%20Files/GitHub_3_1_1_4/zh-Hans/Microsoft.Expression.Interactions.resources.dll.deploy"),  
		_R("https://github-windows.s3.amazonaws.com/Application%20Files/GitHub_3_1_1_4/zh-Hant/Microsoft.Expression.Interactions.resources.dll.deploy") 
	}; // files to be download
	Directory::Exist(root) || Directory::Create(root);

	for (auto &fn : files)
	{
		String path = Uri(fn).PathAndQuery;
		ManagedObject<StringArray> dirs = path.Substring(1, path.LastIndexOf(_T("/")) - 1).Split(RLIB_STR_LEN(_T("/")), 16);
		String dir = root;
		foreachp(lpdir, dirs)
		{
			dir += HttpUtility::UrlDecode(*lpdir);
			Directory::Exist(dir) || Directory::Create(dir);
		}

		String filename = path.Substring(path.LastIndexOfR(_T("/"))); // assumes that there is not query part in URL 
		bool result = WebClient::DownloadFile(fn, dir + filename);

		printf("%s %s\n", RT2A(filename).toGBK(), result ? "succeed" : "failed");
	}
Example #5
0
bool MaprFileSystem::ListDirectory(const std::string& uri, std::vector<std::string>* contents){
  CHECK(contents);
  contents->clear();
  std::string path = GetUriPathOrDie(uri);
  std::string host = "default";
  hdfsFS fs = hdfsConnect(host.c_str(), 0); // use default config file settings
  int num_entries;
  hdfsFileInfo* entries = hdfsListDirectory(fs, path.c_str(), &num_entries);
  hdfsFileInfo* cur_entry = entries;
  for (int i=0; i < num_entries; ++i) {
    // Sometimes the list directory command returns paths with the scheme and sometimes it doesn't
    // Strange.
    // Anyway, we need to consistently output uris with a proper scheme prefix.
    std::string cur_scheme, cur_path, error;
    if (ParseUri(cur_entry->mName, &cur_scheme, &cur_path, &error)){
      CHECK_EQ(cur_scheme, "maprfs"); // if it has a scheme prefix, make sure it is maprfs as expected
    }
    else{
      // this doesn't have a uri scheme prefix, so assume it is just the path portion
      cur_path = cur_entry->mName;
    }

    contents->push_back(Uri("maprfs", cur_path));

    cur_entry++;
  }
  hdfsFreeFileInfo(entries, num_entries);
  CHECK_EQ(hdfsDisconnect(fs), 0);
  return true;
}
Example #6
0
  std::shared_ptr<CameraDriverInterface> GetDevice(const Uri& uri)
  {
    std::string sFormat = uri.properties.Get<std::string>("fmt", "MONO8");
    std::string sRange = uri.properties.Get<std::string>("range", "1");
    ImageDim dims = uri.properties.Get<ImageDim>("size", ImageDim(0, 0));
    int channel = uri.properties.Get<int>("channel", -1);
    double dRange;

    if(sRange == "ir")
      dRange = 1023; // OpenNi uses the 10 l.s.bits only (range [0, 1023])
    else if(sRange == "ir2")
      dRange = 20000; // libfreenect2 uses this value
    else if(sRange == "depth")
      dRange = 4500; // max range (mm) of asus xtion pro live
    else {
      dRange = strtod(sRange.c_str(), nullptr);
      if(dRange == 0.) dRange = 1.;
    }

    const Uri input_uri = Uri(uri.url);

    // Create input camera
    std::shared_ptr<CameraDriverInterface> Input =
        DeviceRegistry<hal::CameraDriverInterface>::I().Create(input_uri);

    ConvertDriver* pDriver = new ConvertDriver( Input, sFormat, dRange, dims,
                                                channel);
    return std::shared_ptr<CameraDriverInterface>( pDriver );
  }
Example #7
0
	void Start() override {
		if (!RpcUrl.get_Port())
			RpcUrl = Uri("http://127.0.0.1:" + Convert::ToString(GetFreePort()));
		else {
			try {
				DBG_LOCAL_IGNORE_CONDITION(errc::connection_refused);

				Call("getinfo");			

				if (!PathDaemon.empty()) {
					try {
						vector<Process> ps = Process::GetProcessesByName(PathDaemon.stem().c_str());	//!!! incorrect process can be selected and then terminated
						if (!ps.empty())
							m_process = ps.back();
					} catch (RCExc) {
					}
				}
				return;
			} catch (system_error& DBG_PARAM(ex)) {
				TRC(1, ex.code() << " " << ex.what());
			}
		}

		if (PathDaemon.empty()) {
			LOG("Currency daemon for " << Name << " is unavailable");
			return;
		}
		if (m_process) {
			if (!m_process.HasExited)
				return;
			TRC(2, "Process " << m_process.get_ID() << " exited with code " << m_process.get_ExitCode());
		}
		
		String exeFilePath = System.get_ExeFilePath();
		ostringstream os;
		create_directories(DataDir);
		Listen ? (os << " -port=" << GetFreePort()) : (os << " -listen=0");
		os << " -rpcport=" << RpcUrl.get_Port()
			<< " -rpcallowip=127.0.0.1"
			<< " -rpcuser="******" -rpcpassword="******" -daemon"
			<< " -server"
			<< (IsTestNet ? " -testnet" : "")
			<< " -datadir=\"" << DataDir << "\"";
		if (EnableNotifications) {
			os << " -blocknotify=\"" << exeFilePath << " " << EpApi << " blocknotify " << Name << " %s\""
			<< " -alertnotify=\"" << exeFilePath << " " << EpApi << " alertnotify " << Name << " %s\"";		
			if (WalletNotifications)
				os << " -walletnotify=\"" << exeFilePath << " " << EpApi <<  " walletnotify " << Name << " %s\"";
		}
		if (!Args.empty())
			os << " " << Args;
		ProcessStartInfo psi;
		psi.Arguments = os.str();
		psi.FileName = PathDaemon;
		psi.EnvironmentVariables["ComSpec"] = exeFilePath;										// to avoid console window
		m_process = Process::Start(psi);
	}
Example #8
0
int GWindow::OnDrop(char *Format, GVariant *Data, GdcPt2 Pt, int KeyState)
{
	int Status = DROPEFFECT_NONE;

	if (Format && Data)
	{
		if (stricmp(Format, LGI_FileDropFormat) == 0)
		{
			GArray<char*> Files;
			if (Data->IsBinary())
			{
				GToken Uri(	(char*)Data->Value.Binary.Data,
							"\r\n,",
							true,
							Data->Value.Binary.Length);
				for (int n=0; n<Uri.Length(); n++)
				{
					char *File = Uri[n];
					if (strnicmp(File, "file:", 5) == 0)
						File += 5;
					
					char *i = File, *o = File;
					while (*i)
					{
						if (i[0] == '%' &&
							i[1] &&
							i[2])
						{
							char h[3] = { i[1], i[2], 0 };
							*o++ = htoi(h);
							i += 3;
						}
						else
						{
							*o++ = *i++;
						}
					}
					*o++ = 0;
					
					if (FileExists(File))
					{
						Files.Add(NewStr(File));
					}
				}
			}
			
			if (Files.Length())
			{
				Status = DROPEFFECT_COPY;
				OnReceiveFiles(Files);
				Files.DeleteArrays();
			}
		}
	}
	
	return Status;
}
Example #9
0
int DeleteOp::executeOp() {
    DavixError* tmp_err=NULL;

    DAVIX_SLOG(DAVIX_LOG_DEBUG, DAVIX_LOG_CORE, "{} executing op on ", _scope, _destination_url);

    if(_opts.params.getProtocol() == RequestProtocol::AwsS3) {
        _destination_url += "/?delete";
        PostRequest req(_c, _destination_url, &tmp_err);

        if(tmp_err) {
            Tool::errorPrint(&tmp_err);
            return -1;
        }

        req.setParameters(_opts.params);

        std::ostringstream ss;
        ss << _buf.size();

        // calculate md5 of body and set header fields, these are required for S3 multi-objects delete
        std::string md5;
        S3::calculateMD5(_buf, md5);

        req.addHeaderField("Content-MD5", md5);
        req.addHeaderField("Content-Length", ss.str());

        req.setRequestBody(_buf);

        req.executeRequest(&tmp_err);

        if(tmp_err) {
            Tool::errorPrint(&tmp_err);
            return -1;
        }

        // check response code
        int code = req.getRequestCode();

        if(!httpcodeIsValid(code)) {
            httpcodeToDavixError(req.getRequestCode(), davix_scope_http_request(), "during S3 multi-objects delete operation", &tmp_err);
            if(tmp_err) {
                Tool::errorPrint(&tmp_err);
                return -1;
            }
        }

        std::vector<char> body = req.getAnswerContentVec();

        TRY_DAVIX{
            parse_deletion_result(code, Uri(_destination_url), _scope, body);
        } CATCH_DAVIX(&tmp_err);

        if(tmp_err) {
            Tool::errorPrint(&tmp_err);
            return -1;
        }
    }
Example #10
0
bool MaprOutputCodedBlockFile::Open(std::string uri, short replication, uint64 chunk_size) {
  CHECK_GE(replication, 0);
  CHECK_LE(replication, 6);
  CHECK_GE(chunk_size, 0);

  CHECK(!is_open_);
  if (!IsValidUri(uri, "maprfs")) {
    return false;
  }

  std::string scheme, path;
  CHECK(ParseUri(uri, &scheme, &path)) << "Invalid uri format: " << uri;

  path_ = path;

  // note a chunk_size of zero to hdfs means use hdfs's default... however, we want to use maprfs's default... which should be based on the settings of the parent directory... if it exists
  string parent_path = fs::path(path).remove_filename().string();;
  if (chunk_size == 0){
    string parent_uri = Uri(scheme, parent_path);
    while (!Exists(parent_uri)){
      parent_path = fs::path(parent_path).remove_filename().string();
      parent_uri = Uri(scheme, parent_path);
      LOG(INFO) << "parent_uri: " << parent_uri;
    }
    CHECK(ChunkSize(parent_uri, &chunk_size));
  }

  CHECK_EQ(chunk_size % (1 << 16), 0) << "MaprFS requires chunk size is a multiple of 2^16";
  CHECK_LE(chunk_size, 1024 * (1<<20)) << "hdfs.h uses a signed 32 int which artificially limits the chunk size to 1GB... maprfs can do more, but not through the c api... ;-(";

  file_ = hdfsOpenFile(fs_, path.c_str(), O_WRONLY, 0, replication, chunk_size);
  if (file_ == NULL){
    LOG(ERROR) << "Failed to open file: " << path;
    return false;
  }

  copying_output_stream_.reset(new MaprCopyingOutputStream(this));
  output_stream_.reset(new google::protobuf::io::CopyingOutputStreamAdaptor(copying_output_stream_.get()));

  is_open_ = true;
  uri_ = uri;
  return true;
}
Example #11
0
QgsMimeDataUtils::UriList QgsMimeDataUtils::decodeUriList( const QMimeData* data )
{
  QByteArray encodedData = data->data( QGIS_URILIST_MIMETYPE );
  QDataStream stream( &encodedData, QIODevice::ReadOnly );
  QString xUri; // extended uri: layer_type:provider_key:uri
  UriList list;
  while ( !stream.atEnd() )
  {
    stream >> xUri;
    QgsDebugMsg( xUri );
    list.append( Uri( xUri ) );
  }
  return list;
}
Example #12
0
bool LocalFileSystem::ListDirectory(const std::string& uri, std::vector<std::string>* contents){
  CHECK(contents);
  contents->clear();

  std::string path;
  if (!GetUriPath(uri, &path)){
    return false;
  }

  for (fs::directory_iterator iter(path), end; iter != end;  ++iter) {
    contents->push_back(Uri("local",iter->path().string()));
  }
  return true;
}
Example #13
0
  std::vector<Uri> splitUri(const std::string& url)
  {
    const char C = '&'; // split token

    std::vector<Uri> ret;
    std::string::size_type begin = 0, end = 0;
    for(; end != std::string::npos; begin = end + 1 ) {
      end = url.find( C, begin );
      std::string s;
      if( end == std::string::npos )
        s = url.substr(begin);
      else
        s = url.substr(begin, end - begin);
      if( !s.empty() ) ret.emplace_back( Uri(s) );
    }
    return ret;
  }
static Material *findRecordMaterial(Records &records, SerialId id)
{
    // Time to lookup the material for the record's URI?
    if(!records.userValue(id))
    {
        Material *material = 0;
        try
        {
            material = &App_Materials().find(Uri(records.stringRef(id), RC_NULL)).material();
        }
        catch(Materials::NotFoundError const &)
        {} // Ignore this error.

        records.setUserPointer(id, material);
        records.setUserValue(id, true);
        return material;
    }

    return (Material *) records.userPointer(id);
}
Example #15
0
// -------------------------------------------------------------------------------- //
void AddOnlineLinksMenu( wxMenu * Menu )
{
    wxMenu * SubMenu;
    int index;
    int count;
    wxMenuItem * MenuItem;
    if( Menu )
    {
        SubMenu = new wxMenu();

        guConfig * Config = ( guConfig * ) guConfig::Get();
        wxArrayString Links = Config->ReadAStr( wxT( "Link" ), wxEmptyString, wxT( "searchlinks/links" ) );
        wxArrayString Names = Config->ReadAStr( wxT( "Name" ), wxEmptyString, wxT( "searchlinks/names" ) );
        if( ( count = Links.Count() ) )
        {
            for( index = 0; index < count; index++ )
            {
                wxURI Uri( Links[ index ] );
                MenuItem = new wxMenuItem( Menu, ID_LINKS_BASE + index, Names[ index ], Links[ index ] );
                wxString IconFile = guPATH_LINKICONS + Uri.GetServer() + wxT( ".ico" );
                if( wxFileExists( IconFile ) )
                {
                    MenuItem->SetBitmap( wxBitmap( IconFile, wxBITMAP_TYPE_ICO ) );
                }
                else
                {
                    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_search ) );
                }
                SubMenu->Append( MenuItem );
            }

            SubMenu->AppendSeparator();
        }
        else
        {
            MenuItem = new wxMenuItem( Menu, ID_MENU_PREFERENCES_LINKS, _( "Preferences" ), _( "Add search links in preferences" ) );
            SubMenu->Append( MenuItem );
        }
        Menu->AppendSubMenu( SubMenu, _( "Links" ) );
    }
}
Example #16
0
// -------------------------------------------------------------------------------- //
wxString guMediaRecordCtrl::GenerateRecordFileName( void )
{
    wxString FileName = m_MainPath;

    if( !m_TrackInfo.m_AlbumName.IsEmpty() )
    {
        FileName += NormalizeField( m_TrackInfo.m_AlbumName );
    }
    else
    {
        wxURI Uri( m_TrackInfo.m_FileName );
        FileName += NormalizeField( Uri.GetServer() + wxT( "-" ) + Uri.GetPath() );
    }

    FileName += wxT( "/" );
    if( !m_TrackInfo.m_ArtistName.IsEmpty() )
    {
        FileName += NormalizeField( m_TrackInfo.m_ArtistName ) + wxT( " - " );
    }
    FileName += NormalizeField( m_TrackInfo.m_SongName ) + m_Ext;

    //guLogDebug( wxT( "The New Record Location is : '%s'" ), FileName.c_str() );
    return FileName;
}
Example #17
0
 Uri Uri::parse( const string& value )
 {
     return Uri( value );
 }
// ---------------------------------------------------------------------------
// Encodes the URI
// ---------------------------------------------------------------------------
//              
void CCatalogsHttpTransaction::EncodeUriL()
    {
    DeletePtr( iEncodedUri );
    iEncodedUri = CatalogsHttpUtils::EncodeUriL( Uri() );
    }
Example #19
0
File: uri.cpp Project: respu/yield
Uri Uri::operator+(const string& s) const {
  std::ostringstream uri;
  uri << *this;
  uri << s;
  return Uri(uri.str());
}
Example #20
0
// -------------------------------------------------------------------------------- //
wxString GetUrlContent( const wxString &url, const wxString &referer, bool gzipped )
{
    wxCurlHTTP  http;
    //char *      Buffer;
    wxString RetVal = wxEmptyString;

    http.AddHeader( wxT( "User-Agent: " ) guDEFAULT_BROWSER_USER_AGENT );
    http.AddHeader( wxT( "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" ) );
    if( gzipped )
    {
        http.AddHeader( wxT( "Accept Encoding: gzip,deflate" ) );
    }
    http.AddHeader( wxT( "Accept-Charset: utf-8" ) );
    if( !referer.IsEmpty() )
    {
        http.AddHeader( wxT( "Referer: " ) + referer );
    }

    //guLogMessage( wxT( "Getting content for %s" ), url.c_str() );

    wxMemoryOutputStream Buffer;
    http.SetOpt( CURLOPT_FOLLOWLOCATION, 1 );
    http.Get( Buffer, url );

    if( Buffer.IsOk() )
    {
        int ResponseCode = http.GetResponseCode();
        //guLogMessage( wxT( "ResponseCode: %i" ), ResponseCode );
        if( ResponseCode >= 300  && ResponseCode < 400 )
        {
            //guLogMessage( wxT( "Response %u:\n%s\n%s" ), http.GetResponseCode(), http.GetResponseHeader().c_str(), http.GetResponseBody().c_str() );
            wxString Location = http.GetResponseHeader();
            int Pos = Location.Lower().Find( wxT( "location: " ) );
            if( Pos != wxNOT_FOUND )
            {
                Location = Location.Mid( Pos + 10 );
                Location.Truncate( Location.Find( wxT( "\r\n" ) ) );
                if( Location.StartsWith( wxT( "/" ) ) )
                {
                    wxURI Uri( url );
                    wxString NewURL;
                    if( Uri.HasScheme() )
                        NewURL = Uri.GetScheme() + wxT( "://" );
                    NewURL += Uri.GetServer();
                    NewURL += Location;
                    Location = NewURL;
                }
                return GetUrlContent( Location, referer, gzipped );
            }
        }
        else if( ResponseCode >= 400 )
            return wxEmptyString;

        wxString ResponseHeaders = http.GetResponseHeader();
        //guLogMessage( wxT( "Response %u:\n%s\n%s" ), http.GetResponseCode(), http.GetResponseHeader().c_str(), http.GetResponseBody().c_str() );

        if( ResponseHeaders.Lower().Find( wxT( "content-encoding: gzip" ) ) != wxNOT_FOUND )
        {
            //guLogMessage( wxT( "Response Headers:\n%s" ), ResponseHeaders.c_str() );
            wxMemoryInputStream Ins( Buffer );
            wxZlibInputStream ZIn( Ins );
            wxStringOutputStream Outs( &RetVal );
            ZIn.Read( Outs );
        }
        else
        {
            //RetVal = wxString( Buffer, wxConvUTF8 );
//            wxStringOutputStream Outs( &RetVal );
//            wxMemoryInputStream Ins( Buffer );
//            Ins.Read( Outs );
            if( Buffer.GetLength() )
            {
                size_t Count = Buffer.GetLength();
                const char * pData = ( const char * ) Buffer.GetOutputStreamBuffer()->GetBufferStart();
                RetVal = wxString( pData, wxConvUTF8, Count );
                if( RetVal.IsEmpty() )
                {
                    RetVal = wxString( pData, wxConvISO8859_1, Count );
                    if( RetVal.IsEmpty() )
                    {
                        RetVal = wxString( pData, wxConvLibc, Count );
                    }
                }
            }
        }
        //free( Buffer );
    }
    else
    {
        guLogError( wxT( "Could not get '%s'" ), url.c_str() );
    }
    //guLogMessage( wxT( "Response:\n%s\n###############" ), RetVal.c_str() );
    return RetVal;
}
Example #21
0
// -------------------------------------------------------------------------------- //
wxImage * guGetRemoteImage( const wxString &url, wxBitmapType &imgtype )
{
    wxImage *   Image = NULL;
    wxURI       Uri( url );

    wxString FileName = Uri.GetPath().Lower();

    //guLogMessage( wxT( "Downloading '%s' from '%s'" ), FileName.c_str(), url.c_str() );

    wxMemoryOutputStream Buffer;
    wxCurlHTTP http;
    http.AddHeader( wxT( "User-Agent: " ) guDEFAULT_BROWSER_USER_AGENT );
    //http.AddHeader( wxT( "Accept: */*" ) );
    //http.SetOpt( CURLOPT_FOLLOWLOCATION, 1 );
    try {
        http.Get( Buffer, url );
        if( Buffer.IsOk() )
        {
            long ResCode = http.GetResponseCode();
            //guLogMessage( wxT( "ResCode: %lu" ), ResCode );
            if( ( ResCode < 200 ) || ( ResCode > 299 ) )
            {
                //guLogMessage( wxT( "Code   : %u\n%s" ), ResCode, http.GetResponseHeader().c_str() );
                if( ( ResCode == 301 ) || ( ResCode == 302 ) || ( ResCode == 307 ) )
                {
                    wxString Location = http.GetResponseHeader();
                    int Pos = Location.Lower().Find( wxT( "location: " ) );
                    if( Pos != wxNOT_FOUND )
                    {
                        Location = Location.Mid( Pos + 10 );
                        Location.Truncate( Location.Find( wxT( "\r\n" ) ) );
                        return guGetRemoteImage( Location, imgtype );
                    }
                }
            }

//            if( ResCode != 200 )
//            {
//                guLogMessage( wxT( "Error %u getting remote image '%s'\n%s" ),
//                    http.GetResponseCode(),
//                    url.c_str(),
//                    http.GetResponseHeader().c_str() );
//            }

            wxMemoryInputStream Ins( Buffer );
            if( Ins.IsOk() )
            {
                if( FileName.EndsWith( wxT( ".jpg" ) ) ||
                    FileName.EndsWith( wxT( ".jpeg" ) ) )
                  imgtype = wxBITMAP_TYPE_JPEG;
                else if( FileName.EndsWith( wxT( ".png" ) ) )
                  imgtype = wxBITMAP_TYPE_PNG;
                else if( FileName.EndsWith( wxT( ".gif" ) ) )
                  imgtype = wxBITMAP_TYPE_GIF;
                else if( FileName.EndsWith( wxT( ".bmp" ) ) )
                  imgtype = wxBITMAP_TYPE_BMP;
                else
                  imgtype = wxBITMAP_TYPE_INVALID;

                if( imgtype != wxBITMAP_TYPE_INVALID )
                {
                    Image = new wxImage( Ins, imgtype );
                    if( Image )
                    {
                        if( Image->IsOk() )
                        {
                            return Image;
                        }
                        delete Image;
                    }
                }
            }
        }
    }
    catch( ... )
    {
        guLogError( wxT( "Exception downloading image '%s'" ), url.c_str() );
    }

    return NULL;
}