diff --git a/Source/Painting/SvgColourConverter.cs b/Source/Painting/SvgColourConverter.cs index 278f9d755a2359fce54ffd22f186c6a2fcd629d2..e36d2cf17452c91a799a773a462d849f5d6fd0c7 100644 --- a/Source/Painting/SvgColourConverter.cs +++ b/Source/Painting/SvgColourConverter.cs @@ -115,7 +115,7 @@ namespace Svg if (destinationType == typeof(string)) { var colour = (Color)value; - return ColorTranslator.ToHtml(colour); + return "#" + colour.R.ToString("X2", null) + colour.G.ToString("X2", null) + colour.B.ToString("X2", null); } return base.ConvertTo(context, culture, value, destinationType); diff --git a/Source/Paths/SvgPathBuilder.cs b/Source/Paths/SvgPathBuilder.cs index 793261e15376290d7bfcef5e54559d40f9b81600..7595c91dc2c09cab382da5cbcb1ed07c4b1f60f6 100644 --- a/Source/Paths/SvgPathBuilder.cs +++ b/Source/Paths/SvgPathBuilder.cs @@ -276,7 +276,7 @@ namespace Svg private static IEnumerable ParseCoordinates(string coords) { - var parts = Regex.Split(coords.Remove(0, 1), @"[\s,]|(?=(?> _propertyDescriptors = new Dictionary>(); + private static object syncLock = new object(); private static void SetPropertyValue(SvgElement element, string attributeName, string attributeValue, SvgDocument document) { var elementType = element.GetType(); PropertyDescriptorCollection properties; - if (_propertyDescriptors.Keys.Contains(elementType)) + lock (syncLock) { - if (_propertyDescriptors[elementType].Keys.Contains(attributeName)) + if (_propertyDescriptors.Keys.Contains(elementType)) { - properties = _propertyDescriptors[elementType][attributeName]; + if (_propertyDescriptors[elementType].Keys.Contains(attributeName)) + { + properties = _propertyDescriptors[elementType][attributeName]; + } + else + { + properties = TypeDescriptor.GetProperties(elementType, new[] { new SvgAttributeAttribute(attributeName) }); + _propertyDescriptors[elementType].Add(attributeName, properties); + } } else { properties = TypeDescriptor.GetProperties(elementType, new[] { new SvgAttributeAttribute(attributeName) }); - _propertyDescriptors[elementType].Add(attributeName, properties); - } - } - else - { - properties = TypeDescriptor.GetProperties(elementType, new[] { new SvgAttributeAttribute(attributeName) }); - _propertyDescriptors.Add(elementType, new Dictionary()); + _propertyDescriptors.Add(elementType, new Dictionary()); - _propertyDescriptors[elementType].Add(attributeName, properties); + _propertyDescriptors[elementType].Add(attributeName, properties); + } } if (properties.Count > 0)