From bf3f7dec920c9a17168ab60a4c84df74d4bf8dbf Mon Sep 17 00:00:00 2001 From: Peter Gill Date: Sun, 12 Jan 2025 14:38:18 -0330 Subject: [PATCH] Update BarcodeWriter instantiation for compatibility if net8.0 runtime errors Updated instantiation of ZXing.BarcodeWriter in AztecCode.cs, BarCode128.cs, BarCode39.cs, BarCodeEAN8.cs, and QrCode.cs to use different types based on compilation symbols. For DRAWINGCOMPAT, replaced with ZXing.SkiaSharp.BarcodeWriter. For NETSTANDARD2_0 or NET5_0_OR_GREATER, replaced with ZXing.Windows.Compatibility.BarcodeWriter. Default remains ZXing.BarcodeWriter. These changes ensure compatibility with different frameworks and improve barcode writing for various image formats. --- RdlCri/AztecCode.cs | 4 ++-- RdlCri/BarCode128.cs | 4 ++-- RdlCri/BarCode39.cs | 4 ++-- RdlCri/BarCodeEAN8.cs | 4 ++-- RdlCri/QrCode.cs | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/RdlCri/AztecCode.cs b/RdlCri/AztecCode.cs index 8707db38..a9d756a6 100644 --- a/RdlCri/AztecCode.cs +++ b/RdlCri/AztecCode.cs @@ -38,9 +38,9 @@ void ICustomReportItem.DrawImage(ref Drawing.Bitmap bm) internal void DrawImage(ref Drawing.Bitmap bm, string aztecCode) { #if DRAWINGCOMPAT - var writer = new ZXing.BarcodeWriter(); + var writer = new ZXing.SkiaSharp.BarcodeWriter(); #elif NETSTANDARD2_0 || NET5_0_OR_GREATER - var writer = new ZXing.BarcodeWriter(); + var writer = new ZXing.Windows.Compatibility.BarcodeWriter(); #else var writer = new ZXing.BarcodeWriter(); #endif diff --git a/RdlCri/BarCode128.cs b/RdlCri/BarCode128.cs index cf5fc577..a00234d8 100644 --- a/RdlCri/BarCode128.cs +++ b/RdlCri/BarCode128.cs @@ -43,9 +43,9 @@ public void DrawDesignerImage(ref Drawing.Bitmap bm) public void DrawImage(ref Drawing.Bitmap bm, string code128) { #if DRAWINGCOMPAT - var writer = new ZXing.BarcodeWriter(); + var writer = new ZXing.SkiaSharp.BarcodeWriter(); #elif NETSTANDARD2_0 || NET5_0_OR_GREATER - var writer = new ZXing.BarcodeWriter(); + var writer = new ZXing.Windows.Compatibility.BarcodeWriter(); #else var writer = new ZXing.BarcodeWriter(); #endif diff --git a/RdlCri/BarCode39.cs b/RdlCri/BarCode39.cs index 70d5865e..3c69ad87 100644 --- a/RdlCri/BarCode39.cs +++ b/RdlCri/BarCode39.cs @@ -44,9 +44,9 @@ public void DrawDesignerImage(ref Drawing.Bitmap bm) public void DrawImage(ref Drawing.Bitmap bm, string code39) { #if DRAWINGCOMPAT - var writer = new ZXing.BarcodeWriter(); + var writer = new ZXing.SkiaSharp.BarcodeWriter(); #elif NETSTANDARD2_0 || NET5_0_OR_GREATER - var writer = new ZXing.BarcodeWriter(); + var writer = new ZXing.Windows.Compatibility.BarcodeWriter(); #else var writer = new ZXing.BarcodeWriter(); #endif diff --git a/RdlCri/BarCodeEAN8.cs b/RdlCri/BarCodeEAN8.cs index e9664d75..fb484f46 100644 --- a/RdlCri/BarCodeEAN8.cs +++ b/RdlCri/BarCodeEAN8.cs @@ -44,9 +44,9 @@ public void DrawDesignerImage(ref Bitmap bm) public void DrawImage(ref Bitmap bm, string code) { #if DRAWINGCOMPAT - var writer = new ZXing.BarcodeWriter(); + var writer = new ZXing.SkiaSharp.BarcodeWriter(); #elif NETSTANDARD2_0 || NET5_0_OR_GREATER - var writer = new ZXing.BarcodeWriter(); + var writer = new ZXing.Windows.Compatibility.BarcodeWriter(); #else var writer = new ZXing.BarcodeWriter(); #endif diff --git a/RdlCri/QrCode.cs b/RdlCri/QrCode.cs index 44be5de7..ccf7caff 100644 --- a/RdlCri/QrCode.cs +++ b/RdlCri/QrCode.cs @@ -39,9 +39,9 @@ void ICustomReportItem.DrawImage(ref Drawing.Bitmap bm) internal void DrawImage(ref Drawing.Bitmap bm, string qrcode) { #if DRAWINGCOMPAT - var writer = new ZXing.BarcodeWriter(); + var writer = new ZXing.SkiaSharp.BarcodeWriter(); #elif NETSTANDARD2_0 || NET5_0_OR_GREATER - var writer = new ZXing.BarcodeWriter(); + var writer = new ZXing.Windows.Compatibility.BarcodeWriter(); #else var writer = new ZXing.BarcodeWriter(); #endif