changeset 31:cb0e4fd2d982

upload CreateHtmlFile.java
author e085711
date Wed, 27 Apr 2011 05:38:00 +0900
parents a0e1fc94d344
children 015d43bb2b62
files src/myVncProxy/VncProxyService.java
diffstat 1 files changed, 15 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/myVncProxy/VncProxyService.java	Wed Apr 27 02:33:08 2011 +0900
+++ b/src/myVncProxy/VncProxyService.java	Wed Apr 27 05:38:00 2011 +0900
@@ -18,6 +18,9 @@
 	}
 	
 	String[] mainArgs;
+	String username;
+	
+	CreateHtmlFile htmlFile;
 
 	// RfbProto rfb;
 	MyRfbProto rfb;
@@ -59,10 +62,14 @@
 
 	
 	void checkArgs(String[] argv){
-		if(argv.length < 2){
+		if(argv.length > 3){
+			username = argv[3]; 
+		}else if(argv.length < 2){
 			System.out.println("Please enter argv");
 			System.out.println("hostname(IPaddress) port password");
 			System.exit(0);
+		}else{
+			username = argv[0];
 		}
 	}
 	
@@ -110,11 +117,9 @@
 		try {
 //			connectAndAuthenticate();
 			doProtocolInitialisation();
-			
-			System.out.println("<APPLET CODE=\"VncViwer.class\" ARCHIVE=\"VncViewer.jar\"\n " +
-					"WIDTH=\""+rfb.framebufferWidth+"\" HEIGHT=\""+rfb.framebufferHeight+"\">");
-			System.out.println("<PARAM NAME=\"PORT\" VALUE=\""+rfb.getAcceptPort()+"\">");
-			System.out.println("<PARAM NAME=\"HOST\" VALUE=\""+host+"\">");
+	
+			htmlFile = new CreateHtmlFile(rfb, host, username);
+			htmlFile.createHtml();
 			
 			vc = new ProxyVncCanvas(this, 0, 0);
 			vc.updateFramebufferSize();
@@ -260,7 +265,7 @@
 		vncContainer.remove(authPanel);
 		 */
 		showConnectionStatus("ask password...");
-		String pw = mainArgs[1];
+		String pw = mainArgs[2];
 		return pw;
 	}
 
@@ -514,13 +519,11 @@
 	void readParameters() {
 
 		host = mainArgs[0];
-		if(mainArgs.length < 3){
+		if(mainArgs.length < 2){
 			port = 5900;
 		}else{
-			port = Integer.parseInt(mainArgs[2]);
+			port = Integer.parseInt(mainArgs[1]);
 		}
-
-
 		
 
 		// Read "ENCPASSWORD" or "PASSWORD" parameter if specified.
@@ -568,7 +571,7 @@
 
 	private void readPasswordParameters() {
 		// String encPasswordParam = readParameter("ENCPASSWORD", false);
-		String encPasswordParam = mainArgs[1];
+		String encPasswordParam = mainArgs[2];
 
 		if (encPasswordParam == null) {
 			// passwordParam = readParameter("PASSWORD", false);