⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 seedsitem.java

📁 java 文件下载器。可自定义
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   SeedsItem.java

package org.gudy.azureus2.ui.swt.views.tableitems.mytorrents;

import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.config.ParameterListener;
import org.gudy.azureus2.core3.download.DownloadManager;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.tracker.client.TRTrackerScraperResponse;
import org.gudy.azureus2.plugins.download.Download;
import org.gudy.azureus2.plugins.ui.tables.*;
import org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn;

// Referenced classes of package org.gudy.azureus2.ui.swt.views.tableitems.mytorrents:
//			AbstractTrackerCell

public class SeedsItem extends CoreTableColumn
	implements TableCellAddedListener, ParameterListener
{
	private class Cell extends AbstractTrackerCell
	{

		private long lTotalPeers;
		private long lTotalSeeds;
		final SeedsItem this$0;

		public void scrapeResult(TRTrackerScraperResponse response)
		{
			if (checkScrapeResult(response))
			{
				lTotalSeeds = response.getSeeds();
				lTotalPeers = response.getPeers();
			}
		}

		public void refresh(TableCell cell)
		{
			super.refresh(cell);
			long lConnectedSeeds = 0L;
			if (dm != null)
			{
				lConnectedSeeds = dm.getNbSeeds();
				if (lTotalSeeds == -1L)
				{
					TRTrackerScraperResponse response = dm.getTrackerScrapeResponse();
					if (response != null && response.isValid())
					{
						lTotalSeeds = response.getSeeds();
						lTotalPeers = response.getPeers();
					}
				}
			}
			long value = lConnectedSeeds << 42;
			if (lTotalSeeds > 0L)
				value += lTotalSeeds << 21;
			if (lTotalPeers > 0L)
				value += lTotalPeers;
			if (!cell.setSortValue(value) && cell.isValid())
				return;
			boolean bCompleteTorrent = dm != null ? dm.getAssumedComplete() : false;
			String tmp = String.valueOf(lConnectedSeeds);
			if (lTotalSeeds != -1L)
			{
				tmp = (new StringBuilder()).append(tmp).append(" (").append(lTotalSeeds).toString();
				if (bCompleteTorrent && iFC_NumPeers > 0 && lTotalSeeds >= (long)iFC_MinSeeds && lTotalPeers > 0L)
				{
					long lSeedsToAdd = lTotalPeers / (long)iFC_NumPeers;
					if (lSeedsToAdd > 0L)
						tmp = (new StringBuilder()).append(tmp).append("+").append(lSeedsToAdd).toString();
				}
				tmp = (new StringBuilder()).append(tmp).append(")").toString();
			}
			cell.setText(tmp);
		}

		public void cellHover(TableCell cell)
		{
			super.cellHover(cell);
			long lConnectedSeeds = 0L;
			DownloadManager dm = (DownloadManager)cell.getDataSource();
			if (dm != null)
				lConnectedSeeds = dm.getNbSeeds();
			String sToolTip = (new StringBuilder()).append(lConnectedSeeds).append(" ").append(MessageText.getString("GeneralView.label.connected")).append("\n").toString();
			if (lTotalSeeds != -1L)
			{
				sToolTip = (new StringBuilder()).append(sToolTip).append(lTotalSeeds).append(" ").append(MessageText.getString("GeneralView.label.in_swarm")).toString();
			} else
			{
				TRTrackerScraperResponse response = dm.getTrackerScrapeResponse();
				sToolTip = (new StringBuilder()).append(sToolTip).append("?? ").append(MessageText.getString("GeneralView.label.in_swarm")).toString();
				if (response != null)
					sToolTip = (new StringBuilder()).append(sToolTip).append("(").append(response.getStatusString()).append(")").toString();
			}
			boolean bCompleteTorrent = dm != null ? dm.getAssumedComplete() : false;
			if (bCompleteTorrent && iFC_NumPeers > 0 && lTotalSeeds >= (long)iFC_MinSeeds && lTotalPeers > 0L)
			{
				long lSeedsToAdd = lTotalPeers / (long)iFC_NumPeers;
				sToolTip = (new StringBuilder()).append(sToolTip).append("\n").append(MessageText.getString("MyTorrentsView.seeds.fullcopycalc", new String[] {
					(new StringBuilder()).append("").append(lTotalPeers).toString(), (new StringBuilder()).append("").append(lSeedsToAdd).toString()
				})).toString();
			}
			cell.setToolTip(sToolTip);
		}

		public Cell(TableCell cell)
		{
			this$0 = SeedsItem.this;
			super(cell);
			lTotalPeers = 0L;
			lTotalSeeds = -1L;
		}
	}


	public static final Class DATASOURCE_TYPE = org/gudy/azureus2/plugins/download/Download;
	private static final String CFG_FC_SEEDSTART = "StartStopManager_iFakeFullCopySeedStart";
	private static final String CFG_FC_NUMPEERS = "StartStopManager_iNumPeersAsFullCopy";
	public static final String COLUMN_ID = "seeds";
	private int iFC_MinSeeds;
	private int iFC_NumPeers;

	public void fillTableColumnInfo(TableColumnInfo info)
	{
		info.addCategories(new String[] {
			"swarm"
		});
	}

	public SeedsItem(String sTableID)
	{
		super(DATASOURCE_TYPE, "seeds", 3, 60, sTableID);
		setRefreshInterval(-2);
		setMinWidthAuto(true);
		iFC_MinSeeds = COConfigurationManager.getIntParameter("StartStopManager_iFakeFullCopySeedStart");
		iFC_NumPeers = COConfigurationManager.getIntParameter("StartStopManager_iNumPeersAsFullCopy");
		COConfigurationManager.addParameterListener("StartStopManager_iFakeFullCopySeedStart", this);
		COConfigurationManager.addParameterListener("StartStopManager_iNumPeersAsFullCopy", this);
	}

	protected void finalize()
		throws Throwable
	{
		super.finalize();
		COConfigurationManager.removeParameterListener("StartStopManager_iFakeFullCopySeedStart", this);
		COConfigurationManager.removeParameterListener("StartStopManager_iNumPeersAsFullCopy", this);
	}

	public void cellAdded(TableCell cell)
	{
		new Cell(cell);
	}

	public void parameterChanged(String parameterName)
	{
		iFC_MinSeeds = COConfigurationManager.getIntParameter("StartStopManager_iFakeFullCopySeedStart");
		iFC_NumPeers = COConfigurationManager.getIntParameter("StartStopManager_iNumPeersAsFullCopy");
	}



}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -