Example #1
0
        //==============================================================================
        /// <summary>
        /// Constructs the script and stores it in the scriptText field of the script item.
        /// </summary>
        /// <param name="index">Index of the script in the scriptList.</param>
        /// <returns>Length in characters of the script.</returns>
        // N.Herrmann Feb 2007
        //==============================================================================
        protected int buildScript(int index)
        {
            TScriptProperty prop;
            StringBuilder   buf;
            int             i;
            int             length = 0;

            if (index >= 0)
            {
                TScriptSpec script = scriptList[index];
                buf = new StringBuilder("<initsection>\n");
                //now for each property
                i = 0;
                while (i < script.propertyList.Count)
                {
                    prop = script.propertyList[i];
                    buf.Append(prop.sdmlType + "\n");
                    i++;
                }
                buf.Append("</initsection>");
                script.scriptText      = buf.ToString();
                script.propertyChanged = false;
                length            = script.scriptText.Length;
                scriptList[index] = script;
            }

            return(length);
        }
Example #2
0
        //==============================================================================
        /// <summary>
        /// Creates a new script container. If one by this name already exists, then
        /// the existing one is removed.
        /// </summary>
        /// <param name="sScriptName">Name of the new script.</param>
        // N.Herrmann Feb 2007
        //==============================================================================
        public void createInitScript(string sScriptName)
        {
            int         index;
            TScriptSpec script;

            index = getScriptIndex(sScriptName);
            if (index >= 0)
            {
                scriptList.RemoveAt(index);
            }
            script              = new TScriptSpec();
            script.scriptName   = sScriptName;
            script.scriptText   = "";
            script.propertyList = new List <TScriptProperty>();
            scriptList.Add(script);
        }
Example #3
0
        //==============================================================================
        /// <summary>
        /// Returns the index to the script property from the search (case insensitive).
        /// </summary>
        /// <param name="script">The script to seearch.</param>
        /// <param name="sPropertyName">Property name to find.</param>
        /// <returns>The index in the propertyList array of the property. Returns
        /// -1 if not found</returns>
        // N.Herrmann Feb 2007
        //==============================================================================
        protected int getProperty(TScriptSpec script, string sPropertyName)
        {
            TScriptProperty prop;
            int             index = -1;

            int i = 0;

            while ((index < 0) && (i < script.propertyList.Count))
            {
                prop = script.propertyList[i];
                if (String.Compare(prop.name, sPropertyName, true) == 0)    //case insensitive
                {
                    index = i;
                }
                else
                {
                    i++;
                }
            }
            return(index);
        }