void SetMemberValue(XPBaseObject selectedObject, IClassInfoGraphNode classInfoGraphNode, XElement propertyElement) { var xpMemberInfo = selectedObject.ClassInfo.FindMember(classInfoGraphNode.Name); if (xpMemberInfo != null) { var memberValue = selectedObject.GetMemberValue(classInfoGraphNode.Name); if (xpMemberInfo.Converter != null) { memberValue = (xpMemberInfo.Converter.ConvertToStorageType(memberValue)); } if (memberValue is byte[]) { memberValue = Convert.ToBase64String((byte[])memberValue); } if (memberValue is DateTime) { memberValue = ((DateTime)memberValue).Ticks; } if (memberValue is string) { memberValue = IAFModule.SanitizeXmlString((string)memberValue); propertyElement.Add(new XCData(memberValue.ToString())); } else { propertyElement.Value = GetInvariantValue(memberValue); } } }
void SetMemberValue(ITypeInfo typeInfo, object theObject, IClassInfoGraphNode classInfoGraphNode, XElement propertyElement) { var memberInfo = typeInfo.FindMember(classInfoGraphNode.Name); if (memberInfo != null) { var memberValue = memberInfo.GetValue(theObject); var valueConverter = memberInfo.FindAttribute <ValueConverterAttribute>(); if (valueConverter != null) { memberValue = (valueConverter.Converter.ConvertToStorageType(memberValue)); } if (memberValue is byte[]) { memberValue = Convert.ToBase64String((byte[])memberValue); } if (memberValue is DateTime) { memberValue = ((DateTime)memberValue).Ticks; } if ((_minifyOutput && !memberInfo.HasDefaultValue(memberValue)) || !_minifyOutput) { if (memberValue is string) { memberValue = IAFModule.SanitizeXmlString((string)memberValue); propertyElement.Add(new XCData(memberValue.ToString())); } else { propertyElement.Value = GetInvariantValue(memberValue); } } else { propertyElement.Remove(); } } }