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

📄 program.jsl

📁 完美的在线教育系统
💻 JSL
字号:
package DokeosAppShare;import System.Windows.Forms.*;import java.io.*;import java.net.*;/** * Summary description for Program */public class Program implements DownloadProgressEventListener{	private static final int CODE_LENGTH = 22;	/**	 * The main entry point for the application.	 */	/** @attribute System.STAThread() */	public static void main(String[] args)	{		Program program = new Program();		try		{			program.instanceMain(args);		}		catch (SecurityException ex)		{			MessageBox.Show("Security Error: Execute the application from your desktop.", "Security Error", MessageBoxButtons.OK, MessageBoxIcon.Error);		}	}	private System.Diagnostics.Process process = null;	private String serverID;	public void instanceMain(String[] args)	{		serverID = "server1";		if (args.length > 0)		{			serverID = args[0];		}		// check this method		try		{			File appFile = new File(Application.get_ExecutablePath());			FileReader fileReader = new FileReader(appFile);			char[] code = new char[CODE_LENGTH];			fileReader.skip(appFile.length() - code.length);			int readLength = fileReader.read(code, 0, code.length);			serverID = new String(code);		}		catch (FileNotFoundException ex)		{			ex.printStackTrace();		}		catch (IOException ex)		{			ex.printStackTrace();		}		if (serverID != null)		{			DownloadThread download = null;			//Prepare download VNC			try			{				File vncFile = File.createTempFile("dokeosVNC", ".exe");				download = new DownloadThread(new URL(Config.getVNCExecutableURL()), vncFile);			}			catch (IOException ex)			{				System.out.println("Exception during VNC download prepare");				ex.printStackTrace();			}			if (download != null)			{				download.addDownloadProgressEventListener(this);				Application.EnableVisualStyles();				Application.SetCompatibleTextRenderingDefault(false);				LocalRelay localRelay = new LocalRelay(download);				localRelay.setServerID(serverID);				localRelay.Show();				download.start();				Application.Run(localRelay);				if (process != null && !process.get_HasExited())				{					try					{						process.Kill();					}					catch (Exception ex)					{						ex.printStackTrace();					}				}			}		}		else		{			System.out.println("ERROR: server id not defined.");		}	}	public void connecting() {		System.out.println("VNC download connecting ...");	}	public void started() {		System.out.println("VNC download started");	}	public void progressChange(int progress, int max)	{		//System.out.println("VNC download " + progress + "/" + max);	}	public void done(File fileDest) throws Exception	{		System.out.println("VNC download done");		//Start VNC		System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo(fileDest.getPath());		si.set_UseShellExecute(false);		Config.writeRegOptions();		process = System.Diagnostics.Process.Start(si);		System.out.println("VNC executed");		System.out.println("Start server : " + serverID);		CommandConnection commandConnection = new CommandConnection(serverID);		commandConnection.start();	}	public void exception(Exception ex)	{		ex.printStackTrace();		System.out.println("VNC download Exception");	}}

⌨️ 快捷键说明

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