IDScan.net
Search Results for

    Show / Hide Table of Contents

    Migration Guide — .NET ID Parsing SDK

    This guide provides a step-by-step overview of the changes required to migrate from the previous version of the .NET ID Parsing SDK to the new version. It covers namespace updates, license management, checking license status, parsing trackstrings, and handling validation errors.

    This guide assumes familiarity with the previous SDK and focuses on the differences in the updated version. For licensing details, see the licensing documentation.


    1. Namespace Update

    Before:

    using IDScanNet.IDParser;
    using Nautilus; // if applicable
    

    After:

    using IDScanNet.IDParserNet.Sdk;
    

    2. License Management

    Before:

    The license was a dlplib.lic file that had to be placed in the same directory as IDScanNet.dlplib.dll, or you had to specify its directory explicitly.

    After:

    The new SDK supports two license controllers: InMemoryLicenseController for direct input, and PersistentLicenseController for caching the license locally after first validation. The license can be provided as a serial number or a license.json file.

    Option A — Serial number:

    string serialNumber = "YOUR_SERIAL_NUMBER";
    var controller = new InMemoryLicenseController(serialNumber);
    using (IDParserReader reader = new IDParserReader(controller))
    {
        // Parsing logic
    }
    

    Option B — License file:

    byte[] licenseFile = File.ReadAllBytes(@"license.json");
    var controller = new InMemoryLicenseController(licenseFile);
    using (IDParserReader reader = new IDParserReader(controller))
    {
        // Parsing logic
    }
    
    Important

    Since InMemoryLicenseController contacts the licensing server on every application start, your application will be unable to validate its license if internet access is unavailable. If connectivity may be intermittent, consider using PersistentLicenseController instead — it caches the license locally and does not require a server round-trip on subsequent starts. Note that both controllers cannot be used simultaneously without writing custom fallback logic in your application code.


    3. Checking License Status

    Before:

    DriverLicense.GetDlpLibLicenseStatus();
    

    After:

    Use WaitForLicenseResult() to synchronously obtain the result, or GetLicenseStatus() to retrieve the full status object.

    LicenseResult result = reader.WaitForLicenseResult();
    

    WaitForLicenseResult() returns a LicenseResult enum value:

    public enum LicenseResult
    {
        Unknown,
        Unlicensed,
        Licensed,
        Licensed_GracePeriod,
        Expired,
        RestrictedVersionUpdate,
        RestrictedVersion,
        RestrictedDomain,
        RestrictedHardwareFingerprint
    }
    

    For detailed license information, use GetLicenseStatus(), which returns an ILicenseStatus object:

    public interface ILicenseStatus
    {
        bool Licensed { get; }
        DateTime? LicenseExpirationDate { get; }
        string LicenseSerialNumber { get; }
        string Message { get; }
        string AllowedFeatures { get; }
    }
    

    4. Parsing Trackstrings

    Before:

    // Option 1
    DriverLicense.ParseText(trackStringData);
    
    // Option 2
    DriverLicense parser = new DriverLicense();
    var result = parser.ExtractInfo(trackStringData);
    
    // Option 3
    DriverLicenseEx.ParseText(trackStringData);
    

    After:

    Use the Parse() method on IDParserReader. It returns an IParseResult object, or null if the trackstring could not be parsed.

    var result = reader.Parse(trackStringData);
    if (result != null)
    {
        Console.WriteLine($"Parsing status: {result.Status}");
        if (result.ParsedFields != null)
        {
            Console.WriteLine($"FirstName: {result.ParsedFields.FirstName}");
            Console.WriteLine($"MiddleName: {result.ParsedFields.MiddleName}");
            Console.WriteLine($"LastName: {result.ParsedFields.LastName}");
            Console.WriteLine($"Birthdate: {result.ParsedFields.Birthdate}");
            Console.WriteLine($"Address1: {result.ParsedFields.Address1}");
            Console.WriteLine($"Address2: {result.ParsedFields.Address2}");
            Console.WriteLine($"ValidationResult: {result.ValidationResult}");
            Console.WriteLine($"Confidence: {result.Confidence}");
        }
    }
    

    5. Validation Errors

    If your license includes trackstring authenticity verification, retrieve validation results as follows:

    if (result.ValidationErrors != null)
    {
        foreach (ValidationError validError in result.ValidationErrors)
        {
            Console.WriteLine($"ResultType: {validError.ValidationResultType}");
            Console.WriteLine($"ValidationCodeNumber: {validError.ValidationCodeNumber}");
            Console.WriteLine($"Description: {validError.Description}");
            Console.WriteLine($"Weight: {validError.Weight}");
            Console.WriteLine($"TypeValidationCode: {validError.TypeValidationCode}");
        }
    }
    
    Back to top IDScan.net IDScan.net GitHub