Skip to content

Commit 107b1e8

Browse files
update to v10.4.20
1 parent 7aad822 commit 107b1e8

File tree

11 files changed

+56
-55
lines changed

11 files changed

+56
-55
lines changed

.gitignore

Lines changed: 0 additions & 8 deletions
This file was deleted.
-163 KB
Binary file not shown.

Images/GS1 DataBar.png

69.3 KB
Loading

Images/GeneralBarcodes.png

140 KB
Loading

Images/PatchCode.png

13.6 KB
Loading

Images/Pharmacode.png

7.48 KB
Loading

Images/PostalCode.png

50.6 KB
Loading

Samples/HelloWorld/ReadAnImage/ReadAnImage.cs

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,44 @@ static void Main(string[] args)
1010
{
1111
int errorCode = 1;
1212
string errorMsg;
13+
14+
// Initialize license.
15+
// You can request and extend a trial license from https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=dotnet
16+
// The string 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9' here is a free public trial license. Note that network connection is required for this license to work.
1317
errorCode = LicenseManager.InitLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", out errorMsg);
14-
if (errorCode != (int)EnumErrorCode.EC_OK)
15-
Console.WriteLine("License initialization error: " + errorMsg);
16-
using (CaptureVisionRouter cvr = new CaptureVisionRouter())
18+
19+
if (errorCode != (int)EnumErrorCode.EC_OK && errorCode != (int)EnumErrorCode.EC_LICENSE_CACHE_USED)
1720
{
18-
string imageFile = "../../../../../../Images/AllSupportedBarcodeTypes.png";
19-
CapturedResult? result = cvr.Capture(imageFile, PresetTemplate.PT_READ_BARCODES);
20-
if (result == null)
21-
{
22-
Console.WriteLine("No barcode detected.");
23-
}
24-
else if (result.GetErrorCode() != 0)
25-
{
26-
Console.WriteLine("Error: " + result.GetErrorCode() + ", " + result.GetErrorString());
27-
}
28-
else
21+
Console.WriteLine("License initialization failed: ErrorCode: " + errorCode + ", ErrorString: " + errorMsg);
22+
}
23+
else
24+
{
25+
using (CaptureVisionRouter cvr = new CaptureVisionRouter())
2926
{
30-
DecodedBarcodesResult? barcodesResult = result.GetDecodedBarcodesResult();
31-
if (barcodesResult != null)
27+
string imageFile = "../../../../../../Images/GeneralBarcodes.png";
28+
CapturedResult? result = cvr.Capture(imageFile, PresetTemplate.PT_READ_BARCODES);
29+
if (result == null)
30+
{
31+
Console.WriteLine("No barcode detected.");
32+
}
33+
else
3234
{
33-
BarcodeResultItem[] items = barcodesResult.GetItems();
34-
Console.WriteLine("Decoded " + items.Length + " barcodes");
35-
foreach (BarcodeResultItem barcodeItem in items)
35+
if (result.GetErrorCode() != 0)
36+
{
37+
Console.WriteLine("Error: " + result.GetErrorCode() + ", " + result.GetErrorString());
38+
}
39+
40+
DecodedBarcodesResult? barcodesResult = result.GetDecodedBarcodesResult();
41+
if (barcodesResult != null)
3642
{
37-
Console.WriteLine("Result " + (Array.IndexOf(items, barcodeItem) + 1));
38-
Console.WriteLine("Barcode Format: " + barcodeItem.GetFormatString());
39-
Console.WriteLine("Barcode Text: " + barcodeItem.GetText());
43+
BarcodeResultItem[] items = barcodesResult.GetItems();
44+
Console.WriteLine("Decoded " + items.Length + " barcodes");
45+
foreach (BarcodeResultItem barcodeItem in items)
46+
{
47+
Console.WriteLine("Result " + (Array.IndexOf(items, barcodeItem) + 1));
48+
Console.WriteLine("Barcode Format: " + barcodeItem.GetFormatString());
49+
Console.WriteLine("Barcode Text: " + barcodeItem.GetText());
50+
}
4051
}
4152
}
4253
}

Samples/HelloWorld/ReadAnImage/ReadAnImage.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
99

1010

1111
<ItemGroup>
12-
<PackageReference Include="Dynamsoft.DotNet.BarcodeReader.Bundle" Version="10.2.1200" />
13-
14-
15-
16-
12+
<PackageReference Include="Dynamsoft.DotNet.BarcodeReader.Bundle" Version="10.4.2000" />
1713
</ItemGroup>
1814

1915
</Project>

Samples/HelloWorld/ReadMultipleImages/ReadMultipleImages.cs

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,34 @@ static void Main(string[] args)
5555
{
5656
int errorCode = 1;
5757
string errorMsg;
58+
59+
// Initialize license.
60+
// You can request and extend a trial license from https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=dotnet
61+
// The string 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9' here is a free public trial license. Note that network connection is required for this license to work.
5862
errorCode = LicenseManager.InitLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", out errorMsg);
59-
if (errorCode != (int)EnumErrorCode.EC_OK)
63+
if (errorCode != (int)EnumErrorCode.EC_OK && errorCode != (int)EnumErrorCode.EC_LICENSE_CACHE_USED)
6064
{
61-
Console.WriteLine("License initialization error: " + errorMsg);
65+
Console.WriteLine("License initialization failed: ErrorCode: " + errorCode + ", ErrorString: " + errorMsg);
6266
}
63-
using (CaptureVisionRouter cvr = new CaptureVisionRouter())
64-
using (DirectoryFetcher fetcher = new DirectoryFetcher())
67+
else
6568
{
66-
fetcher.SetDirectory("../../../../../../Images");
67-
cvr.SetInput(fetcher);
69+
using (CaptureVisionRouter cvr = new CaptureVisionRouter())
70+
using (DirectoryFetcher fetcher = new DirectoryFetcher())
71+
{
72+
fetcher.SetDirectory("../../../../../../Images");
73+
cvr.SetInput(fetcher);
6874

69-
CapturedResultReceiver receiver = new MyCapturedResultReceiver();
70-
cvr.AddResultReceiver(receiver);
75+
CapturedResultReceiver receiver = new MyCapturedResultReceiver();
76+
cvr.AddResultReceiver(receiver);
7177

72-
MyImageSourceStateListener listener = new MyImageSourceStateListener(cvr);
73-
cvr.AddImageSourceStateListener(listener);
78+
MyImageSourceStateListener listener = new MyImageSourceStateListener(cvr);
79+
cvr.AddImageSourceStateListener(listener);
7480

75-
errorCode = cvr.StartCapturing(PresetTemplate.PT_READ_BARCODES, true, out errorMsg);
76-
if (errorCode != (int)EnumErrorCode.EC_OK)
77-
{
78-
Console.WriteLine("error: " + errorMsg);
81+
errorCode = cvr.StartCapturing(PresetTemplate.PT_READ_BARCODES, true, out errorMsg);
82+
if (errorCode != (int)EnumErrorCode.EC_OK)
83+
{
84+
Console.WriteLine("error: " + errorMsg);
85+
}
7986
}
8087
}
8188
Console.WriteLine("Press any key to quit...");

0 commit comments

Comments
 (0)