From f13a257a8fc486cf3b3362b85b58416a75f57861 Mon Sep 17 00:00:00 2001 From: Shane32 Date: Tue, 2 Apr 2024 01:39:30 -0400 Subject: [PATCH] Allow SVG exporting under .NET 6 --- QRCoder/SvgQRCode.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/QRCoder/SvgQRCode.cs b/QRCoder/SvgQRCode.cs index e03ce5dc..25ba8c8c 100644 --- a/QRCoder/SvgQRCode.cs +++ b/QRCoder/SvgQRCode.cs @@ -1,4 +1,4 @@ -#if NETFRAMEWORK || NETSTANDARD2_0 || NET5_0 || NET6_0_WINDOWS +#if NETFRAMEWORK || NETSTANDARD2_0 || NET5_0_OR_GREATER using QRCoder.Extensions; using System; using System.Collections; @@ -11,9 +11,6 @@ namespace QRCoder { -#if NET6_0_WINDOWS - [System.Runtime.Versioning.SupportedOSPlatform("windows")] -#endif public class SvgQRCode : AbstractQRCode, IDisposable { /// @@ -270,13 +267,16 @@ public class SvgLogo private object _logoRaw; private bool _isEmbedded; - +#if NETFRAMEWORK || NETSTANDARD2_0 || NET5_0 || NET6_0_WINDOWS /// /// Create a logo object to be used in SvgQRCode renderer /// /// Logo to be rendered as Bitmap/rasterized graphic /// Degree of percentage coverage of the QR code by the logo /// If true, the background behind the logo will be cleaned +#if NET6_0_WINDOWS + [System.Runtime.Versioning.SupportedOSPlatform("windows")] +#endif public SvgLogo(Bitmap iconRasterized, int iconSizePercent = 15, bool fillLogoBackground = true) { _iconSizePercent = iconSizePercent; @@ -293,6 +293,7 @@ public SvgLogo(Bitmap iconRasterized, int iconSizePercent = 15, bool fillLogoBac _logoRaw = iconRasterized; _isEmbedded = false; } +#endif /// /// Create a logo object to be used in SvgQRCode renderer @@ -379,9 +380,6 @@ public enum MediaType : int } } -#if NET6_0_WINDOWS - [System.Runtime.Versioning.SupportedOSPlatform("windows")] -#endif public static class SvgQRCodeHelper { public static string GetQRCode(string plainText, int pixelsPerModule, string darkColorHex, string lightColorHex, ECCLevel eccLevel, bool forceUtf8 = false, bool utf8BOM = false, EciMode eciMode = EciMode.Default, int requestedVersion = -1, bool drawQuietZones = true, SizingMode sizingMode = SizingMode.WidthHeightAttribute, SvgLogo logo = null)