Exemple #1
0
        internal virtual void _Load <_ValueType>()
        {
            // Even if nodes are to be ordered same as in the section read from file,
            // users may haveed ited the file and re-ordered those. So ensure proper ordering.
            // And as we're using Linq already, lets filter out comments and other 'junk'.
            var sorted = _node.ChildNodes.Cast <XmlNode>()
                         .Where((node) => node is XmlElement)
                         .OrderBy((node) => int.Parse(node.Attributes["id"].InnerText));

            _values = new List <_ValueType>(sorted.Count());
            foreach (XmlNode node in sorted)
            {
                if (node.Name != "entry")
                {
                    throw new Exception("EXPECTED 'entry' ELEMENT!");
                }
                // Find better way of converting
                _ValueType value = (_ValueType)Convert.ChangeType(node.InnerText, typeof(_ValueType));
                _values.Add(value);
            }
        }
 internal static bool Parse(string text, out _ValueType value)
 {
     value = default(_ValueType);
     return(false);
 }
 internal static bool Within(_ValueType value, _ValueType min, _ValueType max)
 {
     return(true);
     //return (min.CompareTo(value) <= 0) && (value.CompareTo(max) <= 0);
 }
 internal static string Format(_ValueType value)
 {
     return(value.ToString());
 }