Dev Center
Table of contents

Advanced Settings 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.DBR.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

string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = BarcodeReader.GetInstance();
if (reader != null)
{
    string errorMessage;
    EnumErrorCode error = reader.InitRuntimeSettingsWithFile(@"C:\Program Files (x86)\Dynamsoft\{Version number}\Templates\RuntimeSettings.json",     EnumConflictMode.CM_OVERWRITE, out errorMessage);
	//... add further process
    reader.Recycle();
}

InitRuntimeSettingsWithString

Initialize runtime settings with the settings in given JSON string.

EnumErrorCode Dynamsoft.DBR.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

string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = BarcodeReader.GetInstance();
if (reader != null)
{
	string errorMessage;
	EnumErrorCode error = reader.InitRuntimeSettingsWithString("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", EnumConflictMode.CM_OVERWRITE, out errorMessage);
	//... add further process
    reader.Recycle();
}

AppendTplFileToRuntimeSettings

Append a new template file to the current runtime settings.

EnumErrorCode Dynamsoft.DBR.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

string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = BarcodeReader.GetInstance();
if (reader != null)
{
	string errorMessage;
	EnumErrorCode error = reader.AppendTplFileToRuntimeSettings(@"C:\Program Files (x86)\Dynamsoft\Barcode Reader 6.4\Templates\RuntimeSettings.json", EnumConflictMode.CM_OVERWRITE, out errorMessage);
	//... add further process
    reader.Recycle();
}

AppendTplStringToRuntimeSettings

Append a new template string to the current runtime settings.

EnumErrorCode Dynamsoft.DBR.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

string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = BarcodeReader.GetInstance();
if (reader != null)
{
	string errorMessage;
	EnumErrorCode error = reader.AppendTplStringToRuntimeSettings("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", EnumConflictMode.CM_IGNORE, out errorMessage);
	//... add further process
    reader.Recycle();
}

GetAllParameterTemplateNames

Gets the parameter templates name array.

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

Return Value
The template name array.

Code Snippet

string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = BarcodeReader.GetInstance();
if (reader != null)
{
	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();
	//... add further process
    reader.Recycle();
}

OutputSettingsToFile

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

void Dynamsoft.DBR.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.

Exception
BarcodeReaderException The exception thrown by Dynamsoft Barcode Reader.

Code Snippet

string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = BarcodeReader.GetInstance();
if (reader != null)
{
	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");
	//... add further process
    reader.Recycle();
}

OutputSettingsToString

Output runtime settings to a string.

string Dynamsoft.DBR.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.

Exception
BarcodeReaderExceptionThe exception thrown by Dynamsoft Barcode Reader.

Code Snippet

string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = BarcodeReader.GetInstance();
if (reader != null)
{
	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");
	//... add further process
    reader.Recycle();
}

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • 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 +