diff --git a/Clients/ASP.NetCoreDemo/Helper/BarcodeTagHelper.cs b/Clients/ASP.NetCoreDemo/Helper/BarcodeTagHelper.cs index bc953c6a..31773a39 100644 --- a/Clients/ASP.NetCoreDemo/Helper/BarcodeTagHelper.cs +++ b/Clients/ASP.NetCoreDemo/Helper/BarcodeTagHelper.cs @@ -20,7 +20,7 @@ using Microsoft.AspNetCore.Razor.TagHelpers; using ZXing; -using ZXing.QrCode; +using ZXing.Common; namespace ASP.NetCoreDemo.Helper { @@ -42,16 +42,16 @@ public override void Process(TagHelperContext context, TagHelperOutput output) var alt = context.AllAttributes["alt"]?.Value.ToString(); var width = - Convert.ToInt32(context.AllAttributes["width"] == null - ? "500" + Convert.ToInt32(String.IsNullOrEmpty(context.AllAttributes["width"]?.Value.ToString()) + ? "1" : context.AllAttributes["width"].Value.ToString()); var height = - Convert.ToInt32(context.AllAttributes["height"] == null - ? "500" + Convert.ToInt32(String.IsNullOrEmpty(context.AllAttributes["height"]?.Value.ToString()) + ? "1" : context.AllAttributes["height"].Value.ToString()); var margin = - Convert.ToInt32(context.AllAttributes["margin"] == null - ? "5" + Convert.ToInt32(String.IsNullOrEmpty(context.AllAttributes["margin"]?.Value.ToString()) + ? "0" : context.AllAttributes["margin"].Value.ToString()); var barcodeformat = BarcodeFormat.QR_CODE; var outputformat = OutputFormat.PNG; @@ -88,7 +88,7 @@ private void GeneratePng(TagHelperOutput output, string content, BarcodeFormat b var qrWriter = new ZXing.BarcodeWriterPixelData { Format = barcodeformat, - Options = new QrCodeEncodingOptions { Height = height, Width = width, Margin = margin } + Options = new EncodingOptions { Height = height, Width = width, Margin = margin } }; @@ -131,7 +131,7 @@ private void GenerateSvg(TagHelperOutput output, string content, BarcodeFormat b var qrWriter = new ZXing.BarcodeWriterSvg { Format = barcodeformat, - Options = new QrCodeEncodingOptions { Height = height, Width = width, Margin = margin } + Options = new EncodingOptions { Height = height, Width = width, Margin = margin } }; diff --git a/Clients/ASP.NetCoreDemo/Views/Home/Encode.cshtml b/Clients/ASP.NetCoreDemo/Views/Home/Encode.cshtml index e9a48049..11989cfa 100644 --- a/Clients/ASP.NetCoreDemo/Views/Home/Encode.cshtml +++ b/Clients/ASP.NetCoreDemo/Views/Home/Encode.cshtml @@ -11,7 +11,7 @@
Content:
- +Type:
@@ -23,15 +23,15 @@Width:
- +Height:
- +Margin:
- +