Пример #1
0
        //==============================================================================
        /// <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
        /// &lt;initsection&gt;
        ///      &lt;init..... /&gt;
        ///   &lt;/initsection&gt;
        ///</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);
            }
        }
Пример #2
0
        //=======================================================================
        /// <summary>
        /// Number of inits this component has.
        /// </summary>
        /// <returns>The count of inits in this component SDML.</returns>
        //=======================================================================
        public uint initCount()
        {
            uint count = 0;

            if (initsParser != null)
            {
                count = initsParser.initCount();
            }
            return(count);
        }