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

📄 ipfilterautoloaderimpl.java

📁 java 文件下载器。可自定义
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		ipBytes = new byte[4];
		encoding = p2bVersion != 1 ? "UTF-8" : "ISO-8859-1";
		if (p2bVersion == 1 || p2bVersion == 2)
		{
			do
			{
				String description = readString(bin, descBytes, encoding);
				int read = bin.read(ipBytes);
				if (read < 4)
					break;
				int startIp = ByteFormatter.byteArrayToInt(ipBytes);
				read = bin.read(ipBytes);
				if (read < 4)
					break;
				int endIp = ByteFormatter.byteArrayToInt(ipBytes);
				IpRangeImpl ipRange = new IpRangeImpl(description, startIp, endIp, true);
				ipRange.setAddedToRangeList(true);
				new_ipRanges.add(ipRange);
			} while (true);
			break MISSING_BLOCK_LABEL_1775;
		}
		read = bin.read(ipBytes);
		if (read >= 4)
			break MISSING_BLOCK_LABEL_1209;
		if (bin != null)
			try
			{
				bin.close();
			}
			catch (Throwable e) { }
		if (fin != null)
			try
			{
				fin.close();
			}
			catch (Throwable e) { }
		for (Iterator it = new_ipRanges.iterator(); it.hasNext(); ((IpRange)it.next()).checkValid());
		ipFilter.markAsUpToDate();
		if (!isURL)
			setFileReloadTimer();
		class_mon.exit();
		return;
		String descs[];
		int numDescs = ByteFormatter.byteArrayToInt(ipBytes);
		descs = new String[numDescs];
		for (int i = 0; i < numDescs; i++)
			descs[i] = readString(bin, descBytes, encoding);

		read = bin.read(ipBytes);
		if (read >= 4)
			break MISSING_BLOCK_LABEL_1359;
		if (bin != null)
			try
			{
				bin.close();
			}
			catch (Throwable e) { }
		if (fin != null)
			try
			{
				fin.close();
			}
			catch (Throwable e) { }
		for (Iterator it = new_ipRanges.iterator(); it.hasNext(); ((IpRange)it.next()).checkValid());
		ipFilter.markAsUpToDate();
		if (!isURL)
			setFileReloadTimer();
		class_mon.exit();
		return;
		int numRanges;
		int i;
		numRanges = ByteFormatter.byteArrayToInt(ipBytes);
		i = 0;
_L3:
		if (i >= numRanges)
			break MISSING_BLOCK_LABEL_1775;
		read = bin.read(ipBytes);
		if (read >= 4) goto _L2; else goto _L1
_L1:
		if (bin != null)
			try
			{
				bin.close();
			}
			catch (Throwable e) { }
		if (fin != null)
			try
			{
				fin.close();
			}
			catch (Throwable e) { }
		for (Iterator it = new_ipRanges.iterator(); it.hasNext(); ((IpRange)it.next()).checkValid());
		ipFilter.markAsUpToDate();
		if (!isURL)
			setFileReloadTimer();
		class_mon.exit();
		return;
