Exemplo n.º 1
0
        //=======================================================================
        /// <summary>
        /// Initialise the list of properties with values from the init section
        /// SDML.
        /// </summary>
        /// <param name="initXML">The init section which is <code><initsection>...</initsection></code></param>
        //=======================================================================
        private Boolean InitFromInitSection(String initXML)
        {
            if (initXML.Length > 0)
            {
                typedvals.Clear();
                TInitParser initPsr = new TInitParser(initXML);

                for (int i = 1; i <= initPsr.initCount(); i++)
                {
                    String     initText = initPsr.initText((uint)i);
                    TSDMLValue sdmlinit = new TSDMLValue(initText, "");
                    typedvals.Add(sdmlinit);

                    if (sdmlinit.Name == "rules")
                    {
                        StringBuilder str = new StringBuilder();
                        for (uint line = 1; line <= sdmlinit.count(); line++)
                        {
                            str.Append(sdmlinit.item(line).asStr() + "\n");
                        }
                        Highlight(str.ToString());
                    }
                    if (sdmlinit.Name == "logfile")
                    {
                        textBox1.Text     = sdmlinit.asStr();
                        checkBox1.Checked = (textBox1.Text.Length > 0);
                    }
                    if (sdmlinit.Name == "log_set")
                    {
                    }
                }
            }
            return(initXML.Length > 0);
        }
Exemplo n.º 2
0
        //=======================================================================
        /// <summary>
        /// Initialise the lists of properties with values from the init section
        /// SDML. And reload the tree with the values.
        /// </summary>
        /// <param name="initXML">The init section which is <code><initsection>...</initsection></code></param>
        //=======================================================================
        private Boolean InitFromInitSection(String initXML)
        {
            if (initXML.Length > 0)
            {
                typedvals.Clear();
                TInitParser initPsr = new TInitParser(initXML);

                for (int i = 1; i <= initPsr.initCount(); i++)
                {
                    String     initText = initPsr.initText((uint)i);
                    TSDMLValue sdmlinit = new TSDMLValue(initText, "");
                    typedvals.Add(sdmlinit);
                }
            }
            //if the component description is valid then use it.
            if (propertyList.Count > 0)
            {
                foreach (TTypedValue value in typedvals)    //for every init section value
                {
                    //find the property in the component description list
                    int           i    = 0;
                    TCompProperty prop = propertyList[i];
                    while ((prop != null) && (i < propertyList.Count))
                    {
                        if (value.Name.ToLower() == prop.Name.ToLower())
                        {
                            prop.InitValue.setValue(value); //set the property's value
                        }
                        i++;
                        if (i < propertyList.Count)
                        {
                            prop = propertyList[i];
                        }
                    }
                }
            }
            if (propertyList.Count > 0)
            {
                populateTreeModel(propertyList);            //can populate with the full list
            }
            else
            {
                populateTreeModel();                        //use init section only
            }
            return((initXML.Length > 0) || (propertyList.Count > 0));
        }