File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -34,17 +34,20 @@ Module Helper
3434
3535
3636 Function getUID() As String
37-
3837 Dim MacID As String = String .Empty
3938 Dim mc As ManagementClass = New ManagementClass( "Win32_NetworkAdapterConfiguration" )
4039 Dim moc As ManagementObjectCollection = mc.GetInstances()
4140 For Each mo As ManagementObject In moc
42- If (MacID = String .Empty And CBool (mo.Properties( "IPEnabled" ).Value) = True ) Then
43- MacID = mo.Properties( "MacAddress" ).Value.ToString()
41+
42+ If mo.Properties( "IPEnabled" ) IsNot Nothing AndAlso mo.Properties( "IPEnabled" ).Value IsNot Nothing Then
43+
44+ If CBool (mo.Properties( "IPEnabled" ).Value) = True AndAlso mo.Properties( "MacAddress" ) IsNot Nothing AndAlso mo.Properties( "MacAddress" ).Value IsNot Nothing Then
45+ MacID = mo.Properties( "MacAddress" ).Value.ToString()
46+ Exit For
47+ End If
4448 End If
4549 Next
4650 Return Convert.ToBase64String(Encoding.UTF8.GetBytes(MacID))
47-
4851 End Function
4952
5053
You can’t perform that action at this time.
0 commit comments