Added a really basic Config class for storing prefs clientside,

wired it up.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4184 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-06-08 22:12:19 +00:00
parent e6e96c25fc
commit d948eb4f37
3 changed files with 62 additions and 4 deletions
@@ -80,14 +80,14 @@ public class Communicator
var host :String = _client.getHostname();
var pportKey :String = host + ".preferred_port";
// TODO: extract preferred port from saved prefs
var pport :int = /** TODO Prefs.getValue(pportKey, **/ (ports[0] as int);
var pport :int =
(PresentsPrefs.config.getValue(pportKey, ports[0]) as int);
var ppidx :int = Math.max(0, ports.indexOf(pport));
var port :int = (ports[(_portIdx + ppidx) % ports.length] as int);
if (logonWasSuccessful) {
_portIdx = -1; // indicate that we're no longer trying new ports
// TODO: Prefs.setValue(pportKey, port);
PresentsPrefs.config.setValue(pportKey, port);
} else {
Log.getLog(this).info(
@@ -238,7 +238,6 @@ public class Communicator
*/
protected function socketError (event :IOErrorEvent) :void
{
_socket.close();
// if we're trying ports, try the next one.
if (_portIdx != -1) {
_portIdx++;
@@ -0,0 +1,13 @@
package com.threerings.presents.client {
import com.threerings.util.Config;
/**
* Provides access to runtime configuration parameters for this package.
*/
public class PresentsPrefs
{
/** Used to store our preferences. */
public static const config :Config = new Config("rsrc/config/presents");
}
}