Skip to content

Commit

Permalink
first version
Browse files Browse the repository at this point in the history
  • Loading branch information
DMGithubPublisher committed Oct 26, 2021
1 parent a08e14e commit c593123
Show file tree
Hide file tree
Showing 246 changed files with 11,009 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
################################################################################
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
################################################################################

obj/
bin/
.vs/
packages/
4 changes: 4 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
License Notice

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.
Copyright © 2003–2021 Dynamsoft. All rights reserved.
Binary file added images/AllSupportedBarcodeTypes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions samples/BarcodeReaderSamples.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30717.126
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "HelloWorld\HelloWorld.csproj", "{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeneralSettings", "GeneralSettings\GeneralSettings.csproj", "{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DecodeFromScannerAndWebcam", "UseCases\DecodeFromScannerAndWebcam\DecodeFromScannerAndWebcam.csproj", "{BECBB563-8BFD-4C68-9F62-A82BD88357D5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProcessDocumentsByBarcodes", "UseCases\ProcessDocumentsByBarcodes\ProcessDocumentsByBarcodes.csproj", "{E5A72778-8CCE-434B-B640-086C5B1D40BE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Debug|x86.ActiveCfg = Debug|Any CPU
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Debug|x86.Build.0 = Debug|Any CPU
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Release|Any CPU.Build.0 = Release|Any CPU
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Release|x86.ActiveCfg = Release|Any CPU
{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}.Release|x86.Build.0 = Release|Any CPU
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Debug|x86.ActiveCfg = Debug|Any CPU
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Debug|x86.Build.0 = Debug|Any CPU
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Release|Any CPU.Build.0 = Release|Any CPU
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Release|x86.ActiveCfg = Release|Any CPU
{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}.Release|x86.Build.0 = Release|Any CPU
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Debug|x86.ActiveCfg = Debug|x86
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Debug|x86.Build.0 = Debug|x86
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Release|Any CPU.Build.0 = Release|Any CPU
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Release|x86.ActiveCfg = Release|x86
{BECBB563-8BFD-4C68-9F62-A82BD88357D5}.Release|x86.Build.0 = Release|x86
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Debug|x86.ActiveCfg = Debug|Any CPU
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Debug|x86.Build.0 = Debug|Any CPU
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Release|Any CPU.Build.0 = Release|Any CPU
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Release|x86.ActiveCfg = Release|Any CPU
{E5A72778-8CCE-434B-B640-086C5B1D40BE}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AFBF8B73-CABC-4914-BB17-E4385803C9F4}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions samples/GeneralSettings/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
67 changes: 67 additions & 0 deletions samples/GeneralSettings/GeneralSettings.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1BF547FD-D93B-472B-9BBF-2DB2E8C734B2}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>GeneralSettings</RootNamespace>
<AssemblyName>GeneralSettings</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Dynamsoft.BarcodeReader, Version=8.8.0.831, Culture=neutral, PublicKeyToken=ad0967c36e09320a, processorArchitecture=MSIL">
<HintPath>..\packages\Dynamsoft.DotNet.Barcode.8.8.0\lib\net40\Dynamsoft.BarcodeReader.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="DynamsoftCommon, Version=1.1.0.0, Culture=neutral, PublicKeyToken=ad0967c36e09320a, processorArchitecture=MSIL">
<HintPath>..\packages\Dynamsoft.DotNet.Barcode.8.8.0\lib\net40\DynamsoftCommon.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<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')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<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>
</PropertyGroup>
<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'))" />
<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'))" />
</Target>
<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')" />
</Project>
104 changes: 104 additions & 0 deletions samples/GeneralSettings/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
using System;
using Dynamsoft;
using Dynamsoft.DBR;

