-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfrmMain.frm
147 lines (133 loc) · 4.09 KB
/
frmMain.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
VERSION 5.00
Begin VB.Form frmMain
Caption = "midfp"
ClientHeight = 4170
ClientLeft = 165
ClientTop = 735
ClientWidth = 7455
Icon = "frmMain.frx":0000
LinkTopic = "Form1"
ScaleHeight = 4170
ScaleWidth = 7455
StartUpPosition = 3 'Windows Default
Begin VB.Frame Frame2
Caption = "Results"
Height = 2895
Left = 120
TabIndex = 4
Top = 1200
Width = 7215
Begin VB.TextBox txtResults
Appearance = 0 'Flat
BackColor = &H80000000&
BorderStyle = 0 'None
Height = 2415
Left = 120
Locked = -1 'True
MultiLine = -1 'True
TabIndex = 2
Text = "frmMain.frx":0CCA
Top = 360
Width = 6975
End
End
Begin VB.Frame Frame1
Caption = "Message-ID"
Height = 855
Left = 120
TabIndex = 3
Top = 240
Width = 7215
Begin VB.TextBox txtMessageId
Height = 285
Left = 120
MaxLength = 512
TabIndex = 0
Top = 360
Width = 4575
End
Begin VB.CommandButton cmdAnalyze
Caption = "&Analyze"
Default = -1 'True
Height = 375
Left = 6000
TabIndex = 1
Top = 240
Width = 1095
End
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileNewItem
Caption = "&New"
Shortcut = ^N
End
Begin VB.Menu mnuFileSep1
Caption = "-"
End
Begin VB.Menu mnuFileExitItem
Caption = "E&xit"
Shortcut = ^Q
End
End
Begin VB.Menu mnuHelp
Caption = "&Help"
Begin VB.Menu mnuHelpAboutItem
Caption = "&About"
Shortcut = {F1}
End
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdAnalyze_Click()
txtResults = midfp(txtMessageId.Text)
End Sub
Private Function midfp(ByRef sMid As String, Optional ByRef sDatabase As String)
Dim sFingerprintDb() As String
Dim iFingerprintDbCount As Integer
Dim i As Integer
Dim sResults As String
Dim myRegExp As RegExp
Dim myMatches As MatchCollection
Dim myMatch As Match
Dim sFingerprintDbEntry() As String
If (LenB(sDatabase) = 0) Then
sDatabase = "fingerprints.db"
End If
sFingerprintDb = Split(ReadFile(App.Path & "/" & sDatabase), vbLf, , vbBinaryCompare)
iFingerprintDbCount = UBound(sFingerprintDb)
Set myRegExp = New RegExp
myRegExp.IgnoreCase = False
myRegExp.Global = True
For i = 0 To iFingerprintDbCount
If (InStrB(1, sFingerprintDb(i), ";", vbBinaryCompare)) Then
sFingerprintDbEntry = Split(sFingerprintDb(i), ";", , vbBinaryCompare)
myRegExp.Pattern = Mid(sFingerprintDbEntry(1), 2, Len(sFingerprintDbEntry(1)) - 2)
If (myRegExp.Test(sMid) = True) Then
sResults = sResults & "* " & sFingerprintDbEntry(0) & vbCrLf
End If
End If
Next i
If (LenB(sResults) = 0) Then
sResults = "Unknown implementation."
End If
midfp = sResults
End Function
Private Sub Form_Load()
Me.Caption = APP_NAME
End Sub
Private Sub mnuFileExitItem_Click()
Unload Me
End Sub
Private Sub mnuFileNewItem_Click()
Me.txtMessageId.Text = vbNullString
Me.txtResults.Text = vbNullString
End Sub
Private Sub mnuHelpAboutItem_Click()
frmAbout.Show vbModal, frmMain
End Sub