-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathZXingOptions.cs
More file actions
251 lines (201 loc) · 7.22 KB
/
Copy pathZXingOptions.cs
File metadata and controls
251 lines (201 loc) · 7.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
// **********************************
// Densen Informatica 中讯科技
// 作者:Alex Chow
// e-mail:zhouchuanglin@gmail.com
// **********************************
using System.ComponentModel;
using System.Text.Json.Serialization;
namespace ZXingBlazor.Components;
/// <summary>
/// ZXing 选项类
/// </summary>
/// <remarks>https://zxing.github.io/zxing/apidocs/com/google/zxing/DecodeHintType.htm</remarks>
public class ZXingOptions
{
/// <summary>
/// 只解码 Pdf417 格式 / decode only Pdf417 format
/// </summary>
public bool Pdf417 { get; set; }
/// <summary>
/// 单次|连续解码,默认单次 / Decode Once or Decode Continuously, default is Once
/// </summary>
public bool Decodeonce { get; set; } = true;
/// <summary>
/// Time Between Decoding Attempts
/// </summary>
public int TimeBetweenDecodingAttempts { get; set; } = 10;
/// <summary>
/// 解码所有编码形式,性能较差, 开启后可用 options.formats 指定编码形式.默认为 false | Decodde All Formats, performance is poor, you can set options.formats to customize specify the encoding formats. The default is false
/// </summary>
public bool DecodeAllFormats { get; set; }
/// <summary>
/// 显示从图片解码按钮 / Display decode from the image button
/// </summary>
public bool ShowSelectFile { get; set; }
/// <summary>
/// 录屏解码
/// </summary>
public bool Screenshot { get; set; }
/// <summary>
/// Capture the current video frame when a scan succeeds.
/// </summary>
public bool CaptureStillOnScan { get; set; }
/// <summary>
/// Delay in milliseconds before resuming the preview after a captured scan.
/// </summary>
public int CaptureStillAutoResumeDelay { get; set; } = 3000;
/// <summary>
/// 使用zxing内置视频流打开方式,默认 false
/// </summary>
[Obsolete("This option is deprecated and will be removed in future versions. The library now uses the built-in video stream handling by default. 此选项已弃用,将在未来的版本中移除。库现在默认使用内置的视频流处理功能。")]
public bool StreamFromZxing { get; set; }
/// <summary>
/// 显示log
/// </summary>
[DisplayName("显示log")]
public bool Debug { get; set; }
/// <summary>
/// 图像质量,默认为 0.9
/// </summary>
[DisplayName("图像质量")]
public double Quality { get; set; } = 0.9d;
/// <summary>
/// 图像宽度,默认为 640
/// </summary>
[DisplayName("图像宽度")]
public int? Width { get; set; }
/// <summary>
/// 图像高度,默认为 480
/// </summary>
[DisplayName("图像高度")]
public int? Height { get; set; }
/// <summary>
/// 指定摄像头设备ID
/// </summary>
[DisplayName("指定摄像头设备ID")]
public string? DeviceID { get; set; }
/// <summary>
/// 已知图像是几种可能的格式之一。
/// </summary>
public List<BarcodeFormat> formats { get; set; } = new List<BarcodeFormat>() {
BarcodeFormat.AZTEC ,
BarcodeFormat.CODABAR,
BarcodeFormat.CODE_39,
BarcodeFormat.CODE_93,
BarcodeFormat.CODE_128,
BarcodeFormat.DATA_MATRIX,
BarcodeFormat.EAN_8,
BarcodeFormat.EAN_13,
BarcodeFormat.ITF,
BarcodeFormat.MAXICODE,
BarcodeFormat.PDF_417,
BarcodeFormat.QR_CODE,
BarcodeFormat.RSS_14,
BarcodeFormat.RSS_EXPANDED,
BarcodeFormat.UPC_A,
BarcodeFormat.UPC_E,
BarcodeFormat.UPC_EAN_EXTENSION,
};
/// <summary>
/// 如果为 true,尝试解码为倒置图像(反色),适用于反色条形码/二维码。所有配置的解码器都被用倒置图像第二次调用
/// </summary>
[JsonPropertyName("ALSO_INVERTED")]
public bool? ALSO_INVERTED { get; set; } = true;
/// <summary>
/// EAN 或 UPC 条形码允许的扩展长度, 默认为 2.
/// </summary>
[JsonPropertyName("ALLOWED_EAN_EXTENSIONS")]
public int[]? ALLOWED_EAN_EXTENSIONS { get; set; } //= new int[] { 2 };
/// <summary>
/// 允许的编码数据长度——拒绝任何其他长度
/// </summary>
[JsonPropertyName("ALLOWED_LENGTHS")]
public int[]? ALLOWED_LENGTHS { get; set; }
/// <summary>
/// 假设 Code 39 代码使用校验位。
/// </summary>
[JsonPropertyName("ASSUME_CODE_39_CHECK_DIGIT")]
public bool? ASSUME_CODE_39_CHECK_DIGIT { get; set; }
/// <summary>
/// 假设条形码正在作为 GS1 条形码进行处理,并根据需要修改行为
/// </summary>
[JsonPropertyName("ASSUME_GS1")]
public bool? ASSUME_GS1 { get; set; }
/// <summary>
/// 指定解码时使用的字符编码(如果适用)
/// </summary>
[JsonPropertyName("CHARACTER_SET")]
public string? CHARACTER_SET { get; set; }
///// <summary>
///// ResultPoint 当发现可能的情况时,需要通过回调通知调用者, 映射到一个ResultPointCallback
///// </summary>
//public object NEED_RESULT_POINT_CALLBACK { get; set; }
/// <summary>
/// 未指定的、特定于应用程序的提示。
/// </summary>
[JsonPropertyName("OTHER")]
public object? OTHER { get; set; }
/// <summary>
/// 图像是条形码的纯单色图像。
/// </summary>
[JsonPropertyName("PURE_BARCODE")]
public bool? PURE_BARCODE { get; set; }
/// <summary>
/// 如果为 true,则返回 Codabar 条形码中的开始和结束数字,而不是剥离它们
/// <remark>如果为 true,则返回 Codabar 条形码中的开始和结束数字,而不是剥离它们。它们是字母,而其余的是数字。默认情况下,它们会被剥离,但这会导致它们不会被剥离</remark>
/// </summary>
[JsonPropertyName("RETURN_CODABAR_START_END")]
public bool? RETURN_CODABAR_START_END { get; set; }
/// <summary>
/// 花更多的时间尝试寻找条形码;优化准确性,而不是速度
/// </summary>
[JsonPropertyName("TRY_HARDER")]
public bool? TRY_HARDER { get; set; }
/// <summary>
/// 假设 MSI 条形码使用校验位
/// </summary>
[JsonPropertyName("ASSUME_MSI_CHECK_DIGIT")]
public bool? ASSUME_MSI_CHECK_DIGIT { get; set; }
}
/**
* Enumerates barcode formats known to this package. Please keep alphabetized.
*
* @author Sean Owen
*/
public enum BarcodeFormat
{
/** Aztec 2D barcode format. */
AZTEC,
/** CODABAR 1D format. */
CODABAR,
/** Code 39 1D format. */
CODE_39,
/** Code 93 1D format. */
CODE_93,
/** Code 128 1D format. */
CODE_128,
/** Data Matrix 2D barcode format. */
DATA_MATRIX,
/** EAN-8 1D format. */
EAN_8,
/** EAN-13 1D format. */
EAN_13,
/** ITF (Interleaved Two of Five) 1D format. */
ITF,
/** MaxiCode 2D barcode format. */
MAXICODE,
/** PDF417 format. */
PDF_417,
/** QR Code 2D barcode format. */
QR_CODE,
/** RSS 14 */
RSS_14,
/** RSS EXPANDED */
RSS_EXPANDED,
/** UPC-A 1D format. */
UPC_A,
/** UPC-E 1D format. */
UPC_E,
/** UPC/EAN extension format. Not a stand-alone format. */
UPC_EAN_EXTENSION
}