namespace GeneralSettings
{
class Program
{
static void Main(string[] args)
{
try
{
// 1. Initialize license
/*
// By setting organizaion ID as "200001", a 7-day trial license will be used for license verification.
// Note that network connection is required for this license to work.
//
// When using your own license, locate the following line and specify your Organization ID.
// organizationID = "200001";
//
// 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
*/
DMDLSConnectionParameters connectionInfo = BarcodeReader.InitDLSConnectionParameters();
connectionInfo.OrganizationID = "200001";
EnumErrorCode errorCode = BarcodeReader.InitLicenseFromDLS(connectionInfo, out string errorMsg);
if (errorCode != EnumErrorCode.DBR_SUCCESS)
{
Console.WriteLine(errorMsg);
}

// 2. Create an instance of Barcode Reader
BarcodeReader dbr = new BarcodeReader();

// 3. Configure settings

// 3.1 Through PublicRuntimeSetting

// 3.1.1 Call GetRuntimeSettings to get current runtime settings.
PublicRuntimeSettings settings = dbr.GetRuntimeSettings();

// 3.1.2 Configure one or more specific settings
// In this sample, we configure three settings:
// try to finnd PDF 417 and DotCode
settings.BarcodeFormatIds = (int)EnumBarcodeFormat.BF_PDF417;
settings.BarcodeFormatIds_2 = (int)EnumBarcodeFormat_2.BF2_DOTCODE;
// try to find 2 barcodes
settings.ExpectedBarcodesCount = 2;
// try to find barcodes in the lower part of the image
settings.Region.RegionLeft = 0;
settings.Region.RegionRight = 100;
settings.Region.RegionTop = 50;
settings.Region.RegionBottom = 100;
settings.Region.RegionMeasuredByPercentage = 1;

// 3.1.3 Call UpdateRuntimeSettings to apply above settings
dbr.UpdateRuntimeSettings(settings);

// 3.2 Through JSON template
//string errorMessage;
//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);


try
{
TextResult[] results = null;

// 4. Read barcode from an image file
results = dbr.DecodeFile("../../../../images/AllSupportedBarcodeTypes.png", "");

if (results != null && results.Length > 0)
{
for (int i = 0; i < results.Length; ++i)
{
Console.WriteLine("Result " + (i + 1).ToString() + ":");

// 5. Get format of each barcode
if (results[i].BarcodeFormat != EnumBarcodeFormat.BF_NULL)
Console.WriteLine(" Barcode Format: " + results[i].BarcodeFormatString);
else
Console.WriteLine(" Barcode Format: " + results[i].BarcodeFormatString_2);

// 6. Get text result of each barcode
Console.WriteLine(" Barcode Text: " + results[i].BarcodeText);
}
}
else
{
Console.WriteLine("No barcode detected.");
}
}
catch (BarcodeReaderException exp)
{
Console.WriteLine(exp.Message);
}
}
catch (Exception exp)
{
Console.WriteLine(exp.Message);
}
Console.WriteLine("Press any key to quit...");
Console.ReadKey();
}
}
}
35 changes: 35 additions & 0 deletions samples/GeneralSettings/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GeneralSettings")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GeneralSettings")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1bf547fd-d93b-472b-9bbf-2db2e8c734b2")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
4 changes: 4 additions & 0 deletions samples/GeneralSettings/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Dynamsoft.DotNet.Barcode" version="8.8.0" targetFramework="net472" />
</packages>
6 changes: 6 additions & 0 deletions samples/HelloWorld/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
</configuration>
63 changes: 63 additions & 0 deletions samples/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{93A25FAE-0618-4B06-A7C6-F32E75DCE06A}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>HelloWorld</RootNamespace>
<AssemblyName>HelloWorld</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Dynamsoft.BarcodeReader, Version=8.8.0.831, Culture=neutral, PublicKeyToken=ad0967c36e09320a, processorArchitecture=MSIL">
<HintPath>..\packages\Dynamsoft.DotNet.Barcode.8.8.0\lib\net40\Dynamsoft.BarcodeReader.dll</HintPath>
</Reference>
<Reference Include="DynamsoftCommon, Version=1.1.0.0, Culture=neutral, PublicKeyToken=ad0967c36e09320a, processorArchitecture=MSIL">
<HintPath>..\packages\Dynamsoft.DotNet.Barcode.8.8.0\lib\net40\DynamsoftCommon.dll</HintPath>
</Reference>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<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')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<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>
</PropertyGroup>
<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'))" />
</Target>
</Project>
Loading

0 comments on commit c593123

Please sign in to comment.