Showing Hex

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
User avatar
WastingBody





Posts: 195
Joined: Mon Sep 19, 2005 5:07 pm

Showing Hex

Post by WastingBody »

Can someone tell me how to show hex like the weap names in an app.
superaison





Posts: 175
Joined: Mon Jul 25, 2005 5:06 pm

Post by superaison »

tell me if it workszorz

Code: Select all

Private Sub   HexView(FileName   As     String   )
'put contents of file into textbox1
Dim temp As String , temp2 As String
Dim i As Long , j As Long
Dim leader As String
Dim HexText As String
Dim AsciiText As String
Dim Char As String

'read the file into a string
Open filename For Input As #1
temp2 = Input (Lof(1),#1)
Close #1

'create hex string
If Len(temp2) > 0 Then
    For i = 1 To Len(temp2) Step 8
       leader = String $((6 - Len( Hex (i - 1))), "0" ) & Hex (i - 1) & " "
       HexText = ""
        For j = 0 To 7
            If i + j > Len(temp2) Then
               HexText = HexText & Space$((8 - j) * 3)
                Exit For
            End If
            Char = Format $( Hex ( Asc ( Mid $(temp2, i + j, 1))), "00" )
            If Len( Char ) = 1 Then Char = "0" & Char
           HexText = HexText & Char & " "
        Next j
       AsciiText = Mid $(temp2, i, 8)
       AsciiText = Replace(AsciiText, Chr (9), "." )
       AsciiText = Replace(AsciiText, Chr (10), "." )
       AsciiText = Replace(AsciiText, Chr (13), "." )
       temp = temp & leader & HexText & " " & AsciiText & vbCrLf
    Next i
Else
   temp = vbCrLf
End If

temp = Mid $(temp, 1, Len(temp) - 2)
text1.text = temp

End Sub 
PlasmaGhost





Posts: 149
Joined: Wed Oct 05, 2005 12:23 pm

Post by PlasmaGhost »

how about in C# now :) lol
superaison





Posts: 175
Joined: Mon Jul 25, 2005 5:06 pm

Post by superaison »

ill look round.
Post Reply