Examples of DownloadManagerState


Examples of org.gudy.azureus2.core3.download.DownloadManagerState

      }
    }
  }

  public void attributeEventOccurred(DownloadManager dm, String attribute_name, int event_type) {
    final DownloadManagerState state = dm.getDownloadState();
    Utils.execSWTThread(new Runnable() {
      public void  run() {
        Iterator it = ds_parameters.entrySet().iterator();
        while (it.hasNext()) {
          Map.Entry  entry = (Map.Entry)it.next();
          String  key   = (String)entry.getKey();
          Object  param   = entry.getValue();
               
          if (param instanceof GenericIntParameter) {
            GenericIntParameter  int_param = (GenericIntParameter)param;
            int  value = state.getIntParameter( key );
            int_param.setValue( value );
          } else if (param instanceof GenericBooleanParameter) {
            GenericBooleanParameter  bool_param = (GenericBooleanParameter)param;
            boolean  value = state.getBooleanParameter( key );
            bool_param.setSelected( value );
          } else {   
            Debug.out( "Unknown parameter type: " + param.getClass());
          }
        }
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManagerState

    DownloadManager      download_manager,
    DiskManagerFileInfo    file,
    boolean          recheck,
    boolean          onlyClearUnsharedFirstLast )
  {
    DownloadManagerState  download_manager_state = download_manager.getDownloadState();
   
    Map resume_data = getResumeData( download_manager );

    if ( resume_data == null ){
     
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManagerState

       
        Debug.printStackTrace(e);
      }
    }
     
    DownloadManagerState state = download_manager.getDownloadState();
    if (state.parameterExists(DownloadManagerState.PARAM_DND_FLAGS)) {
      long flags = state.getLongParameter(DownloadManagerState.PARAM_DND_FLAGS);
      cached_complete_excluding_dnd = (flags & STATE_FLAG_COMPLETE_NO_DND) != 0;
      cached_has_dnd_files = (flags & STATE_FLAG_HASDND) != 0;
      cached_values_set = true;
    }
  }
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManagerState

         
          public void
          setPeerSources(
            String[]  allowed_sources )
          {
            DownloadManagerState  dms = download_manager.getDownloadState();
           
            String[]  sources = PEPeerSource.PS_SOURCES;
           
            for (int i=0;i<sources.length;i++){
             
              String  s = sources[i];
             
              boolean  ok = false;
             
              for (int j=0;j<allowed_sources.length;j++){
               
                if ( s.equals( allowed_sources[j] )){
                 
                  ok = true;
                 
                  break;
                }
              }
             
              if ( !ok ){
               
                dms.setPeerSourcePermitted( s, false );
              }
            }
           
            PEPeerManager pm = getPeerManager();
           
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManagerState

    }

    cached_complete_excluding_dnd = complete_excluding_dnd;
    cached_has_dnd_files = has_dnd_files;
    cached_values_set = true;
    DownloadManagerState state = download_manager.getDownloadState();
    long flags = (cached_complete_excluding_dnd ? STATE_FLAG_COMPLETE_NO_DND : 0) |
                 (cached_has_dnd_files ? STATE_FLAG_HASDND : 0);
    state.setLongParameter(DownloadManagerState.PARAM_DND_FLAGS, flags);
  }
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManagerState

                   
                    if ( file_done == file_length ){
                        
                      try{
                        try{
                            DownloadManagerState state = download_manager.getDownloadState();
                         
                          String suffix = state.getAttribute( DownloadManagerState.AT_INCOMP_FILE_SUFFIX );
                         
                          if ( suffix != null && suffix.length() > 0 ){
                           
                            File base_file = this_file.getFile( false );
                           
                            File link = state.getFileLink( base_file );
                           
                            if ( link != null ){
                             
                              String  name = link.getName();
                             
                              if ( name.endsWith( suffix ) && name.length() > suffix.length()){
                               
                                String  new_name = name.substring( 0, name.length() - suffix.length());
                               
                                File new_file = new File( link.getParentFile(), new_name );
                               
                                if ( !new_file.exists()){
                                 
                                  this_file.renameFile( new_name, false );
                                 
                                  if ( base_file.equals( new_file )){
                                   
                                    state.setFileLink( base_file, null );
                                   
                                  }else{
                                   
                                    state.setFileLink( base_file, new_file );
                                  }
                                }
                              }
                            }
                          }
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManagerState

  storeFileDownloaded(
    DownloadManager         download_manager,
    DiskManagerFileInfo[]   files,
    boolean          persist )
  {
      DownloadManagerState  state = download_manager.getDownloadState();

      Map   details = new HashMap();

      List  downloaded = new ArrayList();

      details.put( "downloaded", downloaded );

      for (int i=0;i<files.length;i++){

          downloaded.add( new Long( files[i].getDownloaded()));
      }

      state.setMapAttribute( DownloadManagerState.AT_FILE_DOWNLOADED, details );

      if ( persist ){
       
        state.save();
      }
  }
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManagerState

    }

      // Used by DownloadManagerImpl too.
   
    public static String[] getStorageTypes(DownloadManager download_manager) {
        DownloadManagerState state = download_manager.getDownloadState();
        String[] types = state.getListAttribute(DownloadManagerState.AT_FILE_STORE_TYPES);
        if (types.length == 0) {
          TOTorrentFile[] files = download_manager.getTorrent().getFiles();
            types = new String[download_manager.getTorrent().getFiles().length];
           
           if ( reorder_storage_mode ){
           
            int  existing = state.getIntAttribute( DownloadManagerState.AT_REORDER_MIN_MB );
           
            if ( existing < 0 ){
             
              existing = reorder_storage_mode_min_mb;
             
              state.setIntAttribute( DownloadManagerState.AT_REORDER_MIN_MB, existing );
            }
                     
            for (int i=0; i<types.length; i++){
                              
                if ( files[i].getLength()/(1024*1024) >= existing ){
                                   
                  types[i] = "R";
                 
                }else{
                 
                  types[i] = "L";
                }
              }
            }else{
            
             for (int i=0; i<types.length; i++){
              
               types[i] = "L";
             }
            }
          
      state.setListAttribute(DownloadManagerState.AT_FILE_STORE_TYPES, types );
        }
       
        return( types );
    }
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManagerState

    }
   
      // Used by DownloadManagerImpl too.
   
    public static String getStorageType(DownloadManager download_manager, int fileIndex) {
        DownloadManagerState state = download_manager.getDownloadState();
        String type = state.getListAttribute(DownloadManagerState.AT_FILE_STORE_TYPES,fileIndex);
       
        if ( type != null ){
         
          return( type );
        }
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManagerState

                  return( false );
              }
          }
      }
 
      DownloadManagerState    state = download_manager.getDownloadState();
 
      state.setFileLink( from_file, to_link );
 
      state.save();
 
      return( true );
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.