boolean hasDM = false;
if (currentContent.length > 0 && hasRealDM) {
for (int i = 0; i < currentContent.length; i++) {
ISelectedContent content = currentContent[i];
DownloadManager dm = content.getDownloadManager();
int fileIndex = content.getFileIndex();
if (fileIndex == -1) {
hasDM = true;
if (!canStart && ManagerUtils.isStartable(dm)) {
canStart = true;
}
if (!canStop && ManagerUtils.isStopable(dm)) {
canStop = true;
}
} else {
DiskManagerFileInfo[] fileInfos = dm.getDiskManagerFileInfo();
if (fileIndex < fileInfos.length) {
DiskManagerFileInfo fileInfo = fileInfos[fileIndex];
if (!canStart && (fileInfo.isSkipped())) {
canStart = true;
}
if (!canStop && !fileInfo.isSkipped()) {
canStop = true;
}
if (!canRemoveFileInfo && !fileInfo.isSkipped()) {
int storageType = fileInfo.getStorageType();
if (storageType == DiskManagerFileInfo.ST_LINEAR
|| storageType == DiskManagerFileInfo.ST_COMPACT) {
canRemoveFileInfo = true;
}
}
if (!canRunFileInfo
&& fileInfo.getAccessMode() == DiskManagerFileInfo.READ
&& fileInfo.getDownloaded() == fileInfo.getLength()
&& fileInfo.getFile(true).exists()) {
canRunFileInfo = true;
}
}
}
}
boolean canRemove = hasDM || canRemoveFileInfo;
mapNewToolbarStates.put("remove", canRemove);
}
boolean canRun = has1Selection && ((hasDM && !canRunFileInfo) || (!hasDM && canRunFileInfo));
if (canRun) {
ISelectedContent content = currentContent[0];
DownloadManager dm = content.getDownloadManager();
if (dm == null) {
canRun = false;
} else {
TOTorrent torrent = dm.getTorrent();
if (torrent == null) {
canRun = false;
} else if (!dm.getAssumedComplete() && torrent.isSimpleTorrent()) {
canRun = false;
/*
} else if (PlatformTorrentUtils.useEMP(torrent)
&& PlatformTorrentUtils.embeddedPlayerAvail()