Пример #1
0
        static public string evalRef(string refer, out bool found)
        {
            string value = null;

            found = false;
            Variables vars = Variables.getOnly();
            string    data = null;
            // is there a '.' ?
            int dot = refer.IndexOf('.');

            if (-1 == dot)
            {             // no dot, get the default data or function value
                value = vars.get(refer);
            }
            else
            {                                            // has a dot, so split it and get the parts.
                string refer2 = refer.Substring(0, dot);
                try { data = refer.Substring(dot + 1); } // don't take the dot
                catch (ArgumentOutOfRangeException)
                { data = null; }
                value = vars.getDotted(refer2, data);
            }
            if (value == null)
            {
                return(refer);                           // not a reference
            }
            found = true;
            return(value);
        }
Пример #2
0
        /// <summary>
        /// Read the var nodes from the model and add them as vars.
        /// </summary>
        private void ReadModelVars()
        {
            XmlNodeList vars = m_guiModel.SelectNodes("var");

            if (vars != null)
            {
                Variables varlist = Variables.getOnly();
                foreach (XmlNode varNode in vars)
                {
                    XmlNode id  = varNode.Attributes["id"];
                    XmlNode set = varNode.Attributes["set"];
                    varlist.add(id.Value, set.Value);
                }
            }
        }