Exemplo n.º 1
0
        /// <summary>
        /// Constructor. Builds the item from a list of properties and values.
        /// </summary>
        /// <param name="properties">Properties used to format the values.</param>
        /// <param name="values">Raw item as read from XML.</param>
        internal Item(
            ItemProperty[] properties,
            XmlItemSerialization.Item xmlItem)
        {
            tagValue = xmlItem.TagValue;
            name = xmlItem.Name;
            brand = xmlItem.Brand;

            int numProperties = properties.Length;
            values = new object[numProperties];

            if (xmlItem.ItemValues != null)
            {
                for (int index = 0; index < numProperties; ++index)
                {
                    foreach (XmlItemSerialization.ItemValue xmlValue in xmlItem.ItemValues)
                    {
                        if (xmlValue.Name == properties[index].Name)
                        {
                            values[index] = Parse(xmlValue.Value, properties[index].PropertyType);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor. Builds the item from raw XML data.
 /// </summary>
 /// <param name="xmlProperty"></param>
 internal ItemProperty(XmlItemSerialization.ItemProperty xmlProperty)
 {
     brand = xmlProperty.Brand;
     name = xmlProperty.Name;
     propertyType = xmlProperty.PropertyType;
 }