Mercurial > hg > Applications > TreeVNC
view src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java @ 52:986f16afb753
update before change host.
author | one |
---|---|
date | Sat, 02 Nov 2013 17:55:10 +0900 |
parents | eb34277a22ff |
children | ac6f9e46566f |
line wrap: on
line source
package com.glavsoft.viewer; import jp.ac.u_ryukyu.treevnc.client.MyVncClient; import jp.ac.u_ryukyu.treevnc.server.VncProxyService; public class TreeViewer { private boolean treeProxy; private boolean viewer; private int width; private int height; public static void main(String[] args) { new TreeViewer().vncStart(args); } private void vncStart(String[] args) { modeSelect(args); if (treeProxy) { VncProxyService vps = new VncProxyService(); vps.proxyStart(args,width,height); } else if (viewer) { Viewer v = new Viewer(); v.startViewer(args); } else { MyVncClient mvc = new MyVncClient(); mvc.startClient(args); } } private void modeSelect(String[] args) { for (int i = 0; i < args.length; i++) { if ("-p".equals(args[i])) { treeProxy = true; } else if ("-v".equals(args[i])) { viewer = true; } else if ("-r".equals(args[i])) { treeProxy = true; } else if ("--version".equals(args[i])) { System.out.println("version :" + VncProxyService.ver()); System.exit(0); } else if ("-retina".equals(args[i])) { treeProxy = true; if(getParameter(args,i)) i = i + 2; } else { System.out.println("(default) TreeVNCClient\n" + "-p: TreeVNCProxy\n" + "-v: VNCViewer\n" + "-r: TreeVNCProxy for RemoteHost. you should input parameter host and port\n" + "-retina whidth heght: TreeVNC proxy for retina.this mode can select screen range."); } } } private boolean getParameter(String[] args, int i) { if(isInteger(args[++i])&&isInteger(args[++i])) { width = Integer.parseInt(args[--i]); height = Integer.parseInt(args[++i]); return true; } else { width = 1920; height = 1080; return false; } } private boolean isInteger(String num) { try { Integer.parseInt(num); return true; } catch (NumberFormatException e) { return false; } } }