_L2:
		int descIdx;
		descIdx = ByteFormatter.byteArrayToInt(ipBytes);
		read = bin.read(ipBytes);
		if (read >= 4)
			break MISSING_BLOCK_LABEL_1593;
		if (bin != null)
			try
			{
				bin.close();
			}
			catch (Throwable e) { }
		if (fin != null)
			try
			{
				fin.close();
			}
			catch (Throwable e) { }
		for (Iterator it = new_ipRanges.iterator(); it.hasNext(); ((IpRange)it.next()).checkValid());
		ipFilter.markAsUpToDate();
		if (!isURL)
			setFileReloadTimer();
		class_mon.exit();
		return;
		int startIp;
		startIp = ByteFormatter.byteArrayToInt(ipBytes);
		read = bin.read(ipBytes);
		if (read >= 4)
			break MISSING_BLOCK_LABEL_1705;
		if (bin != null)
			try
			{
				bin.close();
			}
			catch (Throwable e) { }
		if (fin != null)
			try
			{
				fin.close();
			}
			catch (Throwable e) { }
		for (Iterator it = new_ipRanges.iterator(); it.hasNext(); ((IpRange)it.next()).checkValid());
		ipFilter.markAsUpToDate();
		if (!isURL)
			setFileReloadTimer();
		class_mon.exit();
		return;
		int endIp = ByteFormatter.byteArrayToInt(ipBytes);
		String description = descIdx >= descs.length || descIdx < 0 ? "" : descs[descIdx];
		IpRangeImpl ipRange = new IpRangeImpl(description, startIp, endIp, true);
		ipRange.setAddedToRangeList(true);
		new_ipRanges.add(ipRange);
		i++;
		  goto _L3
		Throwable e;
		if (bin != null)
			try
			{
				bin.close();
			}
			// Misplaced declaration of an exception variable
			catch (Throwable e) { }
		if (fin != null)
			try
			{
				fin.close();
			}
			// Misplaced declaration of an exception variable
			catch (Throwable e) { }
		for (Iterator it = new_ipRanges.iterator(); it.hasNext(); ((IpRange)it.next()).checkValid());
		ipFilter.markAsUpToDate();
		if (!isURL)
			setFileReloadTimer();
		break MISSING_BLOCK_LABEL_2042;
		it;
		Debug.out(it);
		if (bin != null)
			try
			{
				bin.close();
			}
			// Misplaced declaration of an exception variable
			catch (Iterator it) { }
		if (fin != null)
			try
			{
				fin.close();
			}
			// Misplaced declaration of an exception variable
			catch (Iterator it) { }
		for (Iterator it = new_ipRanges.iterator(); it.hasNext(); ((IpRange)it.next()).checkValid());
		ipFilter.markAsUpToDate();
		if (!isURL)
			setFileReloadTimer();
		break MISSING_BLOCK_LABEL_2042;
		Exception exception;
		exception;
		if (bin != null)
			try
			{
				bin.close();
			}
			catch (Throwable e) { }
		if (fin != null)
			try
			{
				fin.close();
			}
			catch (Throwable e) { }
		for (Iterator it = new_ipRanges.iterator(); it.hasNext(); ((IpRange)it.next()).checkValid());
		ipFilter.markAsUpToDate();
		if (!isURL)
			setFileReloadTimer();
		throw exception;
		class_mon.exit();
		break MISSING_BLOCK_LABEL_2062;
		Exception exception1;
		exception1;
		class_mon.exit();
		throw exception1;
	}

	private void setFileReloadTimer()
	{
		if (timerEventFilterReload instanceof TimerEvent)
			((TimerEvent)timerEventFilterReload).cancel();
		else
		if (timerEventFilterReload instanceof TimerEventPeriodic)
			((TimerEventPeriodic)timerEventFilterReload).cancel();
		timerEventFilterReload = SimpleTimer.addPeriodicEvent("IP Filter download", 60000L, new TimerEventPerformer() {

			long lastFileModified;
			final IpFilterAutoLoaderImpl this$0;

			public void perform(TimerEvent event)
			{
				event.cancel();
				String file = COConfigurationManager.getStringParameter("Ip Filter Autoload File");
				File filtersFile = new File(file);
				if (!filtersFile.exists())
					return;
				long fileModified = filtersFile.lastModified();
				if (lastFileModified == 0L)
					lastFileModified = fileModified;
				else
				if (lastFileModified != fileModified)
					try
					{
						ipFilter.reload();
					}
					catch (Exception e) { }
			}

			
			{
				this$0 = IpFilterAutoLoaderImpl.this;
				super();
			}
		});
	}

	private void downloadFiltersAsync(URL url)
	{
		ResourceDownloader rd = ResourceDownloaderFactoryImpl.getSingleton().create(url);
		rd.addListener(new ResourceDownloaderAdapter() {

			final IpFilterAutoLoaderImpl this$0;

			public void reportPercentComplete(ResourceDownloader resourcedownloader, int i)
			{
			}

			public boolean completed(ResourceDownloader downloader, InputStream data)
			{
				setNextAutoDownload(true);
				Logger.log(new LogEvent(IpFilterAutoLoaderImpl.LOGID, "downloaded..waiting"));
				IpFilterAutoLoaderImpl.class_mon.enter();
				Logger.log(new LogEvent(IpFilterAutoLoaderImpl.LOGID, "downloaded.. copying"));
				try
				{
					FileUtil.copyFile(data, FileUtil.getUserFile("ipfilter.dl"));
					AEThread thread = new AEThread("reload ipfilters", true) {

						final 2 this$1;

						public void runSupport()
						{
							try
							{
								UIFunctions uif = UIFunctionsManager.getUIFunctions();
								if (uif != null)
									uif.setStatusText("Reloading Filters..");
								ipFilter.reload(false);
								if (uif != null)
									uif.setStatusText(null);
							}
							catch (Exception e)
							{
								Debug.out(e);
							}
						}

					
					{
						this$1 = 2.this;
						super(x0, x1);
					}
					};
					thread.setPriority(4);
					thread.start();
				}
				catch (Exception e)
				{
					Debug.out(e);
				}
				IpFilterAutoLoaderImpl.class_mon.exit();
				break MISSING_BLOCK_LABEL_102;
				Exception exception;
				exception;
				IpFilterAutoLoaderImpl.class_mon.exit();
				throw exception;
				return true;
			}

			
			{
				this$0 = IpFilterAutoLoaderImpl.this;
				super();
			}
		});
		rd.asyncDownload();
	}

	public void setNextAutoDownload(boolean updateLastDownloadedDate)
	{
		long now = SystemTime.getCurrentTime();
		long lastDL;
		if (updateLastDownloadedDate)
		{
			COConfigurationManager.setParameter("Ip Filter Autoload Last Date", now);
			lastDL = now;
		} else
		{
			lastDL = COConfigurationManager.getLongParameter("Ip Filter Autoload Last Date");
			if (lastDL > now)
			{
				lastDL = now;
				COConfigurationManager.setParameter("Ip Filter Autoload Last Date", now);
			}
		}
		long nextDL = lastDL + 0x240c8400L;
		if (timerEventFilterReload instanceof TimerEvent)
			((TimerEvent)timerEventFilterReload).cancel();
		else
		if (timerEventFilterReload instanceof TimerEventPeriodic)
			((TimerEventPeriodic)timerEventFilterReload).cancel();
		timerEventFilterReload = SimpleTimer.addEvent("IP Filter download", nextDL, new TimerEventPerformer() {

			final IpFilterAutoLoaderImpl this$0;

			public void perform(TimerEvent event)
			{
				String file = COConfigurationManager.getStringParameter("Ip Filter Autoload File");
				try
				{
					downloadFiltersAsync(new URL(file));
				}
				catch (MalformedURLException e) { }
			}

			
			{
				this$0 = IpFilterAutoLoaderImpl.this;
				super();
			}
		});
	}

	private String readString(BufferedInputStream bin, byte descBytes[], String encoding)
	{
		int pos;
		UnsupportedEncodingException e;
		pos = 0;
		int byteRead;
		try
		{
			do
			{
				byteRead = bin.read();
				if (byteRead < 0)
					break;
				if (pos < descBytes.length)
				{
					descBytes[pos] = (byte)byteRead;
					pos++;
				}
			} while (byteRead != 0);
		}
		// Misplaced declaration of an exception variable
		catch (UnsupportedEncodingException e) { }
		if (pos <= 1)
			break MISSING_BLOCK_LABEL_73;
		return new String(descBytes, 0, pos - 1, encoding);
		e;
		return "";
	}

	static 
	{
		LOGID = LogIDs.CORE;
	}




}

⌨️ 快捷键说明

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