Dev Center
Table of contents

.Net API Reference - BarcodeReader Parameter and Runtime Settings Advanced Methods

Method Description
InitRuntimeSettingsWithFile Initializes runtime settings with the settings in a given JSON file.
InitRuntimeSettingsWithString Initializes runtime settings with the settings in a given JSON string.
AppendTplFileToRuntimeSettings Appends a new template file to the current runtime settings.
AppendTplStringToRuntimeSettings Appends a new template string to the current runtime settings.
GetAllParameterTemplateNames Gets the parameter templates name array.
OutputSettingsToFile Outputs runtime settings to a settings file (JSON file).
OutputSettingsToString Outputs runtime settings to a string.

InitRuntimeSettingsWithFile

Initialize runtime settings with the settings in a given JSON file.

EnumErrorCode Dynamsoft.Barcode.BarcodeReader.InitRuntimeSettingsWithFile(string jsonFileName, EnumConflictMode conflictMode, out string errorMessage)

Parameters

[in] jsonFileName <string> : The path of the settings file.
[in] conflictMode <EnumConflictMode> : The parameter setting mode, which decides to inherit parameters from previous template setting or overwrite previous settings and replace by new template.
[in,out] errorMessage <string> : Output parameter storing detailed error message.

Return value

Returns error code.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
string errorMessage;
EnumErrorCode error = reader.InitRuntimeSettingsWithFile(@"C:\Program Files (x86)\Dynamsoft\{Version number}\Templates\RuntimeSettings.json", EnumConflictMode.CM_OVERWRITE, out errorMessage);
reader.Dispose();

InitRuntimeSettingsWithString

Initialize runtime settings with the settings in given JSON string.

EnumErrorCode Dynamsoft.Barcode.BarcodeReader.InitRuntimeSettingsWithString(string jsonContent, EnumConflictMode conflictMode, out string errorMessage)

Parameters

[in] jsonContent <string> : A JSON string that represents the content of the settings.
[in] conflictMode <EnumConflictMode> : The parameter setting mode, which decides to inherit parameters from previous template setting or overwrite previous settings and replace by new template.
[in,out] errorMessage <string> : Output parameter storing detailed error message.

Return value

Returns error code.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
string errorMessage;
EnumErrorCode error = reader.InitRuntimeSettingsWithString("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", EnumConflictMode.CM_OVERWRITE, out errorMessage);
reader.Dispose();

AppendTplFileToRuntimeSettings

Append a new template file to the current runtime settings.

EnumErrorCode Dynamsoft.Barcode.BarcodeReader.AppendTplFileToRuntimeSettings(string jsonFileName, EnumConflictMode conflictMode, out string errorMessage)

Parameters

[in] jsonFileName <string> : The path of the settings file.
[in] conflictMode <EnumConflictMode> : The parameter setting mode, which decides to inherit parameters from previous template setting or overwrite previous settings and replace by new template.
[in,out] errorMessage <string> : Output parameter storing detailed error message.

Return value

Returns error code.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
string errorMessage;
EnumErrorCode error = reader.AppendTplFileToRuntimeSettings(@"C:\Program Files (x86)\Dynamsoft\Barcode Reader 6.4\Templates\RuntimeSettings.json", EnumConflictMode.CM_OVERWRITE, out errorMessage);
reader.Dispose();

AppendTplStringToRuntimeSettings

Append a new template string to the current runtime settings.

EnumErrorCode Dynamsoft.Barcode.BarcodeReader.AppendTplStringToRuntimeSettings(string  jsonContent, EnumConflictMode  conflictMode, out string errorMessage) 

Parameters

[in] jsonContent <string> : A JSON string that represents the content of the settings.
[in] conflictMode <EnumConflictMode> : The parameter setting mode, which decides to inherit parameters from previous template setting or overwrite previous settings and replace by new template.
[in,out] errorMessage <string> : Output parameter storing detailed error message.

Return value

Returns error code.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
string errorMessage;
EnumErrorCode error = reader.AppendTplStringToRuntimeSettings("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", EnumConflictMode.CM_IGNORE, out errorMessage);
reader.Dispose();

GetAllParameterTemplateNames

Gets the parameter templates name array.

string[] Dynamsoft.Barcode.BarcodeReader.GetAllParameterTemplateNames()

Return value

The template name array.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
string errorMessage;
reader.InitRuntimeSettingsWithFile(@"C:\Program Files (x86)\Dynamsoft\{Version number}\Templates\RuntimeSettings.json", EnumConflictMode.CM_OVERWRITE, out errorMessage);
reader.AppendTplStringToRuntimeSettings("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", EnumConflictMode.CM_IGNORE, out errorMessage);
string[] templateNameArray = reader.GetAllParameterTemplateNames();
reader.Dispose();

OutputSettingsToFile

Output runtime settings to a settings file (JSON file).

void Dynamsoft.Barcode.BarcodeReader.OutputSettingsToFile(string outputFilePath, string settingsName)

Parameters

[in] outputFilePath <string> : The output file path which stores current settings.
[in] settingsName <string> : A unique name for declaring current runtime settings.

Exceptions

BarcodeReaderException The exception thrown by Dynamsoft Barcode Reader.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
string errorMessage;
reader.InitRuntimeSettingsWithFile(@"C:\Program Files (x86)\Dynamsoft\{Version number}\Templates\RuntimeSettings.json", EnumConflictMode.CM_OVERWRITE, out errorMessage);
reader.AppendTplStringToRuntimeSettings("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", EnumConflictMode.CM_IGNORE, out errorMessage);
reader.OutputSettingsToFile(@"C:\Program Files (x86)\Dynamsoft\{Version number}\Templates\CurrentRuntimeSettings.json", "currentRuntimeSettings");
reader.Dispose();

OutputSettingsToString

Output runtime settings to a string.

string Dynamsoft.Barcode.BarcodeReader.OutputSettingsToString(string settingsName)

Parameters

[in] settingsName <string> : A unique name for declaring current runtime settings.

Return value

The output string which stores the contents of current settings.

Exceptions

BarcodeReaderExceptionThe exception thrown by Dynamsoft Barcode Reader.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
string errorMessage;
reader.InitRuntimeSettingsWithFile(@"C:\Program Files (x86)\Dynamsoft\{Version number}\Templates\RuntimeSettings.json", EnumConflictMode.CM_OVERWRITE, out errorMessage);
reader.AppendTplStringToRuntimeSettings("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", EnumConflictMode.CM_IGNORE, out errorMessage);
string currentSettings = reader.OutputSettingsToString("currentRuntimeSettings");
reader.Dispose();

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

version 7.6.0

  • Latest version
  • Version 10.x
    • Version 10.2.0
    • Version 10.0.20
    • Version 10.0.10
    • Version 10.0.0
  • Version 9.x
    • Version 9.6.40
    • Version 9.6.30
    • Version 9.6.20
    • Version 9.6.10
    • Version 9.6.0
    • Version 9.4.0
    • Version 9.2.0
    • Version 9.0.0
  • Version 8.x
    • Version 8.8.0
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.0
    • Version 8.1.2
    • Version 8.1.0
    • Version 8.0.0
  • Version 7.x
    • Version 7.6.0
    • Version 7.5.0
Change +