Ejemplo n.º 1
0
        public ResponseResult Test(QRCodeCreateInput qRCodeCreateInput)
        {
            QRCodeCreateEntity qRCodeCreateEntity = QRCodeConvert.ChangeEntity(qRCodeCreateInput);
            string             fileName           = QRCoderHelper.CreateQRCodeToFile(qRCodeCreateEntity);

            return(ResponseResult.Success(fileName));
        }
Ejemplo n.º 2
0
        public ResponseResult <string> CreateToBase64(QRCodeCreateInput qRCodeCreateInput)
        {
            QRCodeCreateEntity qRCodeCreateEntity = QRCodeConvert.ChangeEntity(qRCodeCreateInput);
            string             result             = QRCoderHelper.CreateQRCodeToBase64(qRCodeCreateEntity);

            return(ResponseResult <string> .Success(result));
        }
Ejemplo n.º 3
0
        public ResponseResult <byte[]> CreateToBytes(QRCodeCreateInput qRCodeCreateInput)
        {
            QRCodeCreateEntity qRCodeCreateEntity = QRCodeConvert.ChangeEntity(qRCodeCreateInput);

            byte[] result = QRCoderHelper.CreateQRCodeToBytes(qRCodeCreateEntity);
            return(ResponseResult <byte[]> .Success(result));
        }
Ejemplo n.º 4
0
        public static QRCodeCreateEntity ChangeEntity(QRCodeCreateInput item)
        {
            QRCodeCreateEntity qRCodeCreateEntity = new QRCodeCreateEntity
            {
                ContextText = item.ContextText,
                IconSource  = item.IconSource
            };

            if (item.PixelsPerModule != 0)
            {
                qRCodeCreateEntity.PixelsPerModule = item.PixelsPerModule;
            }
            if (item.IconSizePercent != 0)
            {
                qRCodeCreateEntity.IconSizePercent = item.IconSizePercent;
            }
            if (item.IconBorderWidth != 0)
            {
                qRCodeCreateEntity.IconBorderWidth = item.IconBorderWidth;
            }
            if (!string.IsNullOrWhiteSpace(item.DarkColor))
            {
                qRCodeCreateEntity.DarkColor = item.DarkColor;
            }
            if (!string.IsNullOrWhiteSpace(item.LightColor))
            {
                qRCodeCreateEntity.LightColor = item.LightColor;
            }
            if (!item.DrawQuietZones)
            {
                qRCodeCreateEntity.DrawQuietZones = item.DrawQuietZones;
            }
            return(qRCodeCreateEntity);
        }