home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Joystick Magazine 2003 November
/
CD1_JOY_153.iso
/
demos
/
NHL2004Demo.exe
/
fe
/
COMMON
/
js
/
properties.js
< prev
next >
Wrap
Text File
|
2003-08-20
|
1KB
|
44 lines
function EASOProperties ( fileName )
{
this._values = new Array();
var split = top.location.href.split(/\b\/fe\/\w/g, 2);
var installFolder= (split) ? split[0] : "";
installFolder=unescape(installFolder);
installFolder= installFolder.substring(8) + "/";
if (fileName) {
this.fileName = fileName;
} else {
this.fileName = installFolder + "EASOProperties.txt"
};
this._loadFile (this.fileName);
};
EASOProperties.prototype.get = function (propName, defaultValue)
{
if (this._values[propName]) {
return this._values[propName];
} else {
return defaultValue;
};
};
EASOProperties.prototype.set = function (propName, value) { this._values[propName] = value; };
EASOProperties.prototype._loadFile = function(name)
{
//var fso = new ActiveXObject("Scripting.FileSystemObject");
//var textStream = fso.OpenTextFile( name);
//while (! textStream.AtEndOfStream) {
// this._parseLine ( textStream.ReadLine() );
//};
//textStream.Close();
};
EASOProperties.prototype._parseLine = function(l)
{
if (!l) return;
if (trim(l).charAt(0) =='#') return;
var delimPos = l.indexOf (":");
var name = l.substr (0, delimPos );
var val = l.substr (delimPos+1);
if ( name && ( val !=null ) )
this._values[ name] = trim ( val ) ;
};
function trim (s) { return s.replace(/(^\s*)|(\s*$)/g, ""); };
var EASOProps = new EASOProperties();