Example #1
0
        public static int GetSizeToCIS(this QRCodeSize t)
        {
            switch (t)
            {
            case QRCodeSize.SMALL:
                return(10);

            case QRCodeSize.MEDIUM:
                return(20);

            case QRCodeSize.LARGE:
                return(30);

            default:
                return(40);
            }
        }
Example #2
0
        public static int GetSizeToRongta(this QRCodeSize t)
        {
            switch (t)
            {
            case QRCodeSize.SMALL:
                return(1);

            case QRCodeSize.MEDIUM:
                return(3);

            case QRCodeSize.LARGE:
                return(6);

            default:
                return(9);
            }
        }
Example #3
0
        public static int GetSizeToDatec(this QRCodeSize t)
        {
            switch (t)
            {
            case QRCodeSize.SMALL:
                return(2);

            case QRCodeSize.MEDIUM:
                return(6);

            case QRCodeSize.LARGE:
                return(10);

            default:
                return(14);
            }
        }
Example #4
0
        public static int GetSizeToNitere(this QRCodeSize t)
        {
            switch (t)
            {
            case QRCodeSize.SMALL:
                return(2);

            case QRCodeSize.MEDIUM:
                return(4);

            case QRCodeSize.LARGE:
                return(6);

            default:
                return(8);
            }
        }
        private string GenerateQRCodeUrl(string content, QRCodeSize size, QRErrorCorrection errorCorrection)
        {
            var baseUrl = "http://chart.apis.google.com/chart?cht=qr&chs={0}x{0}&chld={1}&choe=UTF-8&chl={2}";

            return(string.Format(baseUrl, (int)size, errorCorrection.ToString(), Uri.EscapeDataString(content)));
        }
Example #6
0
        /// <summary>
        /// GS ( k pL pH cn fn n1 n2
        /// </summary>
        /// <exception cref="ArgumentNullException"><paramref name="content"/> is <see langword="null"/>.</exception>
        public static byte[] PrintQRCode(string content, QRCodeModel qrCodemodel = QRCodeModel.Model1, QRCodeCorrection qrodeCorrection = QRCodeCorrection.Percent7, QRCodeSize qrCodeSize = QRCodeSize.Normal)
        {
            var model           = new byte[] { 0x1D, 0x28, 0x6B, 0x04, 0x00, 0x31, 0x41, (byte)qrCodemodel, 0x00 };
            var size            = new byte[] { 0x1D, 0x28, 0x6B, 0x03, 0x00, 0x31, 0x43, (byte)qrCodeSize };
            var errorCorrection = new byte[] { 0x1D, 0x28, 0x6B, 0x03, 0x00, 0x31, 0x45, (byte)qrodeCorrection };
            int num             = content.Length + 3;
            int pL        = num % 256;
            int pH        = num / 256;
            var storeData = new byte[] { 0x1D, 0x28, 0x6B, (byte)pL, (byte)pH, 0x31, 0x50, 0x30 };
            var data      = Encoding.UTF8.GetBytes(content);
            var print     = new byte[] { 0x1D, 0x28, 0x6B, 0x03, 0x00, 0x31, 0x51, 0x30 };

            return(model.Add(size, errorCorrection, storeData, data, print));
        }
    private string GenerateQRCodeUrl(string content, QRCodeSize size, QRErrorCorrection errorCorrection)
    {
      var baseUrl = "http://chart.apis.google.com/chart?cht=qr&chs={0}x{0}&chld={1}&choe=UTF-8&chl={2}";

      return string.Format(baseUrl, (int)size, errorCorrection.ToString(), Uri.EscapeDataString(content));
    }