-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal] QRCoder2 #321
base: master
Are you sure you want to change the base?
[Proposal] QRCoder2 #321
Conversation
Looking for a QR Code generator, and I'm too using .NET6 - the sample code here is not working with the Nuget package that is supplied https://github.com/codebude/QRCoder version 1.4.3... so I'm thinking it not ready for .net6 ? Just started to look into the source and see if I can help.. but thought I would drop this comment if you wanted to work on it together |
Happy to help out too. A have a BIG project and it has all upgraded to .net 6 quite successfully, except for this. |
Happy to help too. The only downside is that I've ImageSharp dependencies. It's not a problem for me because the generators are within my project, and not in this library. Would it become acceptable to add dependencies to this library? |
I also wont to use this project in my own .NET 6 project, howewer now this is not cross-platform solution. Do you plan to make this cross-platform and when? |
@itarizin I think a clean approach would be to invert the dependency. Have something like an E.g. This assumes a common renderer agnostic contract can be extrapolated. Something like Something similar for Payloads like Disclaimer: I'm just spit-balling here. I haven't actually looked at the code in a few years 😀. |
Proposal for #242. This is just an example -- I didn't move everything that could be moved. For the most part I left the code as-is after moving it. I targeted .net 6 without putting much thought into it. I'm sure we could target a bit lower if desired. My goal was to keep dependencies out of
QRCoder2
.Payloads
I pulled payloads out of
PayloadGenerator
into their own classes. Other libraries can expose newPayloads
by referencingQRCoder2
and extendingPayloadBase
.QR Code data
QRCodeGenerator
translates aPayloadBase
toQRCodeData
. I didn't change anything here, except movingECCLevel
andEciMode
to the Payloads namespace.Renderers
I added a renderers namespace. I put a couple of the "easy" QR codes that had no dependencies there:
PngByteQRCode
andBitmapByteQRCode
. I think the*QRCode
classes should then be renamed*QRCodeRenderer
. As an example, I added a library forQRCoder2.Renderers.ImageSharp
which has a dependency on ImageSharp (but does nothing at the moment). Other library authors could provide their own renderers using onlyQRCoder2
as a dependency.