Skip to content

Commit

Permalink
Update BarcodeWriter instantiation for compatibility
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
majorsilence committed Jan 12, 2025
1 parent 941e207 commit bf3f7de
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions RdlCri/AztecCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SkiaSharp.SKBitmap>();
var writer = new ZXing.SkiaSharp.BarcodeWriter();
#elif NETSTANDARD2_0 || NET5_0_OR_GREATER
var writer = new ZXing.BarcodeWriter<Drawing.Bitmap>();
var writer = new ZXing.Windows.Compatibility.BarcodeWriter();
#else
var writer = new ZXing.BarcodeWriter();
#endif
Expand Down
4 changes: 2 additions & 2 deletions RdlCri/BarCode128.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SkiaSharp.SKBitmap>();
var writer = new ZXing.SkiaSharp.BarcodeWriter();
#elif NETSTANDARD2_0 || NET5_0_OR_GREATER
var writer = new ZXing.BarcodeWriter<Drawing.Bitmap>();
var writer = new ZXing.Windows.Compatibility.BarcodeWriter();
#else
var writer = new ZXing.BarcodeWriter();
#endif
Expand Down
4 changes: 2 additions & 2 deletions RdlCri/BarCode39.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SkiaSharp.SKBitmap>();
var writer = new ZXing.SkiaSharp.BarcodeWriter();
#elif NETSTANDARD2_0 || NET5_0_OR_GREATER
var writer = new ZXing.BarcodeWriter<Drawing.Bitmap>();
var writer = new ZXing.Windows.Compatibility.BarcodeWriter();
#else
var writer = new ZXing.BarcodeWriter();
#endif
Expand Down
4 changes: 2 additions & 2 deletions RdlCri/BarCodeEAN8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SkiaSharp.SKBitmap>();
var writer = new ZXing.SkiaSharp.BarcodeWriter();
#elif NETSTANDARD2_0 || NET5_0_OR_GREATER
var writer = new ZXing.BarcodeWriter<System.Drawing.Bitmap>();
var writer = new ZXing.Windows.Compatibility.BarcodeWriter();
#else
var writer = new ZXing.BarcodeWriter();
#endif
Expand Down
4 changes: 2 additions & 2 deletions RdlCri/QrCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SkiaSharp.SKBitmap>();
var writer = new ZXing.SkiaSharp.BarcodeWriter();
#elif NETSTANDARD2_0 || NET5_0_OR_GREATER
var writer = new ZXing.BarcodeWriter<Drawing.Bitmap>();
var writer = new ZXing.Windows.Compatibility.BarcodeWriter();
#else
var writer = new ZXing.BarcodeWriter();
#endif
Expand Down

0 comments on commit bf3f7de

Please sign in to comment.