private static PropertyDocument MakeAttributeDocument(Property property) { PropertyDocument propertyDocument = new PropertyDocument() { name = property.Name, value = property.Value, type_name = property.Type.FullName, type_assembly = property.Type.Assembly.GetName().Name }; return(propertyDocument); }
private static Property ParseProperty(PropertyDocument propertyDocument) { string typeString = propertyDocument.type_name; if (propertyDocument.type_assembly != null && !"".Equals(propertyDocument.type_assembly)) { typeString = $"{propertyDocument.type_name}, {propertyDocument.type_assembly}"; } // TODO future Make YAML parser do the conversion. Otherwise only string to class conversions are supported which is insufficient for complex types //Type? type = Type.GetType(typeString); //if(type == null) throw new ArgumentException($"Parsed type {propertyDocument.type_name} cannot be converted to System.Type!"); //var converter = TypeDescriptor.GetConverter(type); //var result = converter.ConvertFrom(propertyDocument.value); return(new Property(propertyDocument.name, propertyDocument.value)); }