use of com.biglybt.pifimpl.local.tracker.TrackerTorrentImpl in project BiglyBT by BiglySoftware.
the class PluginCoreUtils method convert.
public static Object convert(Object datasource, boolean toCore) {
if (datasource instanceof Object[]) {
Object[] array = (Object[]) datasource;
Object[] newArray = new Object[array.length];
for (int i = 0; i < array.length; i++) {
Object o = array[i];
newArray[i] = convert(o, toCore);
}
return newArray;
}
try {
if (toCore) {
if (datasource instanceof com.biglybt.core.download.DownloadManager) {
return datasource;
}
if (datasource instanceof DownloadImpl) {
return ((DownloadImpl) datasource).getDownload();
}
if (datasource instanceof com.biglybt.core.disk.DiskManager) {
return datasource;
}
if (datasource instanceof DiskManagerImpl) {
return ((DiskManagerImpl) datasource).getDiskmanager();
}
if (datasource instanceof PEPeerManager) {
return datasource;
}
if (datasource instanceof PeerManagerImpl) {
return ((PeerManagerImpl) datasource).getDelegate();
}
if (datasource instanceof PEPeer) {
return datasource;
}
if (datasource instanceof PeerImpl) {
return ((PeerImpl) datasource).getPEPeer();
}
if (datasource instanceof com.biglybt.core.disk.DiskManagerFileInfo) {
return datasource;
}
if (datasource instanceof com.biglybt.pifimpl.local.disk.DiskManagerFileInfoImpl) {
return ((com.biglybt.pifimpl.local.disk.DiskManagerFileInfoImpl) datasource).getCore();
}
if (datasource instanceof TRHostTorrent) {
return datasource;
}
if (datasource instanceof TrackerTorrentImpl) {
((TrackerTorrentImpl) datasource).getHostTorrent();
}
} else {
// to PI
if (datasource instanceof com.biglybt.core.download.DownloadManager) {
return wrap((com.biglybt.core.download.DownloadManager) datasource);
}
if (datasource instanceof DownloadImpl) {
return datasource;
}
if (datasource instanceof com.biglybt.core.disk.DiskManager) {
return wrap((com.biglybt.core.disk.DiskManager) datasource);
}
if (datasource instanceof DiskManagerImpl) {
return datasource;
}
if (datasource instanceof PEPeerManager) {
return wrap((PEPeerManager) datasource);
}
if (datasource instanceof PeerManagerImpl) {
return datasource;
}
if (datasource instanceof PEPeer) {
return PeerManagerImpl.getPeerForPEPeer((PEPeer) datasource);
}
if (datasource instanceof Peer) {
return datasource;
}
if (datasource instanceof com.biglybt.core.disk.DiskManagerFileInfo) {
DiskManagerFileInfo fileInfo = (com.biglybt.core.disk.DiskManagerFileInfo) datasource;
if (fileInfo != null) {
try {
DownloadManager dm = fileInfo.getDownloadManager();
return new com.biglybt.pifimpl.local.disk.DiskManagerFileInfoImpl(dm == null ? null : DownloadManagerImpl.getDownloadStatic(dm), fileInfo);
} catch (DownloadException e) {
/* Ignore */
}
}
}
if (datasource instanceof com.biglybt.pifimpl.local.disk.DiskManagerFileInfoImpl) {
return datasource;
}
if (datasource instanceof TRHostTorrent) {
TRHostTorrent item = (TRHostTorrent) datasource;
return new TrackerTorrentImpl(item);
}
if (datasource instanceof TrackerTorrentImpl) {
return datasource;
}
}
} catch (Throwable t) {
Debug.out(t);
}
return datasource;
}
Aggregations