Skip to content

Commit eb6eff9

Browse files
authored
Release 5.1.1 (#91)
* Bug fixes and code improvements - Fixed the issue #89 - Removed the private ControlLine class (no longer used as path is parsed with WPF parser) - Add IsDefault property to Fill and Stroke to make default fills and strokes known - Eliminated the 135, warning CA1416: This call site is reachable on all platforms. - Eliminated some "as" casts, with the new "is" syntax. * Updated Version Information
1 parent 545f36f commit eb6eff9

File tree

23 files changed

+308
-151
lines changed

23 files changed

+308
-151
lines changed

Docs/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ The respository includes
1515
* **Samples:** For sample applications
1616
* **Docs:** For the documentations (in markdown format).
1717

18-
The command lines installation options are: For the version `5.1.0`
19-
* **.NET CLI:** dotnet add package DotNetProjects.SVGImage --version 5.1.0
20-
* **Package Manager:** NuGet\Install-Package DotNetProjects.SVGImage -Version 5.1.0
18+
The command lines installation options are: For the version `5.1.1`
19+
* **.NET CLI:** dotnet add package DotNetProjects.SVGImage --version 5.1.1
20+
* **Package Manager:** NuGet\Install-Package DotNetProjects.SVGImage -Version 5.1.1
2121

22-
For reference in projects use: For the version `5.1.0`
22+
For reference in projects use: For the version `5.1.1`
2323
```xml
24-
<PackageReference Include="DotNetProjects.SVGImage" Version="5.1.0" />
24+
<PackageReference Include="DotNetProjects.SVGImage" Version="5.1.1" />
2525
```
2626

2727
## How to build

GitVersion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
next-version: 5.1.0
1+
next-version: 5.1.1

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ The respository includes
1515
* **Samples:** For sample applications
1616
* **Docs:** For the documentations (in markdown format).
1717

18-
The command lines installation options are: For the version `5.1.0`
19-
* **.NET CLI:** dotnet add package DotNetProjects.SVGImage --version 5.1.0
20-
* **Package Manager:** NuGet\Install-Package DotNetProjects.SVGImage -Version 5.1.0
18+
The command lines installation options are: For the version `5.1.1`
19+
* **.NET CLI:** dotnet add package DotNetProjects.SVGImage --version 5.1.1
20+
* **Package Manager:** NuGet\Install-Package DotNetProjects.SVGImage -Version 5.1.1
2121

22-
For reference in projects use: For the version `5.1.0`
22+
For reference in projects use: For the version `5.1.1`
2323
```xml
24-
<PackageReference Include="DotNetProjects.SVGImage" Version="5.1.0" />
24+
<PackageReference Include="DotNetProjects.SVGImage" Version="5.1.1" />
2525
```
2626

2727
## How to build

Samples/ClipArtViewer/ClipArtViewer.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@
3030
<PropertyGroup>
3131
<ApplicationIcon>ClipArtViewer.ico</ApplicationIcon>
3232
</PropertyGroup>
33+
<PropertyGroup>
34+
<DefineConstants Condition=" '$(TargetFramework)' == 'net40' ">$(DefineConstants);DOTNET40;NETFULL</DefineConstants>
35+
<DefineConstants Condition="$(TargetFramework.StartsWith('net45'))">$(DefineConstants);DOTNET45;NETFULL</DefineConstants>
36+
<DefineConstants Condition="$(TargetFramework.StartsWith('net46'))">$(DefineConstants);DOTNET46;NETFULL</DefineConstants>
37+
<DefineConstants Condition="$(TargetFramework.StartsWith('net47'))">$(DefineConstants);DOTNET47;NETFULL</DefineConstants>
38+
<DefineConstants Condition="$(TargetFramework.StartsWith('net48'))">$(DefineConstants);DOTNET48;NETFULL</DefineConstants>
39+
<DefineConstants Condition="$(TargetFramework.StartsWith('netcore'))">$(DefineConstants);NETCORE</DefineConstants>
40+
<DefineConstants Condition="$(TargetFramework.StartsWith('net6'))">$(DefineConstants);NETCORE;NETNEXT</DefineConstants>
41+
<DefineConstants Condition="$(TargetFramework.StartsWith('net7'))">$(DefineConstants);NETCORE;NETNEXT</DefineConstants>
42+
<DefineConstants Condition="$(TargetFramework.StartsWith('net8'))">$(DefineConstants);NETCORE;NETNEXT</DefineConstants>
43+
</PropertyGroup>
3344
<ItemGroup>
3445
<ProjectReference Include="..\..\Source\SVGImage\DotNetProjects.SVGImage.csproj" />
3546
</ItemGroup>

Samples/ClipArtViewer/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
using System.Runtime.InteropServices;
55
using System.Windows;
66

7+
#if NETNEXT
8+
[assembly: System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
9+
#endif
10+
711
// General Information about an assembly is controlled through the following
812
// set of attributes. Change these attribute values to modify the information
913
// associated with an assembly.

Samples/CustomBrushesExample/CustomBrushesExample.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@
2525
<PropertyGroup>
2626
<ApplicationIcon>CustomBrushesExample.ico</ApplicationIcon>
2727
</PropertyGroup>
28+
<PropertyGroup>
29+
<DefineConstants Condition=" '$(TargetFramework)' == 'net40' ">$(DefineConstants);DOTNET40;NETFULL</DefineConstants>
30+
<DefineConstants Condition="$(TargetFramework.StartsWith('net45'))">$(DefineConstants);DOTNET45;NETFULL</DefineConstants>
31+
<DefineConstants Condition="$(TargetFramework.StartsWith('net46'))">$(DefineConstants);DOTNET46;NETFULL</DefineConstants>
32+
<DefineConstants Condition="$(TargetFramework.StartsWith('net47'))">$(DefineConstants);DOTNET47;NETFULL</DefineConstants>
33+
<DefineConstants Condition="$(TargetFramework.StartsWith('net48'))">$(DefineConstants);DOTNET48;NETFULL</DefineConstants>
34+
<DefineConstants Condition="$(TargetFramework.StartsWith('netcore'))">$(DefineConstants);NETCORE</DefineConstants>
35+
<DefineConstants Condition="$(TargetFramework.StartsWith('net6'))">$(DefineConstants);NETCORE;NETNEXT</DefineConstants>
36+
<DefineConstants Condition="$(TargetFramework.StartsWith('net7'))">$(DefineConstants);NETCORE;NETNEXT</DefineConstants>
37+
<DefineConstants Condition="$(TargetFramework.StartsWith('net8'))">$(DefineConstants);NETCORE;NETNEXT</DefineConstants>
38+
</PropertyGroup>
2839
<ItemGroup>
2940
<ProjectReference Include="..\..\Source\SVGImage\DotNetProjects.SVGImage.csproj" />
3041
</ItemGroup>

Samples/CustomBrushesExample/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
using System.Runtime.InteropServices;
55
using System.Windows;
66

7+
#if NETNEXT
8+
[assembly: System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
9+
#endif
10+
711
// General Information about an assembly is controlled through the following
812
// set of attributes. Change these attribute values to modify the information
913
// associated with an assembly.

Samples/Example/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
using System.Runtime.InteropServices;
55
using System.Windows;
66

7+
#if NETNEXT
8+
[assembly: System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
9+
#endif
10+
711
// General Information about an assembly is controlled through the following
812
// set of attributes. Change these attribute values to modify the information
913
// associated with an assembly.

Samples/IconConverterSample/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
using System.Runtime.InteropServices;
55
using System.Windows;
66

7+
#if NETNEXT
8+
[assembly: System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
9+
#endif
10+
711
// General Information about an assembly is controlled through the following
812
// set of attributes. Change these attribute values to modify the information
913
// associated with an assembly.

Source/SVGImage/DotNetProjects.SVGImage.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<Product>DotNetProjects.SVGImage</Product>
1212
<Copyright>2020-2023 DotNetProjects</Copyright>
1313
<PackageLicenseExpression>MIT</PackageLicenseExpression>
14-
<AssemblyVersion>5.1.0.0</AssemblyVersion>
15-
<FileVersion>5.1.0.0</FileVersion>
16-
<Version>5.1.0</Version>
14+
<AssemblyVersion>5.1.1.0</AssemblyVersion>
15+
<FileVersion>5.1.1.0</FileVersion>
16+
<Version>5.1.1</Version>
1717
<OutputType>Library</OutputType>
1818
<Configurations>Debug;Release</Configurations>
1919
</PropertyGroup>
@@ -31,7 +31,7 @@
3131
<PackageReadmeFile>Readme.md</PackageReadmeFile>
3232
<EnablePackageValidation>true</EnablePackageValidation>
3333
<!-- NOTE: Detect breaking changes from a previous version -->
34-
<PackageValidationBaselineVersion>5.0.118</PackageValidationBaselineVersion>
34+
<PackageValidationBaselineVersion>5.1.0</PackageValidationBaselineVersion>
3535
</PropertyGroup>
3636

3737
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

Source/SVGImage/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
using System.Windows;
33
using System.Windows.Markup;
44

5+
#if NETNEXT
6+
[assembly: System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
7+
#endif
8+
59
//In order to begin building localizable applications, set
610
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
711
//inside a <PropertyGroup>. For example, if you are using US english

Source/SVGImage/SVG/Fill.cs

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Windows;
1+
using System.Diagnostics;
2+
using System.Windows;
23
using System.Windows.Media;
34

45
namespace SVGImage.SVG
@@ -14,16 +15,66 @@ public enum eFillRule
1415
evenodd
1516
}
1617

17-
public eFillRule FillRule { get; set;}
18+
private SVG _svg;
1819

19-
public string PaintServerKey {get; set;}
20+
private bool _isDefault;
2021

21-
public double Opacity {get; set;}
22+
private eFillRule _fillRule;
23+
24+
private string _paintServerKey;
25+
26+
private double _opacity;
2227

2328
public Fill(SVG svg)
2429
{
25-
this.FillRule = eFillRule.nonzero;
26-
this.Opacity = 100;
30+
_fillRule = eFillRule.nonzero;
31+
_opacity = 100;
32+
_isDefault = false;
33+
_svg = svg;
34+
}
35+
36+
public static Fill CreateDefault(SVG svg, string fillColor)
37+
{
38+
var fill = new Fill(svg);
39+
fill.PaintServerKey = svg.PaintServers.Parse(fillColor);
40+
41+
fill._isDefault = true;
42+
43+
return fill;
44+
}
45+
46+
public SVG get => _svg;
47+
48+
public bool IsDefault
49+
{
50+
get => _isDefault;
51+
set => _isDefault = value;
52+
}
53+
54+
public eFillRule FillRule {
55+
get => _fillRule;
56+
set {
57+
Debug.Assert(_isDefault == false);
58+
_fillRule = value;
59+
}
60+
}
61+
62+
public string PaintServerKey
63+
{
64+
get => _paintServerKey;
65+
set {
66+
Debug.Assert(_isDefault == false);
67+
_paintServerKey = value;
68+
}
69+
}
70+
71+
public double Opacity
72+
{
73+
get => _opacity;
74+
set {
75+
Debug.Assert(_isDefault == false);
76+
_opacity = value;
77+
}
2778
}
2879

2980
public bool IsEmpty(SVG svg)

Source/SVGImage/SVG/PaintServers/PaintServerManager.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ private string ParseKnownColor(string value)
244244

245245
private static void LoadKnownColors()
246246
{
247-
if (m_knownColors == null) m_knownColors = new Dictionary<string, Color>();
247+
if (m_knownColors == null)
248+
m_knownColors = new Dictionary<string, Color>(StringComparer.OrdinalIgnoreCase);
248249
if (m_knownColors.Count == 0)
249250
{
250251
PropertyInfo[] propinfos = typeof(Colors).GetProperties(BindingFlags.Public | BindingFlags.Static);

0 commit comments

Comments
 (0)