зеркало из https://github.com/wieslawsoltes/SVG.git
Main Project Cleanup (#1123)
* Main Project Cleanup - Clean up of the main source code project - Removed irrelevant files - Added support for .NET 4.7, .NET 4.8 - Removed preprocessor to enable events registration for all - Updates to the SvgOptions class to support property attributes * Untabify the project files - Applying the default "Format Document" introduces the tabs! * Restore the default interpolation mode of the GDI+ rendererer - Set the default mode to InterpolationMode.Default * Further clean up - Removed NuGet project files and folder - Removed non-existence folder: <Folder Include="Web\Resources\" /> * Removed the commented Enums static class - Enums no longer needed.
This commit is contained in:
Родитель
94b8e3101a
Коммит
18cb5e45fe
|
@ -5,6 +5,13 @@
|
|||
<TargetFrameworks>netcoreapp3.1;net462</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS1591;CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Source\Svg.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -8,6 +8,13 @@
|
|||
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS1591;CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Source\Svg.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -8,6 +8,13 @@
|
|||
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS1591;CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Source\Svg.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -15,6 +15,13 @@
|
|||
<PublishReadyToRun>False</PublishReadyToRun>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS1591;CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Source\Svg.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -5,6 +5,13 @@
|
|||
<TargetFrameworks>netcoreapp3.1;net462</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS1591;CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Source\Svg.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -219,22 +219,4 @@ namespace Svg
|
|||
public sealed class SvgStitchTypeConverter : EnumBaseConverter<SvgStitchType> { }
|
||||
|
||||
public sealed class SvgTurbulenceTypeConverter : EnumBaseConverter<SvgTurbulenceType> { }
|
||||
|
||||
public static class Enums
|
||||
{
|
||||
[CLSCompliant(false)]
|
||||
public static bool TryParse<TEnum>(string value, out TEnum result) where TEnum : struct, IConvertible
|
||||
{
|
||||
try
|
||||
{
|
||||
result = (TEnum)Enum.Parse(typeof(TEnum), value, true);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = default(TEnum);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,12 +37,8 @@ namespace Svg.DataTypes
|
|||
throw new ArgumentOutOfRangeException("value is not a member of SvgPreserveAspectRatio");
|
||||
}
|
||||
|
||||
#if Net4
|
||||
if (!Enum.TryParse<SvgPreserveAspectRatio>(sParts[nAlignIndex], out eAlign))
|
||||
if (!Enum.TryParse(sParts[nAlignIndex], out eAlign))
|
||||
throw new ArgumentOutOfRangeException("value is not a member of SvgPreserveAspectRatio");
|
||||
#else
|
||||
eAlign = (SvgPreserveAspectRatio)Enum.Parse(typeof(SvgPreserveAspectRatio), sParts[nAlignIndex]);
|
||||
#endif
|
||||
|
||||
nAlignIndex++;
|
||||
|
||||
|
|
|
@ -54,11 +54,8 @@ namespace Svg
|
|||
// (e.g., 'M 100 100 L 200 200' contains unnecessary spaces and could be expressed more compactly as 'M100 100L200 200')."
|
||||
// http://www.w3.org/TR/SVGTiny12/paths.html#PathDataGeneralInformation
|
||||
// https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#Notes
|
||||
#if Net4
|
||||
|
||||
return string.Join(" ", this.Select(u => u.ToString()));
|
||||
#else
|
||||
return string.Join(" ", this.Select(u => u.ToString()).ToArray());
|
||||
#endif
|
||||
}
|
||||
|
||||
public static bool IsNullOrEmpty(SvgUnitCollection collection)
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<TestSettings name="Local" id="616d39c5-86e4-40f8-97e9-b8a423ce7322" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
|
||||
<Description>These are default test settings for a local test run.</Description>
|
||||
<Deployment enabled="false" />
|
||||
<Execution>
|
||||
<TestTypeSpecific />
|
||||
<AgentRule name="Execution Agents">
|
||||
</AgentRule>
|
||||
</Execution>
|
||||
</TestSettings>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
|
|
@ -135,7 +135,7 @@ namespace Svg
|
|||
g.CompositingQuality = CompositingQuality.HighQuality;
|
||||
g.TextRenderingHint = TextRenderingHint.AntiAlias;
|
||||
g.TextContrast = 1;
|
||||
g.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
g.InterpolationMode = InterpolationMode.Default;
|
||||
return g;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net6.0;netcoreapp3.1;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
|
||||
<TargetFrameworks>net6.0;netcoreapp3.1;netstandard2.1;netstandard2.0;net462;net472;net481</TargetFrameworks>
|
||||
<PackageLicenseExpression>MS-PL</PackageLicenseExpression>
|
||||
<RootNamespace>Svg</RootNamespace>
|
||||
<AssemblyName>Svg</AssemblyName>
|
||||
|
@ -11,24 +11,23 @@
|
|||
<Product>SVG Rendering Library</Product>
|
||||
<Summary>SVG Rendering Library</Summary>
|
||||
<Description>
|
||||
Public fork of the C# SVG rendering library on codeplex: https://svg.codeplex.com/
|
||||
Public fork of the C# SVG rendering library on codeplex.
|
||||
This started out as a minor modification to enable the writing of proper SVG strings. But now after almost two years we have so many fixes and improvements that we decided to share our current codebase to the public in order to improve it even further.
|
||||
So please feel free to fork it and open pull requests for any fix, improvement or feature you add.
|
||||
License: Microsoft Public License: https://svg.codeplex.com/license
|
||||
License: Microsoft Public License.
|
||||
</Description>
|
||||
<Copyright>Copyright © vvvv.org</Copyright>
|
||||
<Tags>svg, vector graphics, rendering</Tags>
|
||||
<ProjectGuid>{886A98C5-37C0-4E8B-885E-30C1D2F98B47}</ProjectGuid>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<NoWarn>1591</NoWarn>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>svgkey.snk</AssemblyOriginatorKeyFile>
|
||||
<PackageTags>svg, vector graphics, rendering</PackageTags>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||
<PackageReleaseNotes>Fixed a regression in loading embedded images (see Release Notes: http://svg-net.github.io/SVG/doc/ReleaseNotes.html).
|
||||
<PackageReleaseNotes>
|
||||
Fixed a regression in loading embedded images (see Release Notes: http://svg-net.github.io/SVG/doc/ReleaseNotes.html).
|
||||
</PackageReleaseNotes>
|
||||
<PackageProjectUrl>https://github.com/svg-net/SVG</PackageProjectUrl>
|
||||
<PackageIconUrl>https://www.w3.org/Icons/SVG/svg-logo-v.png</PackageIconUrl>
|
||||
|
@ -41,49 +40,98 @@
|
|||
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\$(Configuration)\$(TargetFramework)\GeneratedFiles</CompilerGeneratedFilesOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<NoWarn>$(NoWarn);CS0618;NETSDK1138</NoWarn>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<NoWarn>$(NoWarn);CS1591;CS0618;NETSDK1138</NoWarn>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('net46'))">$(DefineConstants);DOTNET46;NETFULL</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('net47'))">$(DefineConstants);DOTNET47;NETFULL</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('net48'))">$(DefineConstants);DOTNET48;NETFULL</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('netstandard'))">$(DefineConstants);NETSTANDARD</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('netcore'))">$(DefineConstants);NETCORE</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('net6'))">$(DefineConstants);NETCORE;NETNEXT</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('net7'))">$(DefineConstants);NETCORE;NETNEXT</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('net8'))">$(DefineConstants);NETCORE;NETNEXT</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\svg11.dtd" />
|
||||
<Folder Include="Web\Resources\" />
|
||||
<None Include="Basic Shapes\DOM.cd" />
|
||||
<None Include="svgkey.snk" />
|
||||
<None Include="svg-logo-v.png" Pack="true" PackagePath="" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net462'">
|
||||
<Title>Svg for .Net Framework 4.6.2</Title>
|
||||
<DefineConstants>$(DefineConstants);NETFULL;Net4</DefineConstants>
|
||||
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove=".\Resources\svg11.dtd" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='net462'">
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'netstandard2.1' Or '$(TargetFramework)' == 'netcoreapp2.1' Or '$(TargetFramework)' == 'netcoreapp3.1' Or '$(TargetFramework)' == 'net6.0'">
|
||||
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'net462'">
|
||||
<PackageReference Include="System.Memory" Version="4.5.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Mac specific include -->
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<PackageReference Include="System.Memory" Version="4.5.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' Or '$(TargetFramework)' == 'netcoreapp3.1' Or '$(TargetFramework)' == 'net6.0'">
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net481'">
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<PackageReference Include="System.Memory" Version="4.5.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
|
||||
<PackageReference Include="System.Memory" Version="4.5.5" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
|
||||
<!-- Mac specific include -->
|
||||
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="5.8.64" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove=".\Resources\svg11.dtd" />
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
|
||||
<!-- Mac specific include -->
|
||||
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
|
||||
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="5.8.64" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
|
||||
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
|
||||
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
|
||||
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<package >
|
||||
<metadata>
|
||||
<id>$id$</id>
|
||||
<version>$version$</version>
|
||||
<title>$title$</title>
|
||||
<authors>$author$</authors>
|
||||
<owners>$author$</owners>
|
||||
</metadata>
|
||||
</package>
|
|
@ -1,2 +0,0 @@
|
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Fizzler/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
|
||||
<TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
|
||||
<RunConfiguration id="616d39c5-86e4-40f8-97e9-b8a423ce7322" name="Local" storage="local.testsettings" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</TestList>
|
||||
</TestLists>
|
|
@ -35,8 +35,7 @@ namespace Svg
|
|||
/// <param name="specificity">The specificity value.</param>
|
||||
public void AddStyle(string name, string value, int specificity)
|
||||
{
|
||||
SortedDictionary<int, string> rules;
|
||||
if (!_styles.TryGetValue(name, out rules))
|
||||
if (!_styles.TryGetValue(name, out SortedDictionary<int, string> rules))
|
||||
{
|
||||
rules = new SortedDictionary<int, string>();
|
||||
_styles[name] = rules;
|
||||
|
@ -71,21 +70,19 @@ namespace Svg
|
|||
|
||||
public bool ContainsAttribute(string name)
|
||||
{
|
||||
SortedDictionary<int, string> rules;
|
||||
return (this.Attributes.ContainsKey(name) || this.CustomAttributes.ContainsKey(name) ||
|
||||
(_styles.TryGetValue(name, out rules)) && (rules.ContainsKey(StyleSpecificity_InlineStyle) || rules.ContainsKey(StyleSpecificity_PresAttribute)));
|
||||
(_styles.TryGetValue(name, out SortedDictionary<int, string> rules))
|
||||
&& (rules.ContainsKey(StyleSpecificity_InlineStyle) || rules.ContainsKey(StyleSpecificity_PresAttribute)));
|
||||
}
|
||||
public bool TryGetAttribute(string name, out string value)
|
||||
{
|
||||
object objValue;
|
||||
if (this.Attributes.TryGetValue(name, out objValue))
|
||||
if (this.Attributes.TryGetValue(name, out object objValue))
|
||||
{
|
||||
value = objValue.ToString();
|
||||
return true;
|
||||
}
|
||||
if (this.CustomAttributes.TryGetValue(name, out value)) return true;
|
||||
SortedDictionary<int, string> rules;
|
||||
if (_styles.TryGetValue(name, out rules))
|
||||
if (_styles.TryGetValue(name, out SortedDictionary<int, string> rules))
|
||||
{
|
||||
// Get staged styles that are
|
||||
if (rules.TryGetValue(StyleSpecificity_InlineStyle, out value)) return true;
|
||||
|
@ -597,8 +594,7 @@ namespace Svg
|
|||
if (writeStyle && propertyValue == SvgPaintServer.NotSet)
|
||||
continue;
|
||||
|
||||
object parentValue;
|
||||
if (TryResolveParentAttributeValue(property.AttributeName, out parentValue))
|
||||
if (TryResolveParentAttributeValue(property.AttributeName, out object parentValue))
|
||||
{
|
||||
if ((parentValue == propertyValue)
|
||||
|| ((parentValue != null) && parentValue.Equals(propertyValue)))
|
||||
|
@ -690,7 +686,7 @@ namespace Svg
|
|||
return styles;
|
||||
}
|
||||
|
||||
private void WriteAttributeString(XmlWriter writer, string name, string ns, string value)
|
||||
private static void WriteAttributeString(XmlWriter writer, string name, string ns, string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ns))
|
||||
writer.WriteAttributeString(name, value);
|
||||
|
@ -912,7 +908,6 @@ namespace Svg
|
|||
onmouseout = "<anything>"
|
||||
*/
|
||||
|
||||
#if Net4
|
||||
/// <summary>
|
||||
/// Use this method to provide your implementation ISvgEventCaller which can register Actions
|
||||
/// and call them if one of the events occurs. Make sure, that your SvgElement has a unique ID.
|
||||
|
@ -925,12 +920,12 @@ namespace Svg
|
|||
{
|
||||
var rpcID = this.ID + "/";
|
||||
|
||||
caller.RegisterAction<float, float, int, int, bool, bool, bool, string>(rpcID + "onclick", CreateMouseEventAction(RaiseMouseClick));
|
||||
caller.RegisterAction<float, float, int, int, bool, bool, bool, string>(rpcID + "onmousedown", CreateMouseEventAction(RaiseMouseDown));
|
||||
caller.RegisterAction<float, float, int, int, bool, bool, bool, string>(rpcID + "onmouseup", CreateMouseEventAction(RaiseMouseUp));
|
||||
caller.RegisterAction<float, float, int, int, bool, bool, bool, string>(rpcID + "onmousemove", CreateMouseEventAction(RaiseMouseMove));
|
||||
caller.RegisterAction<float, float, int, int, bool, bool, bool, string>(rpcID + "onmouseover", CreateMouseEventAction(RaiseMouseOver));
|
||||
caller.RegisterAction<float, float, int, int, bool, bool, bool, string>(rpcID + "onmouseout", CreateMouseEventAction(RaiseMouseOut));
|
||||
caller.RegisterAction(rpcID + "onclick", CreateMouseEventAction(RaiseMouseClick));
|
||||
caller.RegisterAction(rpcID + "onmousedown", CreateMouseEventAction(RaiseMouseDown));
|
||||
caller.RegisterAction(rpcID + "onmouseup", CreateMouseEventAction(RaiseMouseUp));
|
||||
caller.RegisterAction(rpcID + "onmousemove", CreateMouseEventAction(RaiseMouseMove));
|
||||
caller.RegisterAction(rpcID + "onmouseover", CreateMouseEventAction(RaiseMouseOver));
|
||||
caller.RegisterAction(rpcID + "onmouseout", CreateMouseEventAction(RaiseMouseOut));
|
||||
caller.RegisterAction<int, bool, bool, bool, string>(rpcID + "onmousescroll", OnMouseScroll);
|
||||
}
|
||||
}
|
||||
|
@ -954,7 +949,6 @@ namespace Svg
|
|||
caller.UnregisterAction(rpcID + "onmouseout");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[SvgAttribute("onclick")]
|
||||
public event EventHandler<MouseArg> Click;
|
||||
|
@ -977,13 +971,11 @@ namespace Svg
|
|||
[SvgAttribute("onmouseout")]
|
||||
public event EventHandler<MouseArg> MouseOut;
|
||||
|
||||
#if Net4
|
||||
protected Action<float, float, int, int, bool, bool, bool, string> CreateMouseEventAction(Action<object, MouseArg> eventRaiser)
|
||||
{
|
||||
return (x, y, button, clickCount, altKey, shiftKey, ctrlKey, sessionID) =>
|
||||
eventRaiser(this, new MouseArg { x = x, y = y, Button = button, ClickCount = clickCount, AltKey = altKey, ShiftKey = shiftKey, CtrlKey = ctrlKey, SessionID = sessionID });
|
||||
}
|
||||
#endif
|
||||
|
||||
//click
|
||||
protected void RaiseMouseClick(object sender, MouseArg e)
|
||||
|
@ -1093,7 +1085,6 @@ namespace Svg
|
|||
public SvgElement BeforeSibling;
|
||||
}
|
||||
|
||||
#if Net4
|
||||
//deriving class registers event actions and calls the actions if the event occurs
|
||||
public interface ISvgEventCaller
|
||||
{
|
||||
|
@ -1108,7 +1099,6 @@ namespace Svg
|
|||
void RegisterAction<T1, T2, T3, T4, T5, T6, T7, T8>(string rpcID, Action<T1, T2, T3, T4, T5, T6, T7, T8> action);
|
||||
void UnregisterAction(string rpcID);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Represents the state of the mouse at the moment the event occured.
|
||||
|
|
|
@ -334,17 +334,17 @@ namespace Svg
|
|||
switch (state)
|
||||
{
|
||||
case FontParseState.fontStyle:
|
||||
success = Enums.TryParse(part, out fontStyle);
|
||||
success = Enum.TryParse(part, out fontStyle);
|
||||
if (success) FontStyle = fontStyle;
|
||||
state++;
|
||||
break;
|
||||
case FontParseState.fontVariant:
|
||||
success = Enums.TryParse(part, out fontVariant);
|
||||
success = Enum.TryParse(part, out fontVariant);
|
||||
if (success) FontVariant = fontVariant;
|
||||
state++;
|
||||
break;
|
||||
case FontParseState.fontWeight:
|
||||
success = Enums.TryParse(part, out fontWeight);
|
||||
success = Enum.TryParse(part, out fontWeight);
|
||||
if (success) FontWeight = fontWeight;
|
||||
state++;
|
||||
break;
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|AnyCPU">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>AnyCPU</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|AnyCPU">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>AnyCPU</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>aeefc0cc-6d17-439d-b8e0-53b713485e3b</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<NuProjPath Condition=" '$(NuProjPath)' == '' ">$(MSBuildExtensionsPath)\NuProj\</NuProjPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(NuProjPath)\NuProj.props" Condition="Exists('$(NuProjPath)\NuProj.props')" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<Id>Svg</Id>
|
||||
<Title>SVG Rendering Library</Title>
|
||||
<Authors>davescriven,jvenema,owaits,ddpruitt,Ralf1108,Tebjan Halm,and others</Authors>
|
||||
<Owners>vvvv.org</Owners>
|
||||
<Summary>Open source library to load/save and render SVG vector graphics.</Summary>
|
||||
<Description>Public fork of the C# SVG rendering library on codeplex: https://svg.codeplex.com/
|
||||
|
||||
This started out as a minor modification to enable the writing of proper SVG strings. But now after almost two years we have so many fixes and improvements that we decided to share our current codebase to the public in order to improve it even further.
|
||||
|
||||
So please feel free to fork it and open pull requests for any fix, improvement or feature you add.
|
||||
|
||||
License: Microsoft Public License: https://svg.codeplex.com/license</Description>
|
||||
<ReleaseNotes>merged github pull requests</ReleaseNotes>
|
||||
<ProjectUrl>https://github.com/svg-net/SVG</ProjectUrl>
|
||||
<LicenseUrl>http://opensource.org/licenses/MS-PL.html</LicenseUrl>
|
||||
<Copyright>Copyright © vvvv.org</Copyright>
|
||||
<Tags>svg, vector graphics, rendering</Tags>
|
||||
<GenerateSymbolPackage>false</GenerateSymbolPackage>
|
||||
<Version>2.2.1</Version>
|
||||
<RequireLicenseAcceptance>true</RequireLicenseAcceptance>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Svg.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(NuProjPath)\NuProj.targets" />
|
||||
</Project>
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>Svg</id>
|
||||
<version>$version$</version>
|
||||
<title>SVG Rendering Library</title>
|
||||
<authors>davescriven,jvenema,owaits,ddpruitt,Ralf1108,Tebjan Halm,and others</authors>
|
||||
<owners>vvvv.org</owners>
|
||||
<licenseUrl>http://opensource.org/licenses/MS-PL.html</licenseUrl>
|
||||
<projectUrl>https://github.com/svg-net/SVG</projectUrl>
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||
<description>Public fork of the C# SVG rendering library on codeplex: https://svg.codeplex.com/
|
||||
|
||||
This started out as a minor modification to enable the writing of proper SVG strings. But now after almost two years we have so many fixes and improvements that we decided to share our current codebase to the public in order to improve it even further.
|
||||
|
||||
So please feel free to fork it and open pull requests for any fix, improvement or feature you add.
|
||||
|
||||
License: Microsoft Public License: https://svg.codeplex.com/license</description>
|
||||
<summary>Open source library to load/save and render SVG vector graphics.</summary>
|
||||
<releaseNotes>merged github pull requests</releaseNotes>
|
||||
<tags>svg, vector graphics, rendering</tags>
|
||||
<frameworkAssemblies>
|
||||
<frameworkAssembly assemblyName="System" targetFramework="" />
|
||||
<frameworkAssembly assemblyName="System.Web" targetFramework="" />
|
||||
<frameworkAssembly assemblyName="System.Xml" targetFramework="" />
|
||||
<frameworkAssembly assemblyName="System.Drawing" targetFramework="" />
|
||||
</frameworkAssemblies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="..\Source\bin\Release\Svg.dll" target="lib\Svg.dll" />
|
||||
<file src="..\Source\bin\Release\Svg.pdb" target="lib\Svg.pdb" />
|
||||
<file src="..\Source\bin\Release\Svg.XML" target="lib\Svg.XML" />
|
||||
</files>
|
||||
</package>
|
|
@ -1,31 +1,177 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
#if NETCORE
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Svg;
|
||||
|
||||
public class SvgOptions
|
||||
namespace Svg
|
||||
{
|
||||
public class SvgOptions : IDictionary<string, string>, ICloneable
|
||||
{
|
||||
private readonly IDictionary<string, string> _properties;
|
||||
private Dictionary<string, string> _entities;
|
||||
|
||||
public SvgOptions()
|
||||
{
|
||||
_properties = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public SvgOptions(Dictionary<string, string> entities)
|
||||
: this()
|
||||
{
|
||||
Entities = entities;
|
||||
_entities = entities;
|
||||
}
|
||||
|
||||
public SvgOptions(Dictionary<string, string> entities, string css)
|
||||
: this()
|
||||
{
|
||||
Entities = entities;
|
||||
Css = css;
|
||||
_entities = entities;
|
||||
this.SetValue(nameof(Css), css);
|
||||
}
|
||||
|
||||
public SvgOptions(string css)
|
||||
: this()
|
||||
{
|
||||
Css = css;
|
||||
this.SetValue(nameof(Css), css);
|
||||
}
|
||||
|
||||
public Dictionary<string, string>? Entities { get; set; }
|
||||
public string? Css { get; set; }
|
||||
public Dictionary<string, string> Entities {
|
||||
get => _entities;
|
||||
set => _entities = value;
|
||||
}
|
||||
|
||||
public string Css {
|
||||
get => this.GetValue(nameof(Css));
|
||||
set => this.SetValue(nameof(Css), value);
|
||||
}
|
||||
|
||||
public string this[string key]
|
||||
{
|
||||
get => this.GetValue(key, string.Empty);
|
||||
set => this.SetValue(key, value);
|
||||
}
|
||||
|
||||
public ICollection<string> Keys => _properties.Keys;
|
||||
|
||||
public ICollection<string> Values => _properties.Values;
|
||||
|
||||
public int Count => _properties.Count;
|
||||
|
||||
public bool IsReadOnly => _properties.IsReadOnly;
|
||||
|
||||
public void Add(string key, string value)
|
||||
{
|
||||
if (key != null)
|
||||
{
|
||||
_properties.Add(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(KeyValuePair<string, string> item)
|
||||
{
|
||||
this.Add(item.Key, item.Value);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_properties.Clear();
|
||||
}
|
||||
|
||||
public bool Contains(KeyValuePair<string, string> item)
|
||||
{
|
||||
return _properties.Contains(item);
|
||||
}
|
||||
|
||||
public bool ContainsKey(string key)
|
||||
{
|
||||
return _properties.ContainsKey(key);
|
||||
}
|
||||
|
||||
public void CopyTo(KeyValuePair<string, string>[] array, int arrayIndex)
|
||||
{
|
||||
_properties.CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
|
||||
{
|
||||
return _properties.GetEnumerator();
|
||||
}
|
||||
|
||||
public bool Remove(string key)
|
||||
{
|
||||
return _properties.Remove(key);
|
||||
}
|
||||
|
||||
public bool Remove(KeyValuePair<string, string> item)
|
||||
{
|
||||
return _properties.Remove(item);
|
||||
}
|
||||
|
||||
#if NETCORE
|
||||
public bool TryGetValue(string key, [MaybeNullWhen(false)] out string value)
|
||||
{
|
||||
return _properties.TryGetValue(key, out value);
|
||||
}
|
||||
#else
|
||||
public bool TryGetValue(string key, out string value)
|
||||
{
|
||||
return _properties.TryGetValue(key, out value);
|
||||
}
|
||||
#endif
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return ((IEnumerable)_properties).GetEnumerator();
|
||||
}
|
||||
|
||||
object ICloneable.Clone()
|
||||
{
|
||||
return this.Clone();
|
||||
}
|
||||
|
||||
public SvgOptions Clone()
|
||||
{
|
||||
SvgOptions options = new SvgOptions();
|
||||
foreach (KeyValuePair<string, string> item in _properties)
|
||||
{
|
||||
options.Add(item);
|
||||
}
|
||||
if (_entities != null)
|
||||
{
|
||||
Dictionary<string, string> entities = new Dictionary<string, string>();
|
||||
foreach (KeyValuePair<string, string> item in _entities)
|
||||
{
|
||||
entities.Add(item.Key, item.Value);
|
||||
}
|
||||
options._entities = entities;
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
protected string GetValue(string key, string defaultVal = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(key))
|
||||
{
|
||||
return defaultVal;
|
||||
}
|
||||
if (_properties.TryGetValue(key, out string value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
return defaultVal;
|
||||
}
|
||||
|
||||
protected void SetValue(string key, string value)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(key))
|
||||
{
|
||||
return;
|
||||
}
|
||||
_properties[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -287,7 +287,6 @@ namespace Svg
|
|||
}
|
||||
}
|
||||
|
||||
#if Net4
|
||||
public override void RegisterEvents(ISvgEventCaller caller)
|
||||
{
|
||||
//register basic events
|
||||
|
@ -305,7 +304,6 @@ namespace Svg
|
|||
//unregister change event
|
||||
caller.UnregisterAction(this.ID + "/onchange");
|
||||
}
|
||||
#endif
|
||||
|
||||
public override SvgElement DeepCopy<T>()
|
||||
{
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<TestSettings name="Trace and Test Impact" id="23149ffc-ac6c-4c10-b846-c450c14dcd05" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
|
||||
<Description>These are test settings for Trace and Test Impact.</Description>
|
||||
<Execution>
|
||||
<TestTypeSpecific />
|
||||
<AgentRule name="Execution Agents">
|
||||
</AgentRule>
|
||||
</Execution>
|
||||
</TestSettings>
|
|
@ -8,6 +8,13 @@
|
|||
<AssemblyOriginatorKeyFile>..\Svg.UnitTests\svgkey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS1591;CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\Issues\svg\__AJ_Digital_Camera.svg">
|
||||
<Link>Assets\__AJ_Digital_Camera.svg</Link>
|
||||
|
|
|
@ -11,6 +11,24 @@
|
|||
<NoWarn>1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS1591;CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('net46'))">$(DefineConstants);DOTNET46;NETFULL</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('net47'))">$(DefineConstants);DOTNET47;NETFULL</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('net48'))">$(DefineConstants);DOTNET48;NETFULL</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('netstandard'))">$(DefineConstants);NETSTANDARD</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('netcore'))">$(DefineConstants);NETCORE</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('net6'))">$(DefineConstants);NETCORE;NETNEXT</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('net7'))">$(DefineConstants);NETCORE;NETNEXT</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('net8'))">$(DefineConstants);NETCORE;NETNEXT</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\Issue204_PrivateFont\BrushScriptMT2.ttf" />
|
||||
<EmbeddedResource Include="AllTests.csv" />
|
||||
|
@ -39,7 +57,6 @@
|
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
|
||||
<PackageReference Include="NUnit" Version="3.13.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
<PackageReference Include="Moq" Version="4.16.1" />
|
||||
<PackageReference Include="Fizzler" Version="1.3.0" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -9,6 +9,13 @@
|
|||
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<NoWarn>$(NoWarn);CS1591;CS0618;NETSDK1138</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('net46'))">$(DefineConstants);DOTNET46;NETFULL</DefineConstants>
|
||||
<DefineConstants Condition="$(TargetFramework.StartsWith('net47'))">$(DefineConstants);DOTNET47;NETFULL</DefineConstants>
|
||||
|
|
Загрузка…
Ссылка в новой задаче