private void ReadProperty(PropertyInfo property) { XmlNode node = game.Overlayer.SelectNode(overlayName, property.Name); if (node == null) return; object value = property.ConvertToCompatibleValueFast(node.InnerText); property.SetValue(this, value, null); }
/// <summary> /// Does the property have a default value as specified in the overlay file? /// Creates garbage, so only call when serializing out. /// </summary> protected bool IsDefault(PropertyInfo property) { string defaultTypeName = GetType().FullName + ".Default"; XmlNode node = game.Overlayer.SelectNode(defaultTypeName, property.Name); if (node == null) return false; string propertyValueDefaultString = node.InnerText; object propertyValueDefault = property.ConvertToCompatibleValueFast(propertyValueDefaultString); object propertyValue = property.GetValue(this, null); if (propertyValue == null) return propertyValue == propertyValueDefault; return propertyValue.Equals(propertyValueDefault); }