Skip to content

Commit c593123

Browse files
first version
1 parent a08e14e commit c593123

File tree

246 files changed

+11009
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+11009
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
################################################################################
2+
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
3+
################################################################################
4+
5+
obj/
6+
bin/
7+
.vs/
8+
packages/

LICENSE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
License Notice
2+
3+
This folder contains code samples ("Sample Code") for use with Dynamsoft Barcode Reader, a commercial software development kit licensed by Dynamsoft. The Sample Code may be modified and included in your end user software under the terms of the Dynamsoft Software License Agreement  https://www.dynamsoft.com/Products/barcode-reader-license-agreement.aspx ("Commercial License"). Except as expressly stated in the Commercial License, no other rights are granted in the Sample Code. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4+
Copyright © 2003–2021 Dynamsoft. All rights reserved.
335 KB
Loading

samples/BarcodeReaderSamples.sln

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30717.126
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "HelloWorld\HelloWorld.csproj", "{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeneralSettings", "GeneralSettings\GeneralSettings.csproj", "{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DecodeFromScannerAndWebcam", "UseCases\DecodeFromScannerAndWebcam\DecodeFromScannerAndWebcam.csproj", "{BECBB563-8BFD-4C68-9F62-A82BD88357D5}"
11+
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProcessDocumentsByBarcodes", "UseCases\ProcessDocumentsByBarcodes\ProcessDocumentsByBarcodes.csproj", "{E5A72778-8CCE-434B-B640-086C5B1D40BE}"
13+
EndProject
14+
Global
15+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
16+
Debug|Any CPU = Debug|Any CPU
17+
Debug|x86 = Debug|x86
18+
Release|Any CPU = Release|Any CPU
19+
Release|x86 = Release|x86
20+
EndGlobalSection
21+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22+
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Debug|x86.ActiveCfg = Debug|Any CPU
25+
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Debug|x86.Build.0 = Debug|Any CPU
26+
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Release|Any CPU.ActiveCfg = Release|Any CPU
27+
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Release|x86.ActiveCfg = Release|Any CPU
29+
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Release|x86.Build.0 = Release|Any CPU
30+
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31+
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
32+
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Debug|x86.ActiveCfg = Debug|Any CPU
33+
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Debug|x86.Build.0 = Debug|Any CPU
34+
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Release|Any CPU.Build.0 = Release|Any CPU
36+
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Release|x86.ActiveCfg = Release|Any CPU
37+
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Release|x86.Build.0 = Release|Any CPU
38+
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39+
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
40+
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Debug|x86.ActiveCfg = Debug|x86
41+
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Debug|x86.Build.0 = Debug|x86
42+
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
43+
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Release|Any CPU.Build.0 = Release|Any CPU
44+
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Release|x86.ActiveCfg = Release|x86
45+
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Release|x86.Build.0 = Release|x86
46+
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47+
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
48+
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Debug|x86.ActiveCfg = Debug|Any CPU
49+
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Debug|x86.Build.0 = Debug|Any CPU
50+
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
51+
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Release|Any CPU.Build.0 = Release|Any CPU
52+
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Release|x86.ActiveCfg = Release|Any CPU
53+
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Release|x86.Build.0 = Release|Any CPU
54+
EndGlobalSection
55+
GlobalSection(SolutionProperties) = preSolution
56+
HideSolutionNode = FALSE
57+
EndGlobalSection
58+
GlobalSection(ExtensibilityGlobals) = postSolution
59+
SolutionGuid = {AFBF8B73-CABC-4914-BB17-E4385803C9F4}
60+
EndGlobalSection
61+
EndGlobal

