예제 #1
0
 /// <summary>
 /// 识别二维码
 /// </summary>
 /// <returns></returns>
 public ActionResult ReadQrCode()
 {
     return(RunAction(() =>
     {
         var file = this.X.context.Request.Files["img"];
         if (file == null)
         {
             return Content(string.Empty);
         }
         byte[] b = IOHelper.GetPostFileBytesAndDispose(file);
         if (!ValidateHelper.IsPlumpList(b))
         {
             return Content(string.Empty);
         }
         QrCode qr = new QrCode();
         string str = qr.DistinguishQrImage(b);
         if (ValidateHelper.IsPlumpString(str))
         {
             return Content(str);
         }
         else
         {
             return Content("未能识别出内容");
         }
     }));
 }
예제 #2
0
파일: QrCode.cs 프로젝트: toby2o12/hiwjcn
 /// <summary>
 /// 识别二维码
 /// </summary>
 public static string DistinguishQrImage(this QrCode coder, string img_path) =>
 coder.DistinguishQrImage(File.ReadAllBytes(img_path));