12 Reviews
C # QRCode is an open source QR code generation Class Library, the project address is: Http://www.codeproject.com/Articles/20574/Open-Source-QRCode-Library
A project on hand today needs to add the ability to dynamically generate two-dimensional code, so we have a little research on this kind of library and encountered a problem. When I recompile qrcodelib this class library to error!
The error message is:
ERROR 7 "ThoughtWorks.QRCode.Properties.Resources" does not contain the definition of "getresource" D:\QRCode\QRCodeLib\QRCodeEncoder.cs 735 Qrcodelib
View related code, is a dynamic splicing file name, dynamically read the relevant "configuration file" a function, the code is as follows:
Just change these three wrong places to:
MemoryStream MemoryStream = new MemoryStream ((byte[]) Resources.ResourceManager.GetObject (fileName);
You can do it.
In addition, my project is the web, found that I downloaded the QRCode project file Qrcodewebapp inside does not write related functions! In fact, it is very simple, directly take qrcodesampleapp inside the key core code to change it, the last bar!
The above ignores a problem, QRCode created two-dimensional code problem, that is, Chinese garbled! It was not noticed at the beginning that the final stage was discovered, but also blamed for his carelessness.
In fact, it is very simple, still need to modify the qrcodelib inside a little bit of code.
1. Modify QRCodeEncoder.cs and QRCodeDecoder.cs to replace Encoding.unicode with Encoding.UTF8
UnicodeEncoding encoding = new UnicodeEncoding () in QRCodeUtility.cs in 2.util directory, replace with utf8encoding encoding = new UTF8Encoding ();
The two-dimensional code will be able to identify the Chinese!
Attach your own revised version below, download/upfiles/self/sean-qrcode.rar here
The change is that the code is all replaced with UTF8,
Dlsaint Problem Solving:
ASP. NET QRCode problems when creating Web QR codes!