x_nick2001
New member
- Joined
- Oct 26, 2005
- Messages
- 3
- Programming Experience
- 3-5
First here is the part of the code having trouble with :
*note macAddress would value for example: "000B8203E12C"
The valueUnsigned actually, takes the 80(which is in hexadecimal), change it to decimal which gives 130, the And 255, is just a way to ensure the number is not more than 8bits number or if you prefer over 255. So now I need to signed that number.
So the problem is CType gives me an error :
Value of type 'Integer' cannot be converted to 'System.SByte'.
looking like it doesn't want to change type from an Integer to an SByte
So I really need to find a way to do this, any kind of idea would be much appreciated
*note macAddress would value for example: "000B8203E12C"
VB.NET:
Public Shared Function encode(ByVal macAddress As String, ByVal config As String, ByVal encryption As Boolean) As SByte()
Try
Dim text1 As String = New StringBuffer().append(config).append("&gnkey=0b82").ToString
Dim numArray1 As SByte() = StringImpl.getBytes(text1, "ISO-8859-1")
Dim num1 As Integer = New java.util.Random().nextInt
Dim num9 As Integer = 6
If (num9 < 0) Then
Throw New NegativeArraySizeException
End If
Dim numArray2 As SByte() = New SByte(num9 - 1) {}
Dim num2 As Integer
Dim valueUnsigned As Integer
For num2 = 0 To 6 - 1
valueUnsigned = java.lang.Integer.parseInt(StringImpl.substring(macAddress, (num2 * 2), ((num2 * 2) + 2)), 16) And 255
numArray2(num2) = CType(valueUnsigned, SByte)
Next num2
The valueUnsigned actually, takes the 80(which is in hexadecimal), change it to decimal which gives 130, the And 255, is just a way to ensure the number is not more than 8bits number or if you prefer over 255. So now I need to signed that number.
So the problem is CType gives me an error :
Value of type 'Integer' cannot be converted to 'System.SByte'.
looking like it doesn't want to change type from an Integer to an SByte
So I really need to find a way to do this, any kind of idea would be much appreciated