Skip to content

Commit 30e1b2c

Browse files
sync codes with guide
1 parent 3fa7ccb commit 30e1b2c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

samples/GeneralSettings/Program.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,20 @@ static void Main(string[] args)
2121
}
2222

2323
// 2. Create an instance of Barcode Reader
24-
BarcodeReader dbr = new BarcodeReader();
24+
BarcodeReader reader = new BarcodeReader();
2525

2626
// 3. Configure settings
2727

2828
// 3.1 Through PublicRuntimeSetting
2929

3030
// 3.1.1 Call GetRuntimeSettings to get current runtime settings.
31-
PublicRuntimeSettings settings = dbr.GetRuntimeSettings();
31+
PublicRuntimeSettings settings = reader.GetRuntimeSettings();
3232

3333
// 3.1.2 Configure one or more specific settings
3434
// In this sample, we configure three settings:
3535
// try to finnd PDF 417 and DotCode
36+
// The barcode format our library will search for is composed of BarcodeFormat group 1 and BarcodeFormat group 2.
37+
// So you need to specify the barcode format in group 1 and group 2 individually.
3638
settings.BarcodeFormatIds = (int)EnumBarcodeFormat.BF_PDF417;
3739
settings.BarcodeFormatIds_2 = (int)EnumBarcodeFormat_2.BF2_DOTCODE;
3840
// try to find 2 barcodes
@@ -45,19 +47,19 @@ static void Main(string[] args)
4547
settings.Region.RegionMeasuredByPercentage = 1;
4648

4749
// 3.1.3 Call UpdateRuntimeSettings to apply above settings
48-
dbr.UpdateRuntimeSettings(settings);
50+
reader.UpdateRuntimeSettings(settings);
4951

5052
// 3.2 Through JSON template
5153
//string errorMessage;
52-
//dbr.InitRuntimeSettingsWithString("{\"ImageParameter\":{\"Name\":\"S1\",\"RegionDefinitionNameArray\":[\"R1\"]},\"RegionDefinition\":{\"Name\":\"R1\",\"BarcodeFormatIds\":[\"BF_PDF417\"],\"BarcodeFormatIds_2\":[\"BF2_POSTALCODE\"],\"ExpectedBarcodesCount\":2,\"Left\":0,\"Right\":100,\"Top\":50,\"Bottom\":100,\"MeasuredByPercentage\":1}}", EnumConflictMode.CM_IGNORE, out errorMessage);
54+
//reader.InitRuntimeSettingsWithString("{\"ImageParameter\":{\"Name\":\"S1\",\"RegionDefinitionNameArray\":[\"R1\"]},\"RegionDefinition\":{\"Name\":\"R1\",\"BarcodeFormatIds\":[\"BF_PDF417\"],\"BarcodeFormatIds_2\":[\"BF2_POSTALCODE\"],\"ExpectedBarcodesCount\":2,\"Left\":0,\"Right\":100,\"Top\":50,\"Bottom\":100,\"MeasuredByPercentage\":1}}", EnumConflictMode.CM_IGNORE, out errorMessage);
5355

5456

5557
try
5658
{
5759
TextResult[] results = null;
5860

5961
// 4. Read barcode from an image file
60-
results = dbr.DecodeFile("../../../../images/AllSupportedBarcodeTypes.png", "");
62+
results = reader.DecodeFile("../../../../images/AllSupportedBarcodeTypes.png", "");
6163

6264
if (results != null && results.Length > 0)
6365
{
@@ -81,6 +83,7 @@ static void Main(string[] args)
8183
{
8284
Console.WriteLine(exp.Message);
8385
}
86+
reader.Dispose();
8487
}
8588
catch (Exception exp)
8689
{

0 commit comments

Comments
 (0)