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

📄 swtversiongetter.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:   SWTVersionGetter.java

package org.gudy.azureus2.ui.swt.updater2;

import com.aelitis.azureus.core.versioncheck.VersionCheckClient;
import java.util.Map;
import org.eclipse.swt.SWT;
import org.gudy.azureus2.core3.logging.*;
import org.gudy.azureus2.core3.util.AEVerifier;
import org.gudy.azureus2.core3.util.Constants;
import org.gudy.azureus2.platform.*;
import org.gudy.azureus2.plugins.update.UpdateChecker;

public class SWTVersionGetter
{

	private static final LogIDs LOGID;
	private String platform;
	private int currentVersion;
	private int latestVersion;
	private UpdateChecker checker;
	private String mirrors[];
	private String infoURL;

	public SWTVersionGetter(UpdateChecker _checker)
	{
		platform = SWT.getPlatform();
		currentVersion = SWT.getVersion();
		if (currentVersion == 3232 && Constants.isOSX)
		{
			PlatformManager p_man = PlatformManagerFactory.getPlatformManager();
			if (p_man != null && !p_man.hasCapability(PlatformManagerCapabilities.GetVersion))
				currentVersion = 3231;
		}
		latestVersion = 0;
		checker = _checker;
	}

	public boolean needsUpdate()
	{
		downloadLatestVersion();
		String msg = (new StringBuilder()).append("SWT: current version = ").append(currentVersion).append(", latest version = ").append(latestVersion).toString();
		checker.reportProgress(msg);
		if (Logger.isEnabled())
			Logger.log(new LogEvent(LOGID, msg));
		return latestVersion > currentVersion;
		Exception e;
		e;
		e.printStackTrace();
		return false;
	}

	private void downloadLatestVersion()
	{
		if (Logger.isEnabled())
			Logger.log(new LogEvent(LOGID, "Requesting latest SWT version and url from version check client."));
		Map reply = VersionCheckClient.getSingleton().getVersionCheckInfo("sw");
		String msg = "SWT version check received:";
		byte version_bytes[] = (byte[])(byte[])reply.get("swt_version");
		if (version_bytes != null)
		{
			latestVersion = Integer.parseInt(new String(version_bytes));
			msg = (new StringBuilder()).append(msg).append(" version=").append(latestVersion).toString();
		}
		byte url_bytes[] = (byte[])(byte[])reply.get("swt_url");
		if (url_bytes != null)
		{
			mirrors = (new String[] {
				new String(url_bytes)
			});
			msg = (new StringBuilder()).append(msg).append(" url=").append(mirrors[0]).toString();
		}
		byte info_bytes[] = (byte[])(byte[])reply.get("swt_info_url");
		if (info_bytes != null)
		{
			byte sig[] = (byte[])(byte[])reply.get("swt_info_sig");
			if (sig == null)
				Logger.log(new LogEvent(LogIDs.LOGGER, "swt info signature check failed - missing signature"));
			else
				try
				{
					infoURL = new String(info_bytes);
					try
					{
						AEVerifier.verifyData(infoURL, sig);
					}
					catch (Throwable e)
					{
						Logger.log(new LogEvent(LogIDs.LOGGER, "swt info signature check failed", e));
						infoURL = null;
					}
				}
				catch (Exception e)
				{
					Logger.log(new LogEvent(LOGID, "swt info_url", e));
				}
		}
		if (Logger.isEnabled())
			Logger.log(new LogEvent(LOGID, msg));
	}

	public int getLatestVersion()
	{
		return latestVersion;
	}

	public int getCurrentVersion()
	{
		return currentVersion;
	}

	public String getPlatform()
	{
		return platform;
	}

	public String[] getMirrors()
	{
		return mirrors;
	}

	public String getInfoURL()
	{
		return infoURL;
	}

	static 
	{
		LOGID = LogIDs.GUI;
	}
}

⌨️ 快捷键说明

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