ExportTorrentWizardpublic class ExportTorrentWizard extends org.gudy.azureus2.ui.swt.wizard.Wizard
Fields Summary |
---|
String | torrent_file | String | export_file |
Constructors Summary |
---|
public ExportTorrentWizard(AzureusCore azureus_core, org.eclipse.swt.widgets.Display display)
super(azureus_core,"exportTorrentWizard.title");
ExportTorrentWizardInputPanel input_panel = new ExportTorrentWizardInputPanel(this,null);
setFirstPanel(input_panel);
| public ExportTorrentWizard(AzureusCore azureus_core, org.eclipse.swt.widgets.Display display, DownloadManager dm)
super(azureus_core, "exportTorrentWizard.title");
setTorrentFile( dm.getTorrentFileName());
ExportTorrentWizardOutputPanel output_panel = new ExportTorrentWizardOutputPanel(this,null);
setFirstPanel(output_panel);
|
Methods Summary |
---|
protected java.lang.String | getExportFile()
return( export_file );
| protected java.lang.String | getTorrentFile()
return( torrent_file );
| public void | onClose()
// Call the parent class to clean up resources
super.onClose();
| protected boolean | performExport()
File input_file;
try{
input_file = new File( getTorrentFile()).getCanonicalFile();
}catch( IOException e ){
MessageBox mb = new MessageBox(getWizardWindow(),SWT.ICON_ERROR | SWT.OK );
mb.setText(MessageText.getString("exportTorrentWizard.process.inputfilebad.title"));
mb.setMessage( MessageText.getString("exportTorrentWizard.process.inputfilebad.message")+"\n" +
e.toString());
mb.open();
return( false );
}
File output_file = new File( export_file );
if ( output_file.exists()){
MessageBox mb = new MessageBox(this.getWizardWindow(),SWT.ICON_QUESTION | SWT.YES | SWT.NO);
mb.setText(MessageText.getString("exportTorrentWizard.process.outputfileexists.title"));
mb.setMessage(MessageText.getString("exportTorrentWizard.process.outputfileexists.message"));
int result = mb.open();
if( result == SWT.NO ){
return( false );
}
}
String error_title;
String error_detail;
try{
TOTorrent torrent;
try{
torrent = TOTorrentFactory.deserialiseFromBEncodedFile( input_file );
try{
torrent.serialiseToXMLFile( output_file );
return( true );
}catch( TOTorrentException e ){
error_title = MessageText.getString("exportTorrentWizard.process.exportfail.title");
error_detail = TorrentUtils.exceptionToText( e );
}
}catch( TOTorrentException e ){
error_title = MessageText.getString("exportTorrentWizard.process.torrentfail.title");
error_detail = TorrentUtils.exceptionToText( e );
}
}catch( Throwable e ){
error_title = MessageText.getString("exportTorrentWizard.process.unknownfail.title");
error_detail = e.toString();
}
MessageBox mb = new MessageBox(this.getWizardWindow(),SWT.ICON_ERROR | SWT.OK );
mb.setText(error_title);
mb.setMessage(error_detail);
mb.open();
return( false );
| protected void | setExportFile(java.lang.String str)
export_file = str;
| protected void | setTorrentFile(java.lang.String str)
torrent_file = str;
export_file = str + ".xml";
|
|