CALCULATE LRC in VFP

0

I want to pass this code to vfp to calculate the LRC of a frame that I have to send, so far I have not been able ... I could collaborate since I do not handle vfp.

Private Function CheckLCR(ByVal s As String) As String 
  Dim checksum As Integer = 0 
  For Each c As Char In GetStringFromHex(s) 
    checksum = checksum Xor Convert.ToByte(c) 
  Nextini
  Return checksum.ToString("X2")
End Function 

Private Function GetStringFromHex(ByVal s As String) As String 
  Dim result As String = Nothing 
  Dim s2 As String = s.Replace(" ", Nothing)
  For i As Integer = 0 To s2.Length - 1 Step 2 
    result += Convert.ToChar(Integer.Parse(s2.Substring(i, 2), 
System.Globalization.NumberStyles.HexNumber)) 
  Next 
  Return result
End Function

I would appreciate your help.

    
asked by Sebastian Rico 08.06.2018 в 00:27
source

0 answers