diff options
Diffstat (limited to 'java/com/tigervnc/rfb/Configuration.java')
-rw-r--r-- | java/com/tigervnc/rfb/Configuration.java | 76 |
1 files changed, 5 insertions, 71 deletions
diff --git a/java/com/tigervnc/rfb/Configuration.java b/java/com/tigervnc/rfb/Configuration.java index 5d140d95..11fc89a4 100644 --- a/java/com/tigervnc/rfb/Configuration.java +++ b/java/com/tigervnc/rfb/Configuration.java @@ -26,14 +26,19 @@ package com.tigervnc.rfb; import java.io.FileInputStream; import java.io.PrintWriter; +import java.lang.reflect.Field; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; +import com.tigervnc.vncviewer.VncViewer; + public class Configuration { static LogWriter vlog = new LogWriter("Configuration"); + private static final String IDENTIFIER_STRING = "TigerVNC Configuration file Version 1.0"; + public enum ConfigurationObject { ConfGlobal, ConfServer, ConfViewer }; // -=- The Global/server/viewer Configuration objects @@ -259,77 +264,6 @@ public class Configuration { list(79, 10); } - public void readAppletParams(java.applet.Applet applet) { - VoidParameter current = head; - while (current != null) { - String str = applet.getParameter(current.getName()); - if (str != null) - current.setParam(str); - current = current._next; - } - } - - public static void load(String filename) { - if (filename == null) - return; - - /* Read parameters from file */ - Properties props = new Properties(); - try { - props.load(new FileInputStream(filename)); - } catch(java.security.AccessControlException e) { - vlog.error("Cannot access system properties:"+e.getMessage()); - return; - } catch (java.lang.Exception e) { - vlog.error("Error opening config file:"+e.getMessage()); - return; - } - - for (Iterator<String> i = props.stringPropertyNames().iterator(); i.hasNext();) { - String name = (String)i.next(); - if (name.startsWith("[")) { - // skip the section delimiters - continue; - } else if (name.equals("host")) { - setParam("Server", props.getProperty(name)); - } else if (name.equals("disableclipboard")) { - setParam("RecvClipboard", props.getProperty(name)); - setParam("SendClipboard", props.getProperty(name)); - } else if (name.equals("localcursor")) { - setParam("UseLocalCursor", props.getProperty(name)); - } else { - if (!setParam(name, props.getProperty(name))) - vlog.debug("Cannot set parameter: "+name); - } - } - } - - public static void save(String filename) { - PrintWriter pw = null; - try { - pw = new PrintWriter(filename, "UTF-8"); - } catch (java.lang.Exception e) { - vlog.error("Error opening config file:"+e.getMessage()); - return; - } - - pw.println("# TigerVNC viewer configuration"); - DateFormat dateFormat = new SimpleDateFormat("E MMM d k:m:s z yyyy"); - Date date = new Date(); - pw.println("# "+dateFormat.format(date)); - VoidParameter current = Configuration.global().head; - while (current != null) { - String name = current.getName(); - String value = current.getValueStr(); - if (!name.equals("Server") && !name.equals("Port") && - value != null && value != current.getDefaultStr()) - pw.println(name+"="+current.getValueStr()); - current = current._next; - } - pw.flush(); - pw.close(); - } - // Name for this Configuration private String name; |