using System; using System.Drawing; using System.Drawing.Imaging; using ZXing; using ZXing.QrCode; namespace QRCodeExample { class Program { static void Main(string[] args) { // Получить URL-адрес от пользователя Console.WriteLine("Enter a URL:"); string url = Console.ReadLine(); // Создать экземпляр средства записи штрих-кодов BarcodeWriter writer = new BarcodeWriter { Format = BarcodeFormat.QR_CODE, Options = new QrCodeEncodingOptions { Width = 200, Height = 200 } }; // Сгенерируйте изображение штрих-кода Bitmap qrCodeImage = writer.Write(url); // Сохраните изображение в файле qrCodeImage.Save("qrcode.png", ImageFormat.Png); // Создать экземпляр считывателя штрих-кодов BarcodeReader reader = new BarcodeReader(); // Декодировать изображение QR-кода Result result = reader.Decode(qrCodeImage); // Проверьте, был ли найден QR-код if (result != null) { // Распечатать декодированный текст Console.WriteLine(result.Text); // Сохраните декодированный текст в файле System.IO.File.WriteAllText("decoded.txt", result.Text); } Console.ReadLine(); Console.ReadKey(); } } } CSHARP using System; using System.Drawing; using System.Drawing.Imaging; using ZXing; using ZXing.QrCode; namespace QRCodeExample { class Program { static void Main(string[] args) { // Получить URL-адрес от пользователя Console.WriteLine("Enter a URL:"); string url = Console.ReadLine(); // Создать экземпляр средства записи штрих-кодов BarcodeWriter writer = new BarcodeWriter { Format = BarcodeFormat.QR_CODE, Options = new QrCodeEncodingOptions { Width = 200, Height = 200 } }; // Сгенерируйте изображение штрих-кода Bitmap qrCodeImage = writer.Write(url); // Сохраните изображение в файле qrCodeImage.Save("qrcode.png", ImageFormat.Png); // Создать экземпляр считывателя штрих-кодов BarcodeReader reader = new BarcodeReader(); // Декодировать изображение QR-кода Result result = reader.Decode(qrCodeImage); // Проверьте, был ли найден QR-код if (result != null) { // Распечатать декодированный текст Console.WriteLine(result.Text); // Сохраните декодированный текст в файле System.IO.File.WriteAllText("decoded.txt", result.Text); } Console.ReadLine(); Console.ReadKey(); } } }