if ( comp.getType() == VuzeFileComponent.COMP_TYPE_V3_NAVIGATION || comp.getType() == VuzeFileComponent.COMP_TYPE_V3_CONDITION_CHECK ){ List commands = (List)comp.getContent().get("commands"); comp.setProcessed();
@Override public String getName() { String str = ""; for ( VuzeFileComponent comp: components ){ str += (str.length()==0?"":",") + comp.getTypeName(); } return( str ); }
public void handleFiles( VuzeFile[] files, int expected_types ) { Iterator<VuzeFileProcessor> it = processors.iterator(); while( it.hasNext()){ VuzeFileProcessor proc = it.next(); try{ proc.process( files, expected_types ); }catch( Throwable e ){ Debug.printStackTrace(e); } } for (int i=0;i<files.length;i++){ VuzeFile vf = files[i]; VuzeFileComponent[] comps = vf.getComponents(); for (int j=0;j<comps.length;j++){ VuzeFileComponent comp = comps[j]; if ( !comp.isProcessed()){ Debug.out( "Failed to handle Vuze file component " + comp.getContent()); } } } }
@Override public Map exportToMap() throws IOException { Map map = new HashMap(); Map vuze_map = new HashMap(); map.put( "vuze", vuze_map ); List list = new ArrayList(); vuze_map.put( "components", list ); for (int i=0;i<components.length;i++){ VuzeFileComponent comp = components[i]; Map entry = new HashMap(); entry.put( "type", new Long( comp.getType())); entry.put( "content", comp.getContent()); list.add( entry ); } return( map ); }
@Override public void process( VuzeFile[] files, int expected_types ) { for (int i=0;i<files.length;i++){ VuzeFile vf = files[i]; VuzeFileComponent[] comps = vf.getComponents(); for (int j=0;j<comps.length;j++){ VuzeFileComponent comp = comps[j]; int type = comp.getType(); if ( type == VuzeFileComponent.COMP_TYPE_SUBSCRIPTION || type == VuzeFileComponent.COMP_TYPE_SUBSCRIPTION_SINGLETON ){ try{ Subscription subs = ((SubscriptionManagerImpl)getSingleton( false )).importSubscription( type, comp.getContent(), ( expected_types & ( VuzeFileComponent.COMP_TYPE_SUBSCRIPTION | VuzeFileComponent.COMP_TYPE_SUBSCRIPTION_SINGLETON )) == 0 ); comp.setProcessed(); comp.setData( Subscription.VUZE_FILE_COMPONENT_SUBSCRIPTION_KEY, subs ); }catch( Throwable e ){ Debug.printStackTrace(e); } } } } } });
Engine engine = (Engine)comp.getData( Engine.VUZE_FILE_COMPONENT_ENGINE_KEY );
VuzeFileComponent[] components = vf.getComponents(); for (VuzeFileComponent component : components) { if (component.getType() == VuzeFileComponent.COMP_TYPE_PLUGIN) { hasPlugin = true; break;
protected SubscriptionBodyImpl( SubscriptionManagerImpl _manager, SubscriptionImpl _subs ) throws SubscriptionException { manager = _manager; try{ File vuze_file = manager.getVuzeFile( _subs ); VuzeFile vf = VuzeFileHandler.getSingleton().loadVuzeFile( vuze_file.getAbsolutePath()); if ( vf == null ){ throw( new IOException( "Failed to load vuze file '" + vuze_file + "'" )); } load( vf.getComponents()[0].getContent(), false ); }catch( Throwable e ){ rethrow( e ); } }
public Engine[] loadFromVuzeFile( VuzeFile vf ) { List<Engine> result = new ArrayList<>(); VuzeFileComponent[] comps = vf.getComponents(); for (int j=0;j<comps.length;j++){ VuzeFileComponent comp = comps[j]; if ( comp.getType() == VuzeFileComponent.COMP_TYPE_METASEARCH_TEMPLATE ){ try{ result.add( importEngine( comp.getContent(), false )); }catch( Throwable e ){ Debug.printStackTrace(e); } } } return(result.toArray(new Engine[result.size()])); }
int comp_type = comp.getType(); Engine e = getSingleton().importEngine( comp.getContent(), (expected_types & VuzeFileComponent.COMP_TYPE_METASEARCH_TEMPLATE) == 0 ); comp.setProcessed(); comp.setData( Engine.VUZE_FILE_COMPONENT_ENGINE_KEY, e ); getSingleton().addOperation( comp.getContent()); comp.setProcessed();
Engine engine = (Engine)comp.getData( Engine.VUZE_FILE_COMPONENT_ENGINE_KEY );
@Override public void process( VuzeFile[] files, int expected_types ) { for (int i=0;i<files.length;i++){ VuzeFile vf = files[i]; VuzeFileComponent[] comps = vf.getComponents(); for (int j=0;j<comps.length;j++){ VuzeFileComponent comp = comps[j]; int type = comp.getType(); if ( type == VuzeFileComponent.COMP_TYPE_DEVICE ){ try{ ((DeviceManagerImpl)getSingleton()).importVuzeFile( comp.getContent(), ( expected_types & ( VuzeFileComponent.COMP_TYPE_DEVICE )) == 0 ); comp.setProcessed(); }catch( Throwable e ){ Debug.printStackTrace(e); } } } } } });
private File extractFromVuzeFile( File file ) throws PluginException { VuzeFile vf = VuzeFileHandler.getSingleton().loadVuzeFile(file); VuzeFileComponent[] comps = vf.getComponents(); for (int j=0;j<comps.length;j++){ VuzeFileComponent comp = comps[j]; if ( comp.getType() == VuzeFileComponent.COMP_TYPE_PLUGIN ){ try{ Map content = comp.getContent(); String id = new String((byte[])content.get( "id" ), "UTF-8" ); String version = new String((byte[])content.get( "version" ), "UTF-8" ); String suffix = ((Long)content.get( "is_jar" )).longValue()==1?"jar":"zip"; byte[] plugin_file = (byte[])content.get( "file" ); File temp_dir = AETemporaryFileHandler.createTempDir(); File temp_file = new File( temp_dir, id + "_" + version + "." + suffix ); FileUtil.copyFile( new ByteArrayInputStream( plugin_file ), temp_file ); return( temp_file ); }catch( Throwable e ){ throw( new PluginException( "Not a valid Vuze file", e )); } } } return( file ); }
if ( comp.getType() == VuzeFileComponent.COMP_TYPE_PLUGIN ){ Map content = comp.getContent(); comp.setProcessed();
target.addComponent( comp.getType(), comp.getContent()); System.out.println( " added component: " + comp.getType());
int type = comp.getType(); Map map = comp.getContent(); comp.setProcessed(); int type = comp.getType(); Tag tag = importVuzeFile( comp.getContent()); comp.setProcessed();
protected SubscriptionImpl getSubscriptionFromVuzeFile( byte[] sid, int add_type, VuzeFile vf ) throws SubscriptionException { VuzeFileComponent[] comps = vf.getComponents(); for (int j=0;j<comps.length;j++){ VuzeFileComponent comp = comps[j]; if ( comp.getType() == VuzeFileComponent.COMP_TYPE_SUBSCRIPTION ){ Map map = comp.getContent(); try{ SubscriptionBodyImpl body = new SubscriptionBodyImpl( SubscriptionManagerImpl.this, map ); SubscriptionImpl new_subs = new SubscriptionImpl( SubscriptionManagerImpl.this, body, add_type, false ); if ( Arrays.equals( new_subs.getShortID(), sid )){ return( new_subs ); } }catch( Throwable e ){ log( "Subscription decode failed", e ); } } } throw( new SubscriptionException( "Subscription not found" )); }
if ( comp.getType() == VuzeFileComponent.COMP_TYPE_CUSTOMIZATION ){ Map map = comp.getContent(); comp.setProcessed(); }else if ( comp.getType() == VuzeFileComponent.COMP_TYPE_CONFIG_SETTINGS ){ Map map = comp.getContent(); comp.setProcessed();
int comp_type = comp.getType(); EngineImpl engine = (EngineImpl)meta_search.importFromBEncodedMap( comp.getContent());