/// <summary> /// 初始化一个<see cref="ZXingQrCodeService"/>类型的实例 /// </summary> /// <param name="fileStore">文件存储服务</param> public ZXingQrCodeService(IFileStore fileStore) { _fileStore = fileStore; _size = 10; _level = ZQI.ErrorCorrectionLevel.L; _dic = new Dictionary <EncodeHintType, object>(); }
/// <summary> /// 初始化一个<see cref="ZXingBarcodeService"/>类型的实例 /// </summary> public ZXingBarcodeService() { _width = 150; _height = 150; _level = ZQI.ErrorCorrectionLevel.L; _showContent = false; }
/// <summary> /// 初始化一个<see cref="ZXingQrCodeService"/>类型的实例 /// </summary> public ZXingQrCodeService() { _size = 250; _level = ZQI.ErrorCorrectionLevel.L; _margin = 0; _logoPath = string.Empty; _foregroundColor = System.Drawing.Color.Black; _backgroundColor = System.Drawing.Color.White; }
/// <summary> /// 初始化一个<see cref="ZXingQrCodeService"/>类型的实例 /// </summary> public ZXingQrCodeService() { _size = 10; _width = 250; _height = 250; _margin = 0; _level = ZQI.ErrorCorrectionLevel.L; _dict = new Dictionary <EncodeHintType, object>(); }
/// <summary> /// 容错处理 /// </summary> /// <param name="level">容错级别</param> /// <returns></returns> public IQrCodeService Correction(ErrorCorrectionLevel level) { switch (level) { case ErrorCorrectionLevel.L: _level = ZQI.ErrorCorrectionLevel.L; break; case ErrorCorrectionLevel.M: _level = ZQI.ErrorCorrectionLevel.M; break; case ErrorCorrectionLevel.Q: _level = ZQI.ErrorCorrectionLevel.Q; break; case ErrorCorrectionLevel.H: _level = ZQI.ErrorCorrectionLevel.H; break; } return(this); }
/// <summary> /// 处理容错级别 /// </summary> /// <param name="level">容错级别</param> protected override void HandlerCorrectionLevel(ErrorCorrectionLevel level) { switch (level) { case ErrorCorrectionLevel.L: _level = ZQI.ErrorCorrectionLevel.L; break; case ErrorCorrectionLevel.M: _level = ZQI.ErrorCorrectionLevel.M; break; case ErrorCorrectionLevel.Q: _level = ZQI.ErrorCorrectionLevel.Q; break; case ErrorCorrectionLevel.H: _level = ZQI.ErrorCorrectionLevel.H; break; default: throw new NotImplementedException("未知容错级别"); } }