Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.47 KB | None | 0 0
  1.     Private Sub ReplaceText(ByVal filename As String)
  2.         Try
  3.             Dim buffer As Byte() = System.IO.File.ReadAllBytes(filename)
  4.             Dim buffer2 As Byte() = New Byte((buffer.Length + 1) - 1) {}
  5.             Dim num As Integer = 0
  6.             Dim length As Integer = buffer.Length
  7.             If ((length > 1) AndAlso (buffer(0) <> &HFF)) Then
  8.                 buffer2(0) = &HFF
  9.                 Dim i As Integer
  10.                 For i = 0 To buffer.Length - 1
  11.                     Dim num4 As Byte = Not buffer(i)
  12.                     buffer2((i + 1)) = CByte(num4)
  13.                     If (num >= &H180) Then
  14.                         num = 0
  15.                     End If
  16.                 Next i
  17.                 Dim directoryName As String = System.IO.Path.GetDirectoryName(filename)
  18.                 Dim input As String = System.IO.Path.GetFileName(filename)
  19.                 Dim str As String = (System.Text.RegularExpressions.Regex.Replace(input, "", String.Empty))
  20.                 Dim stream As New System.IO.FileStream(directoryName & str, IO.FileMode.Create)
  21.                 stream.Write(buffer2, 0, buffer2.Length)
  22.                 stream.Close()
  23.                 MsgBox("Successfuly completed!")
  24.             ElseIf ((length > 1) AndAlso (buffer(0) = &HFF)) Then
  25.                 'MessageBox.Show(.(-1127653267))
  26.             End If
  27.         Catch ex As Exception
  28.             MsgBox(((((((("Something were wrong please try again! =("))))))))
  29.         End Try
  30.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement