我能够从条形码中提取代码,但是当从 OHIO 驾驶执照中读取磁性脚本时,我似乎无法像 PDF417 那样获得以许可证号为前缀的两个字母代码。
Private Sub ScannDLButton_Click(sender As Object, e As EventArgs) Handles ScanDLButton.Click
Try
Dim strInputBox As String = InputBox("Please Swipe/Scan Customer's Driver's License", "Driver's License")
Dim strLastName As String
Dim strFirstName As String
Dim strMiddleName As String
Dim strDOB As String
Dim strStreet As String
Dim strCity As String
Dim strState As String
Dim strZIP As String
Dim strDL As String
Dim strCountry As String
这确定它是否是磁条
If strInputBox.Contains("%") Then
Dim CaretPresent As Boolean = False
Dim EqualPresent As Boolean = False
CaretPresent = strInputBox.Contains("^")
EqualPresent = strInputBox.Contains("=")
If CaretPresent Then 'track one
Dim CardData As String() = strInputBox.Split("^"c)
strState = CardData(0).Substring(1, 2)
strCity = CardData(0).Substring(3, CardData(0).Length - 3)
Dim strname As String() = CardData(1).Split("$"c)
strLastName = strname(0)
strFirstName = strname(1)
strMiddleName = strname(2)
strStreet = CardData(2)
Dim strzipcode As String() = CardData(3).Split("+"c)
strZIP = strzipcode(1).Substring(2, 5)
End If
If EqualPresent Then ' track two
Dim CardData As String() = strInputBox.Split("="c)
strDOB = CardData(1).Substring(6, 6)
End If
这确定用户是否扫描了许可证背面的条形码
ElseIf strInputBox.Contains("ANSI") Then
Dim separatingStrings As String() = {"ANSI", "DBA", "DCS", "DAC", "DAD", "DBD", "DBB", "DBC", "DAY", "DAU", "DAG", "DAI", "DAJ", "DAK", "DAQ", "DCF", "DCG", "DDE", "DDF", "DDG", "DAZ", "DCI", "DCJ", "DCU", "DCE", "DDA", "DDB", "DAW", "DDK", "ZOZ", "ZOE"}
Dim text As String = strInputBox
Dim words As String() = text.Split(separatingStrings, System.StringSplitOptions.RemoveEmptyEntries)
Dim i As Integer = 0
For Each word In words
_log.Info("Looking at code: " & separatingStrings(i).ToString)
_log.Info("Parsing field: " & word.ToString.Trim)
strLastName = IIf(separatingStrings(i) = "DCS", word.ToString.Trim, strLastName)
strFirstName = IIf(separatingStrings(i) = "DAC", word.ToString.Trim, strFirstName)
strMiddleName = IIf(separatingStrings(i) = "DAD", word.ToString.Trim, strMiddleName)
strDOB = IIf(separatingStrings(i) = "DBB", word.ToString.Trim, strDOB)
strStreet = IIf(separatingStrings(i) = "DAG", word.ToString.Trim, strStreet)
strCity = IIf(separatingStrings(i) = "DAI", word.ToString.Trim, strCity)
strState = IIf(separatingStrings(i) = "DAJ", word.ToString.Trim, strState)
strZIP = IIf(separatingStrings(i) = "DAK", word.ToString.Trim, strZIP)
strDL = IIf(separatingStrings(i) = "DAQ", word.ToString.Trim, strDL)
strCountry = IIf(separatingStrings(i) = "DCG", word.ToString.Trim, strCountry)
i += 1
Next
Else
MessageBox.Show("Incorrect format, contact us with this type of ID", "Scan Driver's License", MessageBoxButtons.OK, MessageBoxIcon.Stop)
Return
End If
文本行中是否有代码加密代码。