Only check the registry on Vinders.

This commit is contained in:
Michael Bayne
2004-07-31 03:55:16 +00:00
parent fc5585dbca
commit aba5853e4a
@@ -1,5 +1,5 @@
// //
// $Id: Getdown.java,v 1.30 2004/07/31 03:05:12 mdb Exp $ // $Id: Getdown.java,v 1.31 2004/07/31 03:55:16 mdb Exp $
package com.threerings.getdown.launcher; package com.threerings.getdown.launcher;
@@ -37,6 +37,7 @@ import ca.beq.util.win32.registry.RootKey;
import com.samskivert.swing.util.SwingUtil; import com.samskivert.swing.util.SwingUtil;
import com.samskivert.text.MessageUtil; import com.samskivert.text.MessageUtil;
import com.samskivert.util.RunAnywhere;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
import com.threerings.getdown.Log; import com.threerings.getdown.Log;
@@ -170,38 +171,40 @@ public class Getdown extends Thread
} }
// look in the Vinders registry // look in the Vinders registry
try { if (RunAnywhere.isWindows()) {
String host = null, port = null; try {
boolean enabled = false; String host = null, port = null;
RegistryKey.initialize(); boolean enabled = false;
RegistryKey r = new RegistryKey( RegistryKey.initialize();
RootKey.HKEY_CURRENT_USER, PROXY_REGISTRY); RegistryKey r = new RegistryKey(
for (Iterator iter = r.values(); iter.hasNext(); ) { RootKey.HKEY_CURRENT_USER, PROXY_REGISTRY);
RegistryValue value = (RegistryValue)iter.next(); for (Iterator iter = r.values(); iter.hasNext(); ) {
if (value.getName().equals("ProxyEnable")) { RegistryValue value = (RegistryValue)iter.next();
enabled = value.getStringValue().equals("1"); if (value.getName().equals("ProxyEnable")) {
} enabled = value.getStringValue().equals("1");
if (value.getName().equals("ProxyServer")) { }
String strval = value.getStringValue(); if (value.getName().equals("ProxyServer")) {
int cidx = strval.indexOf(":"); String strval = value.getStringValue();
if (cidx != -1) { int cidx = strval.indexOf(":");
port = strval.substring(cidx+1); if (cidx != -1) {
strval = strval.substring(0, cidx); port = strval.substring(cidx+1);
strval = strval.substring(0, cidx);
}
host = strval;
} }
host = strval;
} }
}
if (enabled) { if (enabled) {
setProxyProperties(host, port); setProxyProperties(host, port);
return true; return true;
} else { } else {
Log.info("Detected no proxy settings in the registry."); Log.info("Detected no proxy settings in the registry.");
} }
} catch (Throwable t) { } catch (Throwable t) {
Log.info("Failed to find proxy settings in Windows registry " + Log.info("Failed to find proxy settings in Windows registry " +
"[error=" + t + "]."); "[error=" + t + "].");
}
} }
// otherwise look for and read our proxy.txt file // otherwise look for and read our proxy.txt file