in Source/CustomMapStyleManager.cs [199:255]
private static void ExtractPropertyInfo(string shortName, object obj, StringBuilder writer)
{
var prop = obj.GetType().GetRuntimeProperties();
object propertyValue;
string shortProperty;
bool foundProperty = false;
foreach (var p in prop)
{
if (_propertyMapping.ContainsKey(p.Name))
{
//Find the abbreviation for the property
shortProperty = _propertyMapping[p.Name];
if (!string.IsNullOrWhiteSpace(shortProperty)){
propertyValue = p.GetValue(obj, null);
if (propertyValue != null)
{
string stringValue;
//If it's a boolean value, we want to just map it to a 1 or 0 (1 for true, 0 for false)
if (propertyValue is bool)
{
stringValue = ((bool)propertyValue) ? "1" : "0";
}
else
{
// otherwise, it's a color, lets get the hex value of it
stringValue = GetValidHexColor((string)propertyValue, false);
}
if (!string.IsNullOrEmpty(stringValue))
{
if (!foundProperty)
{
if (writer.Length > 0)
{
writer.Append('_');
}
writer.AppendFormat("{0}|", shortName);
foundProperty = true;
}
else
{
writer.Append(';');
}
writer.AppendFormat("{0}:{1}", shortProperty, stringValue);
}
}
}
}
}
}