Table of Contents

Class TextBarCodeDefinition

Namespace
Acuit.Pinpoint.Common.BarCodes
Assembly
Acuit.Pinpoint.Common.dll

A generic text bar code definition.

public class TextBarCodeDefinition : BarCodeDefinition
Inheritance
TextBarCodeDefinition
Inherited Members

Constructors

TextBarCodeDefinition(string)

Initializes a new instance of the TextBarCodeDefinition class.

public TextBarCodeDefinition(string format)

Parameters

format string

The format string, which should be a wildcard pattern with captures.

Remarks

This will validate that all number identifiers match the ones in ValidIds.

Specifying the same capture name multiple times in format is allowed, but only the last captured value will be returned via GetNumbersIfMatched(string).

Exceptions

ArgumentNullException

format is null.

FormatException

format is not valid.

TextBarCodeDefinition(string, IEnumerable<string>)

Initializes a new instance of the TextBarCodeDefinition class.

public TextBarCodeDefinition(string format, IEnumerable<string> validNumberIds)

Parameters

format string

The format string, which should be a wildcard pattern with captures.

validNumberIds IEnumerable<string>

An optional list of identifiers that will be used to validate the number identifiers in the bar code format. If this is null, the number identifiers will not be validated.

Remarks

Specifying the same capture name multiple times in format is allowed, but only the last captured value will be returned via GetNumbersIfMatched(string).

Exceptions

ArgumentNullException

format is null.

FormatException

format is not valid.

Methods

GetNumbersIfMatched(string)

Attempts to match the bar code to this bar code definition.

public override BarCodeMatch GetNumbersIfMatched(string barCode)

Parameters

barCode string

The bar code to attempt to match to this definition.

Returns

BarCodeMatch

If the bar code matches this definition, a BarCodeMatch instance containing the numbers found in the bar code; otherwise, null.

Remarks

If the bar code definition format specifies a capture name multiple times, only the last captured value for that capture name will be returned.

If the bar code matched the bar code definition, but one or more captures specified in the format were not captured, they will be returned as empty strings. For example, if the format is S{serial}|M{model} and the bar code is S1234, the numbers returned will be "1234" for "serial", and "" for "model".

Exceptions

ArgumentNullException

barCode is null.