utilnetgui.java

来自「NetGUI v0.4.1 」· Java 代码 · 共 148 行

JAVA
148
字号
/* * Copyright (C) 2005, 2006  * Santiago Carot Nemesio * * This file is part of NetGUI. * * NetGUI 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. *  * NetGUI 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 NetGUI; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA *   */import java.io.*;import java.lang.*;public class UtilNetGUI{		private static File currentWorkSpace;	private static int netCount = 1;	private static int systemCount = 1;	private static int routerCount = 1;	private static int hubCount = 1;	private static final String hubName = "hub";	private static final String idNet = "NET";	private static final String idSystem = "pc";	private static final String idRouter = "r";	private static boolean statusChanged = false;			/****************************************	 * Cambia el directorio de trabajo actual	 * (nuevo proyecto, cargar proyecto...)	 ****************************************/	public static void setCurrentWorkSpace(File in)	{		currentWorkSpace=in;	}		public static File getCurrentWorkSpace()	{		return currentWorkSpace;	}		/*********************************************	 * Devuelve true si el archivo fileName existe	 * dentro del directorio de trabajo	 *********************************************/	public static boolean fileExists(String fileName)	{		File f = new File(currentWorkSpace.getAbsolutePath() + "/" +fileName);		return f.exists();	}		/*********************************************	 * Si existe el fichero .disk asociado al nodo	 * lo borra y devuelve true	 *********************************************/	public static boolean deleteFileNodeDisk(String nodeName)	{		File f = new File(currentWorkSpace.getAbsolutePath() + "/" +nodeName + ".disk");		if (f.exists())			f.delete();		return f.exists();	}		/****************************************	 * M閠odo de clase que devuelve un nombre	 * para una nueva red	 ****************************************/	public static String getNetName ()	{		return idNet + netCount; 	}		/****************************************	 * M閠odo de clase que devuelve un nombre	 * para una nuevo terminal	 ****************************************/	public static String getPcName ()	{		return idSystem + systemCount; 	}		/****************************************	 * M閠odo de clase que devuelve un nombre	 * para una nuevo terminal	 ****************************************/	public static String getRouterName ()	{		return idRouter + routerCount; 	}		/****************************************	 * M閠odo de clase que devuelve un nombre	 * para el nuevo hub	 ****************************************/	public static String getHubName ()	{		return hubName + hubCount; 	}		public static void reset()	{		netCount = 1;		hubCount = 1;		routerCount = 1;		systemCount = 1;		//System.out.println("Reset: RouterCount=" + routerCount + ", SystemCount=" + 			//systemCount + ", NetCount=" + netCount);	}		public static boolean aplicationChanged () {return statusChanged;}	public static void setAplicationStatusChange (boolean change)		{			statusChanged = change;		}			public static void IncrementHubCount () {hubCount++;}	public static void IncrementRouterCount () {routerCount++;}	public static void IncrementPcCount () {systemCount++;}	public static void IncrementNetCount () {netCount++;}		public static void displayUserManual()	{		try {				Process proc;//				System.out.println("firefox /mix/linux/install/netkit2/netkit/html/manual.html");				proc = Runtime.getRuntime().exec("firefox "+						System.getProperty("NETLAB_HOME")+						"/netgui/html/manual.html", null);			} catch (Exception ex)				{System.out.println("Error " + ex);}	}	}

⌨️ 快捷键说明

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