Imports System
Imports System.Web
Imports System.IO
Imports System.Text

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim file As String
        OpenFileDialog1.ShowDialog()

        For Each file In OpenFileDialog1.FileNames
            ListBox1.Items.Add(file)
        Next

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        For i As Integer = ListBox1.SelectedIndices.Count - 1 To 0 Step -1
            ListBox1.Items.RemoveAt(ListBox1.SelectedIndices.Item(i))
        Next
    End Sub
    Public Function GetFileEncoding(filePath As String) As Encoding
        Using sr As StreamReader = New StreamReader(filePath, True)
            sr.Read()
            Return sr.CurrentEncoding
        End Using
    End Function
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        FolderBrowserDialog1.ShowDialog()

        For l_index As Integer = 0 To ListBox1.Items.Count - 1

            Try
                Dim value As String
                value = File.ReadAllText(CStr(ListBox1.Items(l_index)), Encoding.UTF8)

               
                Dim data As Byte()
                data = System.Text.ASCIIEncoding.UTF8.GetBytes(value)
                value = System.Convert.ToBase64String(data)

                Dim urlenc As String = System.Web.HttpUtility.UrlEncode(value)
                Dim strFileName As String = System.IO.Path.GetFileName(CStr(ListBox1.Items(l_index)))

                If Not System.IO.File.Exists(FolderBrowserDialog1.SelectedPath + "\" + strFileName) Then
                    System.IO.File.Create(FolderBrowserDialog1.SelectedPath + "\" + strFileName).Dispose()
                End If
                Dim objWriter As New System.IO.StreamWriter(FolderBrowserDialog1.SelectedPath + "\" + strFileName)
                Dim filec As String = "<?php @eval(""?>"".base64_decode(""" + value + """));//Generated by Ampare PHP Encoder. For more security please use php protect before encode the php program"
                objWriter.Write(filec)
                objWriter.Close()
            Catch
                MsgBox("Something Wrong", MsgBoxStyle.Critical, "Juthawong Need Help")

            End Try
        Next
        MsgBox("Good Work", MsgBoxStyle.Information, "Hooray!! Job Done")

    End Sub

    Private Sub FolderBrowserDialog1_HelpRequest(sender As Object, e As EventArgs) Handles FolderBrowserDialog1.HelpRequest

    End Sub
End Class
