Esempio n. 1
0
    public virtual bool LoadXML(System.Xml.XmlElement ele, Dictionary <string, LLDNBase> directory)
    {
        foreach (System.Xml.XmlElement ch in ele)
        {
            ParamBase.Type ty = ParamBase.FromSerializationType(ch.Name);
            if (ty == ParamBase.Type.Invalid)
            {
                continue;
            }

            System.Xml.XmlAttribute attrName = ch.Attributes["name"];
            if (attrName == null)
            {
                continue;
            }

            string    paramName = attrName.Value;
            ParamBase pb        = this.GetParam(paramName, ty);
            if (pb == null)
            {
                continue;
            }

            pb.SetValueFromString(ch.InnerText, directory);
        }

        return(true);
    }
Esempio n. 2
0
    public virtual bool LoadXML(System.Xml.XmlElement ele)
    {
        foreach (System.Xml.XmlElement ch in ele)
        {
            ParamBase.Type ty = ParamBase.FromSerializationType(ch.Name);
            if (ty == ParamBase.Type.Invalid)
            {
                continue;
            }

            System.Xml.XmlAttribute attrName = ch.Attributes["name"];
            if (attrName == null)
            {
                continue;
            }

            string    paramName = attrName.Value;
            ParamBase pb        = this.GetParam(paramName, ty);
            if (pb == null)
            {
                continue;
            }

            pb.SetValueFromString(ch.InnerText);

            System.Xml.XmlAttribute attrViz = ch.Attributes["visible"];
            if (attrViz != null)
            {
                pb.visible = ParamBool.ConvertFromString(attrViz.Value);
            }
        }
        return(true);
    }
Esempio n. 3
0
    /// <summary>
    /// Get a parameter of a specified type and name.
    /// </summary>
    /// <param name="name">The name of the parameter to retrive.</param>
    /// <param name="ty">The required type of the parameter to retrive.</param>
    /// <returns>The found parameter, or null if none was found.</returns>
    public ParamBase GetParam(string name, ParamBase.Type ty)
    {
        foreach (ParamBase pb in this.genParams)
        {
            if (string.Equals(pb.name, name, System.StringComparison.OrdinalIgnoreCase) == false)
            {
                continue;
            }

            if (pb.type != ty)
            {
                continue;
            }

            return(pb);
        }

        return(null);
    }