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
PayloadGeneratorinto their own classes. Other libraries can expose newPayloadsby referencingQRCoder2and extendingPayloadBase.QR Code data
QRCodeGeneratortranslates aPayloadBasetoQRCodeData. I didn't change anything here, except movingECCLevelandEciModeto the Payloads namespace.Renderers
I added a renderers namespace. I put a couple of the "easy" QR codes that had no dependencies there:
PngByteQRCodeandBitmapByteQRCode. I think the*QRCodeclasses should then be renamed*QRCodeRenderer. As an example, I added a library forQRCoder2.Renderers.ImageSharpwhich has a dependency on ImageSharp (but does nothing at the moment). Other library authors could provide their own renderers using onlyQRCoder2as a dependency.