• Welcome to ForumKorner!
    Join today and become a part of the community.

[TUT] File Pumper [ VB.NET]

OliverE

Power member.
Reputation
0
--------------------------------------------------​

Intro:

In this tutorial, I shall be showing you how to create a file pumper.

A File Pumper changes the file size of any .exe application.

In this tutorial I shall be using Visual Basic 2010 Express which is free to download.
Even though I am using the latest version of VB you can use VB8 if you prefer.

If you struggle with this tutorial you can check out the video below, also the full source code is at the bottom if your too lazt to fill it out in sections, project files are linked in the tutorial if you want the easy route out, and if your still unsure then just make a ticket here, http://bleepyevans.com/support_ticket/ and let me know what your stuck with.

--------------------------------------------------​

Video:
[youtube]http://www.youtube.com/watch?v=qdMh1diz9xA[/youtube]
HiRes & HD: http://www.youtube.com/watch?v=qdMh1diz9xA[/CENTER]

--------------------------------------------------​

Prep:

-= First things first you will need to create a New Project and create a Windows Form Applcation.

-= Call this project FilePumper and hit OK.

-= You should now see a form in VB.

-= In this form, create 2 equally sized textboxes below each other. Aswell as 2 equally sized buttons below each other.

-= Click inside button 1 (one on top) and type "...". This symbolizes the button is a browse button, and will browse for the file which size we want to pump.

-= Click inside button 2 (one on bottom) and type "Pump". When this button is clicked we will be changing the files size we picked in button 1.

-= Now go into your toolbox and scroll down until you find "OpenFileDialog". Drag one of them into the form anywhere.

-= Once you let go you should notice that nothing actually appears in the form. Infact its something which is invisble and it appears around the rim of the workspace, and should be called "OpenFileDialog1"

-= Ok now everything is set up for code to be added.


--------------------------------------------------​

Code:


-= In your Solution Explorer, right click form1.vb and select View Code. You should now be in the code view of you FilePumper.

-= Above "Private Class Form1" add the following.
[vb]Imports System.IO[/vb]



-= Now we want to go back to design view, to do this find the tabbing along the top of the workspace and click "Form1.vb (Design)"

-= Ok if you double click button1, the code view will open and a Sub will be created which will look something like this
[vb]Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click[/vb]



-= Now paste in the following code.
[vb]OpenFileDialog1.DefaultExt = "exe"
OpenFileDialog1.Filter = "exe files (*.exe)|*.exe"
OpenFileDialog1.FilterIndex = 1
If OpenFileDialog1.ShowDialog(Me) = DialogResult.OK Then
TextBox1.Text = String.Empty
TextBox1.Text = OpenFileDialog1.FileName[/vb]



-= As I explained before this opens the OpenFileDialog to browse for the file to play with when button1 is pressed.

-= Now go back to the design view as explained before, and double click button 2.

-= Again a new sub will be made for button2.

-= Paste the following code in below this new sub.
[vb]If TextBox2.Text = "" Then
MsgBox("Enter an number of MB to add")
Else
MsgBox("Please press Ok and wait for the file to be pumped")
Dim file1 = File.OpenWrite(TextBox1.Text)
Dim siza = file1.Seek(0, SeekOrigin.[End])
Dim size = Convert.ToInt32(TextBox2.Text)
Dim bite As Decimal = size * 1048576
While siza < bite
siza += 1
file1.WriteByte(0)
End While
file1.Close()
End If[/vb]



-= This changes the file size of the select file in textbox1 to the size typed into textbox2. We have also set up something which shows an error message when nothin is entered into textbox2 so that that program knows what to change the file size to.

-= We are almost done now.

-= All you got to do now is go back to your design view and jazz out the design to make it look unique, perhaps create a logo and add it at the top. Who knows, it up to you to make it look attractive.

-= If your happy with your FilePumper, click the debug button which looks like a Green Play button. When you click this you can test your new tool and if something is wrong then Visual Basic will tell you.

-= I advise not changing the size of something to more than 200 - 300 mb, unless you have a big hardrive.

-= Once you have checked your file pumper for errors and made sure it works, you can build it to a usable tool.

-= Make you you save all your files, to do this click File > Save All and pick a suitable place to keep your VB project files.

-= Now to build your new tool, click the Debug menu along to top tool / menu bar. And then press Build <Project Name>.

-= Once you've dont that find where you saved your new tool and find the Bin Folder. In the bin will be your new tool ready to put on your desktop for the next time you need it.


--------------------------------------------------

Project Files:
>>HERE<<

--------------------------------------------------

FullCode:[/color]]
[hide=10][vb]Imports System.IO
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.DefaultExt = "exe"
OpenFileDialog1.Filter = "exe files (*.exe)|*.exe"
OpenFileDialog1.FilterIndex = 1
If OpenFileDialog1.ShowDialog(Me) = DialogResult.OK Then
TextBox1.Text = String.Empty
TextBox1.Text = OpenFileDialog1.FileName
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox2.Text = "" Then
MsgBox("Enter an number of MB to add")
Else
MsgBox("Please press Ok and wait for the file to be pumped")
Dim file1 = File.OpenWrite(TextBox1.Text)
Dim siza = file1.Seek(0, SeekOrigin.[End])
Dim size = Convert.ToInt32(TextBox2.Text)
Dim bite As Decimal = size * 1048576
While siza < bite
siza += 1
file1.WriteByte(0)
End While
file1.Close()
End If
End Sub
End Class[/vb][/hide]


--------------------------------------------------

Endtro:
Thanks for reading or watching my tutorial.

If you have any questions please go here http://bleepyevans.com/support_ticket/

I shall try to answer as many questions as possible on the forums, but please forgive me if I dont reply as soon as you hope.

Many more tutorials coming soon.



Thanks​
 
Reputation
0
I still remember my first software that i made was a file pumper as i failed, then tried again and it worked i was well pround of my self that i programmed my first software....
 
Top