//============================================================================== /// <summary> /// Convert an init script into the relevant properties. /// </summary> /// <param name="sScriptName">Name of the script.</param> /// <param name="sScriptText">XML text of the init script /// <initsection> /// <init..... /> /// </initsection> ///</param> // N.Herrmann Feb 2007 //============================================================================== public void textToInitScript(string sScriptName, string sScriptText) { uint initCount; string buf; uint i; TDDMLValue ddmlVal; TSDMLValue sdmlVal; Byte [] data; TInitParser initSection; int index = getScriptIndex(sScriptName); if (index < 0) { createInitScript(sScriptName); } scriptList[index].scriptText = sScriptText; //set the text string for the script scriptList[index].propertyList.Clear(); //remove all the properties //now get all the sdml properties from the initsection initSection = new TInitParser(sScriptText); //parse the <initsection> ddmlVal = new TDDMLValue("<empty/>", "defined"); //used for getting the ddml type initCount = initSection.initCount(); for (i = 1; i <= initCount; i++) { //for each init value buf = initSection.initText(i); //the sdml xml sdmlVal = new TSDMLValue(buf, ""); //new sdml type data = new Byte[sdmlVal.sizeBytes()]; sdmlVal.getData(ref data); //get the datablock //add this property to the script. (a little inneficient here) valueToInitScript(sScriptName, sdmlVal.Name, ddmlVal.getText(sdmlVal, 0, 2), data); } }
//======================================================================= /// <summary> /// Get the SDML text for an init in the init section. /// </summary> /// <param name="initIndex">The index of an init in the init section. 1 -> x</param> /// <returns>The SDML text for an init variable.<br/> /// <init><br/> /// ...<br/> /// </init> /// </returns> //======================================================================= public String initText(uint initIndex) { if (initsParser != null) { return(initsParser.initText(initIndex)); } else { return(""); } }