'**********************************************************************************************
'** Procedure: KeyToBytes
'**
'** Description: Returns log file name including path based on config settings and date.
'**********************************************************************************************
Private Shared Function KeyToBytes(ByVal mstring As String) As Byte()
Dim mchararray As Char()
Dim result As Byte()
Dim mbytearray As Byte()
Dim i As Integer = 0
Dim t As Integer = 0
Dim m As Integer = 0
Dim bytelength As Integer
mchararray = mstring.ToCharArray()
bytelength = BitConverter.GetBytes(mchararray(0)).Length()
While (Not mchararray(m) = "")
result = BitConverter.GetBytes(mchararray(m))
For t = 0 To bytelength Step 1
mbytearray(i) = result(t)
i += 1
If i > 16 Then
Exit While
End If
Next
m += 1
End While
If i < 16 Then
While (i <= 16)
mbytearray(i) = 0
i += 1
End While
End If
Return mbytearray
End Function
'**********************************************************************************************
'** Procedure: MessageToBytes
'**
'** Description: Returns log file name including path based on config settings and date.
'**********************************************************************************************
Private Shared Function MessageToBytes(ByVal mstring As String) As Byte()
Dim mchararray As Char()
Dim result As Byte()
Dim mbytearray As Byte()
Dim i As Integer = 0
Dim t As Integer = 0
Dim m As Integer = 0
Dim bytelength As Integer
mchararray = mstring.ToCharArray()
bytelength = BitConverter.GetBytes(mchararray(0)).Length()
While (Not mchararray(m) = "")
result = BitConverter.GetBytes(mchararray(m))
For t = 0 To bytelength Step 1
mbytearray(i) = result(t)
i += 1
'If i > 16 Then
'Exit While
'End If
Next
m += 1
End While
'If i < 16 Then
'While (i <= 16)
'mbytearray(i) = 0
'i += 1
'End While
'End If
Return mbytearray
End Function