How To Make Your Own "File Pumper"


Ok, in this tutorial i will explain you about how to make your own file pumper. What is file pumper? If you have a file that is too small, well you can pump it with this program, so it's size will be changed as you wish.


If you haven't know anything about VB.NET, i recommend you to read this tutorial http://www.vbsources.com/thread-27.html first before proceeding to this tut. Let's get it started, 


File -> New Project -> Windows Application -> “File Pumper” -> Ok


Next, we need some components to be added to our form.



TextBox1
NumericUpDown1
RadioButton1
RadioButton2
Button1
Button2



So, it will be looks like this



And set the components

NumericUpDown1 : [will be used to show how much byte will be added]
Value = 10
Minimum = 10

RadioButton1: [self explanatory]
Text = KiloByte

RadioButton2: [self explanatory]
Text = MegaByte
Checked = true

Button1: [process the pumping]
Text = PUMP !

Button2: [browse the file]
Text: ...


Now, double click on the Button2 and put this code
Code:
Dim ofd As New OpenFileDialog
        ofd.Filter = "Exe Files|*.exe"
        ofd.ShowDialog()
        TextBox1.Text = ofd.FileName
this will show up the file dialog when users click the button2

and put this code for the button1
Code:
Dim sfd As New SaveFileDialog
        sfd.Filter = "Exe Files|*.exe"
        sfd.ShowDialog()
        Dim filesize As Double = Val(NumericUpDown1.Value)
        IO.File.Copy(TextBox1.Text, sfd.FileName) 
        If RadioButton1.Checked Then
            filesize = filesize * 1024
        End If
        If RadioButton2.Checked Then
            filesize = filesize * 1048576
        End If
        Dim filetopump = IO.File.OpenWrite(sfd.FileName)
        Dim size = filetopump.Seek(0, IO.SeekOrigin.[End]) 
        While size < filesize 
            filetopump.WriteByte(0) 
            size += 1
        End While
        filetopump.Close()
        MsgBox("Successfully Pumped!")


Congo ..You are Done !

0 Response to How To Make Your Own "File Pumper"

Post a Comment