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

📄 config.java

📁 Remote Internet Connect简化了从其它运行操作系统的机子上将一个Linux系统连接到Internet的过程。用户可以用一个简单的GUI加快连接、断开连接、或查看谁在线上。
💻 JAVA
字号:
/*
 * RIC 2 Server Release. by Harry Otten (c) Copyright 2003 hotten@dds.nl
 * Check out http://www.hotten.dds.nl/ric/
 * 
 
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
USA.
*/

import java.awt.*;
import java.io.*;   // for IOException and Input/OutputStream


public class Config {
		
	
	public Config() {
		file = new File("../config/RICd.cfg");
	}
	
	File file;
	
	private String SERVERIP;
	private int SERVER_PORT;
	private int AUTO_CHECK;
	
	private String COMMAND_MAKE_CONNECTION;
	private String COMMAND_HANGUP_CONNECTION;
	private String COMMAND_CHECK_CONNECTION;
		
	private FileInputStream in;
	private FileOutputStream out;
		
	public boolean readSettings() {
		if (!file.canRead()) {
			System.out.println("WARNING! Can't read config file RICd.cfg");
			return false;
		}
			
	  	try { 
	  		System.out.println("Start of reading config file");
	  		in = new FileInputStream(file);
	 	 	int byteRead;
	 		StringBuffer stringBuf= new StringBuffer();
	 		String commando = new String();
			
			
			byteRead=in.read();
			do {
				stringBuf.append((char)byteRead);					
				byteRead=in.read();
			}while (byteRead!=(int)';');
				
			SERVERIP = stringBuf.toString();
					
			System.out.println("Server IP is:" + SERVERIP);
			
			stringBuf.setLength(0);
			byteRead=in.read();
			do {
				stringBuf.append((char)byteRead);					
				byteRead=in.read();
			}while (byteRead!=(int)';');
			
			COMMAND_MAKE_CONNECTION = stringBuf.toString();
			System.out.println("COMMAND_MAKE_CONNECTION config is:" +COMMAND_MAKE_CONNECTION);
			
			stringBuf.setLength(0);
			byteRead=in.read();
			do {
				stringBuf.append((char)byteRead);					
				byteRead=in.read();
			}while (byteRead!=(int)';');
				
			
			COMMAND_HANGUP_CONNECTION = stringBuf.toString();
			System.out.println("COMMAND_HANGUP_CONNECTION config is:" +COMMAND_HANGUP_CONNECTION);
			
			stringBuf.setLength(0);
			byteRead=in.read();
			do {
				stringBuf.append((char)byteRead);					
				byteRead=in.read();
			}while (byteRead!=(int)';');
			
						
			COMMAND_CHECK_CONNECTION = stringBuf.toString();
			System.out.println("COMMAND_CHECK_CONNECTION config is:" +COMMAND_CHECK_CONNECTION);
					
			stringBuf.setLength(0);
			byteRead=in.read();
			do {
				stringBuf.append((char)byteRead);					
				byteRead=in.read();
			}while (byteRead!=(int)';');
			
						
			SERVER_PORT=Integer.parseInt(stringBuf.toString());
			System.out.println("Port number is " +SERVER_PORT);
			
			
			stringBuf.setLength(0);
			byteRead=in.read();
			do {
				stringBuf.append((char)byteRead);					
				byteRead=in.read();
			}while (byteRead!=(int)';');
			
			AUTO_CHECK=Integer.parseInt(stringBuf.toString());
			System.out.println("Auto Check timer is " +AUTO_CHECK);
						
			in.close();
			
			System.out.println("Done reading\n");
	
			return true;
		} catch (Exception e){		
			System.out.println("Read error config file\n");
		}
	return false;
}
		

	
	public String getServerIP() {
		return SERVERIP;
	}
		
	public int getServerPort() {
		return SERVER_PORT;
	}
	
	public String getMakeConnection() {	
		return COMMAND_MAKE_CONNECTION;
	}
	
	public String getHangupConnection() {	
		return COMMAND_HANGUP_CONNECTION;
	}
	
	public String getCheckConnection() {	
		return COMMAND_CHECK_CONNECTION;
	}
	
	public int getAutoCheck() {
		return AUTO_CHECK;
	}
	
	
}

⌨️ 快捷键说明

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