ConfigurationSettings dotnet-alike XML module?

BlitzMax Forums/BlitzMax Programming/ConfigurationSettings dotnet-alike XML module?

pappavis(Posted 2007) [#1]
Without having to reinvent the wheel, have anyone written a System.Configuration.ConfigurationSettings class/module for me to gratiously use in by BlitzMax apps?

I have spent an hour or two on coding a rudementary ConfigurationSettings-class for BlitzMax using brucey' conversion of libxml. Though, too much coding for me :P.


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
	<!-- Let op, alle waarden ook VALUEs zijn HOOFDLETTERGEVOELIG!!!! -->
	<appSettings>
		<add key="DSN" value="Data Source=192.168.25.41" />
		<add key="CommandTimeout" value="120"/>  <!-- Database connectiontimeout voor queries -->
		<add key="MEinit" value="D:\Spelen\Eagle Dynamics\Lock On\ME\MEinit.xml"/>
		<add key="extProperties" value="173 128 126 63 0 0 0 0 196 46 "/>
		<add key="LomacRegistryPath" value="SOFTWARE\Ubisoft\Eagle Dynamics\Lock On"/>
		<add key="LockonMissionHeader" value="LockonMissionHeader.bin"/>
		<add key="MissionHeaderEndpos" value="1535"/>
		<add key="MissionfileEncoding" value="UTF-8"/>
	</appSettings>
</configuration>



The idea is to be able to use the code like this;
method DoSumthing()
  print getKeyvalue("DSN");
end method 

function getKeyvalue:String(keyName:String)
	
	Local xmlDoc1:xmlDoc = new xmlDoc;
	Local Keyvalue:String;
	
	xmlDoc.Load("theconfigfile.xml");
	Keyvalue = xmlDoc.selectSingleNode("//add[key='" + keyName + "']").value
	return Keyvalue;
	
end function



In C# dotnet code this will suffice;

keyValue = System.Configuration.ConfigurationSettings["DSN"];


have anyone made a ConfigurationSettings-XML class for BlitzMax?


FlameDuck(Posted 2007) [#2]
Not exactly XML, but yes.