code Code:
Public Sub DeleteINFO(ByVal InputtedFileName As String)
' Sepp is the ---------metadatastart---------- string (simply run through the string to byte array function
Dim Sepp As String = "45,45,45,45,45,45,45,45,45,45,109,101,116,97,100,97,116,97,115,116,97,114,116,45,45,45,45,45,45,45,45,45,45,45"
Dim EntireFileBytes() As Byte = My.Computer.FileSystem.ReadAllBytes(InputtedFileName)
Dim EntireFileText As String = ArrayToString(EntireFileBytes)
EntireFileText = Strings.Left(EntireFileText, InStr(EntireFileText, Sepp))
My.Computer.FileSystem.WriteAllBytes(InputtedFileName, StringToArray(EntireFileText), False)
End Sub
'--------------------------------------------------------------
' byte array to string, and string to byte array functions
Private Shared Function ArrayToString(ByVal bytes() As Byte, Optional ByVal format As String = Nothing) As String
If bytes.Length = 0 Then Return String.Empty
Dim sb As New System.Text.StringBuilder(bytes.Length * 4)
For Each b As Byte In bytes
sb.Append(b.ToString)
sb.Append(",")
Next
sb.Length -= 1
Return sb.ToString()
End Function
Private Shared Function StringToArray(ByVal s As String, Optional ByVal style As System.Globalization.NumberStyles = Nothing) As Byte()
If s.Length = 0 Then Return New Byte() {}
Dim values() As String = s.Split(","c)
Dim bytes(values.Length - 1) As Byte
For index As Integer = 0 To values.Length - 1
bytes(index) = Byte.Parse(values(index), style)
Next
Return bytes
End Function