You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
737 B
22 lines
737 B
using System;
|
|
using System.Text;
|
|
using Io.Nayuki.QrCodeGen;
|
|
|
|
internal class Program {
|
|
private static void Main() {
|
|
// Simple demo: encode text and print size
|
|
var qr = QrCode.EncodeText("Hello, world!", QrCode.Ecc.MEDIUM);
|
|
Console.WriteLine($"QR size: {qr.Size}x{qr.Size}, mask={qr.Mask}, ecc={qr.ErrorCorrectionLevel}");
|
|
|
|
// Render to ASCII
|
|
int border = 2;
|
|
for (int y = -border; y < qr.Size + border; y++) {
|
|
for (int x = -border; x < qr.Size + border; x++) {
|
|
bool m = (x >= 0 && x < qr.Size && y >= 0 && y < qr.Size) && qr.GetModule(x, y);
|
|
Console.Write(m ? "██" : " ");
|
|
}
|
|
Console.WriteLine();
|
|
}
|
|
}
|
|
}
|