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

📄 config.java

📁 AjaxVNC 一个简单的远程控制服务器
💻 JAVA
字号:
package hk.haha.onet.ajaxvnc;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;


public class Config {
	
	private static Properties prop;
	
	private static final String HTTP_PORT = "HTTP_PORT";
	private static final String JPEG_QUALITY = "JPEG_QUALITY";
	
	public static int http_port;
	public static float jpeg_quality;
	
	public static Properties getDefaultProperties() {
		Properties defaultProp = new Properties();
		defaultProp.setProperty(HTTP_PORT, "8086");
		defaultProp.setProperty(JPEG_QUALITY, "0.5");
		return defaultProp;
	}
	
	public static void assignValue() {
		http_port = Integer.parseInt(prop.getProperty(HTTP_PORT));
		jpeg_quality = Float.parseFloat(prop.getProperty(JPEG_QUALITY));
	}
	
	public static void load(String path) {
		prop = getDefaultProperties();
		try {
			FileInputStream fis = new FileInputStream(path);
			prop.load(fis);
			fis.close();
		} catch (FileNotFoundException e){
			FileOutputStream fos;
			try {
				fos = new FileOutputStream(path);
				prop.store(fos, "Ajax VNC Config");
				fos.close();
			} catch (FileNotFoundException e1) {
			} catch (IOException e2) {
			} 
		}
		catch (IOException e) {
			// silent
		}
		assignValue();
	}
	
}

⌨️ 快捷键说明

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