samples/GeneralSettings/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5+
</startup>
6+
</configuration>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>GeneralSettings</RootNamespace>
10+
<AssemblyName>GeneralSettings</AssemblyName>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
<NuGetPackageImportStamp>
16+
</NuGetPackageImportStamp>
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
<PlatformTarget>AnyCPU</PlatformTarget>
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>bin\Debug\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<PlatformTarget>AnyCPU</PlatformTarget>
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="Dynamsoft.BarcodeReader, Version=8.8.0.831, Culture=neutral, PublicKeyToken=ad0967c36e09320a, processorArchitecture=MSIL">
39+
<HintPath>..\packages\Dynamsoft.DotNet.Barcode.8.8.0\lib\net40\Dynamsoft.BarcodeReader.dll</HintPath>
40+
<Private>True</Private>
41+
</Reference>
42+
<Reference Include="DynamsoftCommon, Version=1.1.0.0, Culture=neutral, PublicKeyToken=ad0967c36e09320a, processorArchitecture=MSIL">
43+
<HintPath>..\packages\Dynamsoft.DotNet.Barcode.8.8.0\lib\net40\DynamsoftCommon.dll</HintPath>
44+
<Private>True</Private>
45+
</Reference>
46+
<Reference Include="System" />
47+
<Reference Include="Microsoft.CSharp" />
48+
</ItemGroup>
49+
<ItemGroup>
50+
<Compile Include="Program.cs" />
51+
<Compile Include="Properties\AssemblyInfo.cs" />
52+
</ItemGroup>
53+
<ItemGroup>
54+
<None Include="App.config" />
55+
<None Include="packages.config" />
56+
</ItemGroup>
57+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
58+
<Import Project="..\packages\Dynamsoft.DotNet.Barcode.8.8.0\build\Dynamsoft.DotNet.Barcode.targets" Condition="Exists('..\packages\Dynamsoft.DotNet.Barcode.8.8.0\build\Dynamsoft.DotNet.Barcode.targets')" />
59+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
60+
<PropertyGroup>
61+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
62+
</PropertyGroup>
63+
<Error Condition="!Exists('..\packages\Dynamsoft.DotNet.Barcode.8.8.0\build\Dynamsoft.DotNet.Barcode.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Dynamsoft.DotNet.Barcode.8.8.0\build\Dynamsoft.DotNet.Barcode.targets'))" />
64+
<Error Condition="!Exists('..\packages\Dynamsoft.DotNet.Barcode.8.8.0\build\Dynamsoft.DotNet.Barcode.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Dynamsoft.DotNet.Barcode.8.8.0\build\Dynamsoft.DotNet.Barcode.targets'))" />
65+
</Target>
66+
<Import Project="..\packages\Dynamsoft.DotNet.Barcode.8.8.0\build\Dynamsoft.DotNet.Barcode.targets" Condition="Exists('..\packages\Dynamsoft.DotNet.Barcode.8.8.0\build\Dynamsoft.DotNet.Barcode.targets')" />
67+
</Project>

