IdParser.Core
2.0.0-alpha3
See the version list below for details.
dotnet add package IdParser.Core --version 2.0.0-alpha3
NuGet\Install-Package IdParser.Core -Version 2.0.0-alpha3
<PackageReference Include="IdParser.Core" Version="2.0.0-alpha3" />
paket add IdParser.Core --version 2.0.0-alpha3
#r "nuget: IdParser.Core, 2.0.0-alpha3"
// Install IdParser.Core as a Cake Addin #addin nuget:?package=IdParser.Core&version=2.0.0-alpha3&prerelease // Install IdParser.Core as a Cake Tool #tool nuget:?package=IdParser.Core&version=2.0.0-alpha3&prerelease
IdParser.Core
This is a fork of Connor O'Shea's IdParser library. Big thanks to him for all of his work.
The main changes I made are:
- Dropped support for
.NET Framework
. If you need that, please use the originalIdParser
. - Supports only
.NET 6
and above. If you need support for earlier versions of.NET
/.NET Core
, please use the originalIdParser
. - The parser classes are now static and no longer instantiated by
Activator.CreateInstance
. This reduced memory allocations per call considerably, and also sped things up. - The
Abbreviation
,Country
, andDescription
attribute values are now cached so that we don't have to repeatedly use reflection to get their values. - Unhandled parsing exceptions are now rethrown, regardless of what the caller passes for the validation level (
None
orStrict
). - Where possible, modernized the code base to use newer framework and language features, such as
Span<T>
. - The return value of
Parse
is now an object that returns both the ID card and a collection of any unknown element Ids. Parse
now accepts an optionalTextWriter
parameter. When not null, the library will log to theTextWriter
.
The original README follows, slightly modified to match this updated version of the library.
ID Parser
ID Parser can be used to parse AAMVA-compliant driver's licenses and ID cards into objects that you can work with. More information on the versions of the AAMVA standard can be found here. More information on the D20 Data Dictionary can be found here.
Usage
- Include the using
using IdParser.Core;
- Then you're off to the races!
var parseResult = Barcode.Parse(barcode);
Console.WriteLine(parseResult.Card.Address.StreetLine1); // "123 NORTH STATE ST."
Console.WriteLine(parseResult.Card.IssuerIdentificationNumber.GetDescriptionOrDefault()); // "New York"
if (parseResult.Card is DriversLicense license)
{
Console.WriteLine(license.Jurisdiction.VehicleClass); // "C"
}
More Examples
Take a look at the unit test project for more examples and usage.
Client
The IdParser.Core.Client
project is a handy GUI application to help test and verify that an ID
will be parsed correctly. The app works with both OPOS and HID keyboard emulation scanners.
FAQ
I can't build
IdParser.Core.Client
. It's missing a required dependency. You need to have Microsoft POS for .NET installed. TheMicrosoft.PointOfService
dll is GAC'd and will allow you to build and run the client app.The
Height
class has the wrongTotalInches
orCentimeters
. The AAMVA standard has no decimal places in the height subfile record. As a result, the conversion between inches and centimeters will be off.The library is throwing
ArgumentExcpetions
for every barcode I'm passing in. By default, all barcodes are parsed using theStrict
validation level. All barcodes are expected to adhere exactly to the AAMVA standard as defined in the PDFs for parsing to succeed. This is the recommended level for scanners using OPOS. However, if HID keyboard emulation is used, especially when scanning using a web browser, the expected data can become malformed. You can try using theNone
validation level, however this is not guaranteed to work in all cases. Data elements may be skipped and exceptions may still be thrown.
Find IDs Not in Tests Regex
DAJ(?!(AL|AR|AZ|AK|CA|CO|CT|DE|FL|GA|HI|IA|ID|IL|IN|KS|KY|LA|MA|MD|ME|MI|MN|MO|MS|MT|NC|ND|NH|NJ|NM|NV|NY|OH|ON|OR|PA|PE|PR|RI|SC|TN|TX|UT|VA|VT|WA|WI|WV|QC|OK|NS|NE|NB|AB|SD|DC))[A-Z]+
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.1.0 | 53 | 11/20/2024 |
3.0.0 | 481 | 3/28/2024 |
3.0.0-beta3 | 119 | 3/21/2024 |
3.0.0-beta2 | 79 | 3/21/2024 |
3.0.0-beta1 | 102 | 3/12/2024 |
3.0.0-alpha2 | 87 | 3/12/2024 |
3.0.0-alpha1 | 105 | 3/7/2024 |
2.0.0 | 143 | 3/7/2024 |
2.0.0-alpha5 | 184 | 1/10/2024 |
2.0.0-alpha4 | 96 | 1/10/2024 |
2.0.0-alpha3 | 86 | 1/10/2024 |
2.0.0-alpha2 | 133 | 12/23/2023 |
2.0.0-alpha1 | 135 | 12/16/2023 |
1.1.0 | 278 | 12/14/2023 |
1.0.4 | 212 | 12/5/2023 |
1.0.3 | 224 | 10/26/2023 |
1.0.2 | 184 | 9/27/2023 |
1.0.1 | 160 | 9/27/2023 |
1.0.0 | 150 | 9/20/2023 |
1.0.0-beta8 | 146 | 9/8/2023 |
1.0.0-beta7 | 140 | 9/8/2023 |
1.0.0-beta6 | 136 | 9/8/2023 |
1.0.0-beta5 | 134 | 9/8/2023 |
1.0.0-beta4 | 148 | 8/8/2023 |
1.0.0-beta3 | 152 | 7/24/2023 |
1.0.0-beta2 | 150 | 7/23/2023 |
1.0.0-beta1 | 146 | 7/22/2023 |
1.0.0-alpha9 | 149 | 7/22/2023 |
1.0.0-alpha8 | 144 | 7/22/2023 |
1.0.0-alpha7 | 159 | 7/22/2023 |
1.0.0-alpha6 | 153 | 7/22/2023 |
1.0.0-alpha5 | 144 | 7/22/2023 |
1.0.0-alpha4 | 143 | 7/22/2023 |
1.0.0-alpha3 | 145 | 7/22/2023 |
1.0.0-alpha2 | 139 | 7/22/2023 |
1.0.0-alpha11 | 150 | 7/22/2023 |
1.0.0-alpha10 | 148 | 7/22/2023 |
1.0.0-alpha1 | 141 | 7/22/2023 |