Public Shared Function decode(ByVal data As String) As Byte()
Dim buffer1 As Byte() = New Byte((data.Length / 2) - 1) {}
Dim text1 As String = data.ToLower
Dim num1 As Integer = 0
Do While (num1 < text1.Length)
Dim buffer2 As Byte()
Dim ptr1 As IntPtr
Dim ch1 As Char = text1.Chars(num1)
Dim ch2 As Char = text1.Chars((num1 + 1))
Dim num2 As Integer = (num1 / 2)
If (ch1 < "a"c) Then
buffer1(num2) = CByte(((ch1 - "0"c) << 4))
Else
buffer1(num2) = CByte((((ch1 - "a"c) + ChrW(10)) << 4))
End If
If (ch2 < "a"c) Then
buffer2 = buffer1(CInt(ptr1 = DirectCast(num2, IntPtr))) = CByte((buffer2(CInt(ptr1)) + CByte((ch2 - "0"c))))
Else
buffer2 = buffer1(CInt(ptr1 = DirectCast(num2, IntPtr))) = CByte((buffer2(CInt(ptr1)) + CByte(((ch2 - "a"c) + ChrW(10)))))
End If
num1 = (num1 + 2)
Loop
Return buffer1
End Functionلا ادري ما الخطا في هذا, المشكلة تكمن في المنطقة:
ch1 - "0"c
حيث يظهر تنبيه بان اشارة الطرح غير مسموحة على الرغم من التصريح عن المتحولين انهما من نفس النوع!
وخطأ اخر في السطر
buffer2 = buffer1(CInt(ptr1 = DirectCast(num2, IntPtr))) = CByte((buffer2(CInt(ptr1)) + CByte((ch2 - "0"c))))
اختبرت هذا على MSVS 2003 و MSVS 2005 ولم افلح في معرفة السبب.
هل يمكن لاحدكم تفسير المشكلة؟ شكرا.