samples/GeneralSettings/Program.cs

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
using System;
2+
using Dynamsoft;
3+
using Dynamsoft.DBR;
4+
5+
namespace GeneralSettings
6+
{
7+
class Program
8+
{
9+
static void Main(string[] args)
10+
{
11+
try
12+
{
13+
// 1. Initialize license
14+
/*
15+
// By setting organizaion ID as "200001", a 7-day trial license will be used for license verification.
16+
// Note that network connection is required for this license to work.
17+
//
18+
// When using your own license, locate the following line and specify your Organization ID.
19+
// organizationID = "200001";
20+
//
21+
// If you don't have a license yet, you can request a trial from https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=dotnet
22+
*/
23+
DMDLSConnectionParameters connectionInfo = BarcodeReader.InitDLSConnectionParameters();
24+
connectionInfo.OrganizationID = "200001";
25+
EnumErrorCode errorCode = BarcodeReader.InitLicenseFromDLS(connectionInfo, out string errorMsg);
26+
if (errorCode != EnumErrorCode.DBR_SUCCESS)
27+
{
28+
Console.WriteLine(errorMsg);
29+
}
30+
31+
// 2. Create an instance of Barcode Reader
32+
BarcodeReader dbr = new BarcodeReader();
33+
34+
// 3. Configure settings
35+
36+
// 3.1 Through PublicRuntimeSetting
37+
38+
// 3.1.1 Call GetRuntimeSettings to get current runtime settings.
39+
PublicRuntimeSettings settings = dbr.GetRuntimeSettings();
40+
41+
// 3.1.2 Configure one or more specific settings
42+
// In this sample, we configure three settings:
43+
// try to finnd PDF 417 and DotCode
44+
settings.BarcodeFormatIds = (int)EnumBarcodeFormat.BF_PDF417;
45+
settings.BarcodeFormatIds_2 = (int)EnumBarcodeFormat_2.BF2_DOTCODE;
46+
// try to find 2 barcodes
47+
settings.ExpectedBarcodesCount = 2;
48+
// try to find barcodes in the lower part of the image
49+
settings.Region.RegionLeft = 0;
50+
settings.Region.RegionRight = 100;
51+
settings.Region.RegionTop = 50;
52+
settings.Region.RegionBottom = 100;
53+
settings.Region.RegionMeasuredByPercentage = 1;
54+
55+
// 3.1.3 Call UpdateRuntimeSettings to apply above settings
56+
dbr.UpdateRuntimeSettings(settings);
57+
58+
// 3.2 Through JSON template
59+
//string errorMessage;
60+
//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);
61+
62+
63+
try
64+
{
65+
TextResult[] results = null;
66+
67+
// 4. Read barcode from an image file
68+
results = dbr.DecodeFile("../../../../images/AllSupportedBarcodeTypes.png", "");
69+
70+
if (results != null && results.Length > 0)
71+
{
72+
for (int i = 0; i < results.Length; ++i)
73+
{
74+
Console.WriteLine("Result " + (i + 1).ToString() + ":");
75+
76+
// 5. Get format of each barcode
77+
if (results[i].BarcodeFormat != EnumBarcodeFormat.BF_NULL)
78+
Console.WriteLine(" Barcode Format: " + results[i].BarcodeFormatString);
79+
else
80+
Console.WriteLine(" Barcode Format: " + results[i].BarcodeFormatString_2);
81+
82+
// 6. Get text result of each barcode
83+
Console.WriteLine(" Barcode Text: " + results[i].BarcodeText);
84+
}
85+
}
86+
else
87+
{
88+
Console.WriteLine("No barcode detected.");
89+
}
90+
}
91+
catch (BarcodeReaderException exp)
92+
{
93+
Console.WriteLine(exp.Message);
94+
}
95+
}
96+
catch (Exception exp)
97+
{
98+
Console.WriteLine(exp.Message);
99+
}
100+
Console.WriteLine("Press any key to quit...");
101+
Console.ReadKey();
102+
}
103+
}
104+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
4+
// General Information about an assembly is controlled through the following
5+
// set of attributes. Change these attribute values to modify the information
6+
// associated with an assembly.
7+
[assembly: AssemblyTitle("GeneralSettings")]
8+
[assembly: AssemblyDescription("")]
9+
[assembly: AssemblyConfiguration("")]
10+
[assembly: AssemblyCompany("")]
11+
[assembly: AssemblyProduct("GeneralSettings")]
12+
[assembly: AssemblyCopyright("Copyright © 2021")]
13+
[assembly: AssemblyTrademark("")]
14+
[assembly: AssemblyCulture("")]
15+
16+
// Setting ComVisible to false makes the types in this assembly not visible
17+
// to COM components. If you need to access a type in this assembly from
18+
// COM, set the ComVisible attribute to true on that type.
19+
[assembly: ComVisible(false)]
20+
21+
// The following GUID is for the ID of the typelib if this project is exposed to COM
22+
[assembly: Guid("1bf547fd-d93b-472b-9bbf-2db2e8c734b2")]
23+
24+
// Version information for an assembly consists of the following four values:
25+
//
26+
// Major Version
27+
// Minor Version
28+
// Build Number
29+
// Revision
30+
//
31+
// You can specify all the values or you can default the Build and Revision Numbers
32+
// by using the '*' as shown below:
33+
// [assembly: AssemblyVersion("1.0.*")]
34+
[assembly: AssemblyVersion("1.0.0.0")]
35+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Dynamsoft.DotNet.Barcode" version="8.8.0" targetFramework="net472" />
4+
</packages>

samples/HelloWorld/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
5+
</startup>
6+
</configuration>

0 commit comments

Comments
 (0)