void advertdirectory_cpi_impl::sync_is_dir (bool & ret, saga::url entry) { instance_data data (this); saga::url advert_url; advert_url = data->location_.clone(); saga::url url_path = advert_url.get_path(); std::string string_arg = get_full_url(advert_url, entry); saga::url arg(string_arg); std::string last = get_last(arg); std::string pidstring = get_parent_id_of_entry(*client_, arg); std::string node_id_string = get_node_id(*client_, last, pidstring); std::vector<std::string> columnNames; columnNames.push_back("entry:"); int scanner = client_->scannerOpen("nodes", "", columnNames); try { while(true) { TRowResult value; client_->scannerGet(value, scanner); if(value.row == last + "-" + node_id_string) { std::map<std::string,TCell>::const_iterator it; for(it = value.columns.begin(); it != value.columns.end(); it++) { if(it->first == "entry:is_dir") { if(it->second.value == "false") ret = false; else ret = true; } } } } } catch(NotFound &nf) { client_->scannerClose(scanner); } //SAGA_ADAPTOR_THROW ("Not Implemented", saga::NotImplemented); }
// public loadSound(url:String, isStreaming:Boolean) : Void void sound_load(const function_call& fn) { if (fn.nargs > 1) { sound_handler* s = get_sound_handler(); if (s != NULL) { as_sound* snd = cast_to<as_sound>(fn.this_ptr); assert(snd); lfl_string full_url = get_full_url(fn.get_player()->get_workdir(), fn.arg(0).to_string()); int id = s->load_sound(full_url.c_str()); if (id >= 0) { snd->clear(); snd->m_id = id; snd->m_is_loaded_sound = true; } } } }
// Implementation of: // // loadVariables(url:String, target:Object, [method:String]) : Void // loadMovie(url:String, target:Object, [method:String]) : Void // loadMovie(url:String, target:String, [method:String]) : Void // unloadMovie(target:MovieClip) : Void // unloadMovie(target:String) : Void // // url=="" means that the load_file() works as unloadMovie(target) // TODO: implement [method] character *as_environment::load_file ( const char *url, const as_value &target_value, int method ) { character *target = cast_to<character> ( find_target ( target_value ) ); if ( target == NULL ) { IF_VERBOSE_ACTION ( log_msg ( "load_file: target %s is't found\n", target_value.to_string() ) ); return NULL; } // is unloadMovie() ? if ( strlen ( url ) == 0 ) { character *parent = target->get_parent(); if ( parent ) { parent->remove_display_object ( target ); } else // target is _root, unloadMovie(_root) { target->clear_display_objects(); } return NULL; } // is path relative ? tu_string file_name = get_full_url ( get_player()->get_workdir(), url ); switch ( get_file_type ( file_name.c_str() ) ) { default: break; case TXT: { // Reads data from an external file, such as a text file and sets the values for // variables in a target movie clip. This action can also be used // to update variables in the active SWF file with new values. tu_file fi ( file_name.c_str(), "r" ); if ( fi.get_error() == TU_FILE_NO_ERROR ) { fi.go_to_end(); int len = fi.get_position(); fi.set_position ( 0 ); char *buf = ( char * ) malloc ( len ); if ( fi.read_string ( buf, len ) > 0 ) { // decode data in the standard MIME format and copy theirs into target #if TU_ENABLE_NETWORK == 1 as_loadvars lv ( get_player() ); lv.decode ( buf ); lv.copy_to ( target ); #else log_error ( "Compile gameswf with TU_ENABLE_NETWORK=1 to use loadVariable() function" ); #endif } free ( buf ); } break; } case URL: case SWF: { movie_definition *md = get_player()->create_movie ( file_name.c_str() ); if ( md && md->get_frame_count() > 0 ) { return target->replace_me ( md ); } break; } case X3DS: { #if TU_CONFIG_LINK_TO_LIB3DS == 0 log_error ( "gameswf is not linked to lib3ds -- can't load 3DS file\n" ); #else x3ds_definition *x3ds = create_3ds_definition ( get_player(), file_name.c_str() ); if ( x3ds ) { if ( x3ds->is_loaded() ) { rect bound; target->get_bound ( &bound ); x3ds->set_bound ( bound ); return target->replace_me ( x3ds ); } } #endif break; } case JPG: { #if TU_CONFIG_LINK_TO_JPEGLIB == 0 log_error ( "gameswf is not linked to jpeglib -- can't load jpeg image data!\n" ); #else image::rgb *im = image::read_jpeg ( file_name.c_str() ); if ( im ) { bitmap_info *bi = render::create_bitmap_info_rgb ( im ); delete im; movie_definition *rdef = get_root()->get_movie_definition(); assert ( rdef ); bitmap_character *jpeg = new bitmap_character ( rdef, bi ); return target->replace_me ( jpeg ); } #endif break; } } return NULL; }