Hack Forums
[.NET] [TUT][VB.NET] How To Make Your Own "File Pumper" - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [TUT][VB.NET] How To Make Your Own "File Pumper" (/showthread.php?tid=192181)

Pages: Pages 1 2 3 4 5 6 7 8 9 10 11 12


[TUT][VB.NET] How To Make Your Own "File Pumper" - Theref - Nov 26, 2009

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.
[img]http://i49.[censored].com/30scy2d.jpg[/img]
TextBox1
NumericUpDown1
RadioButton1
RadioButton2
Button1
Button2


So, it will be looks like this

[img]http://i49.[censored].com/ei3t69.jpg[/img]

And set the components.
Spoiler (Click to View)


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!")

(Nov 26, 2009 09:43 AM)Vorfin Wrote:  Remember, if you compress the file (.ZIP, .RAR, ect) It will shrink back to it's original size.



Congratulations, you've just made your first File Pumper! :)
Please post your feedback here


* - flAmingw0rm - Nov 26, 2009

Thanks, i've bookmarked this page, when I come back tomorrow I'll try to make this. Thanks for sharing the sources.


* - Theref - Nov 26, 2009

(Nov 26, 2009 05:37 PM)flAmingw0rm Wrote:  Thanks, i've bookmarked this page, when I come back tomorrow I'll try to make this. Thanks for sharing the sources.

Whoa nice, give me feedback whenever you've tried this ✌


* - #DataBase - Nov 26, 2009

I am new to VB.NET so I think that would be a great work.
Would be great if you could say what the command do in the sources, because some of them are unknown to me.

#DB


* - Theref - Nov 26, 2009

(Nov 26, 2009 05:49 PM)#DataBase Wrote:  I am new to VB.NET so I think that would be a great work.
Would be great if you could say what the command do in the sources, because some of them are unknown to me.

#DB

Ok mate, will do 🤝 give me a time

btw, welcome to vb.net. it's a great language


* - Saki~chan - Nov 26, 2009

Im new at this too.....this is great tutorial, but how do you compile it into a .exe application? each time i use save as option i get this....

Spoiler (Click to View)


* - Theref - Nov 26, 2009

(Nov 26, 2009 06:56 PM)HaxGurl Wrote:  Im new at this too.....this is great tutorial, but how do you compile it into a .exe application? each time i use save as option i get this....

Spoiler (Click to View)
there are many great tuts at http://www.vbsources.com

for first starts, begin reading this two thread
http://www.vbsources.com/thread-12.html
http://www.vbsources.com/thread-27.html


* - [Eprouvez] - Nov 26, 2009

Code
Dim sfd As New SaveFileDialog ' Creates a new SaveFileDialog named 'sfd' shortens code

sfd.Filter = "Exe Files|*.exe" ' The SaveFileDialog Filter e.g. All files (*.*)

sfd.ShowDialog() ' Shows the SaveFileDialog

Dim filesize As Double = Val(NumericUpDown1.Value) ' Creates and assigns 'filesize' as a large integer

IO.File.Copy(TextBox1.Text, sfd.FileName) ' Copys the file from one directory (TextBox1.Text) to another (sfd.FileName)

'sfd.FileName is the directory which is chosen when you click 'Save' or Ok in the SaveFileDialog (sfd)

If RadioButton1.Checked Then ' If Kilobytes is selected

filesize = filesize * 1024 ' Then times the size by 1024, because we are working with bytes (1 Kb = 1024 Bytes)

End If ' Ends the if statement

If RadioButton2.Checked Then ' If Megabytes is selected (The End If and If here could be replaced with ElseIf Statement)

filesize = filesize * 1048576 ' Then times by 104576 (1 Mb = 1048576 Bytes)

End If ' End if statement

Dim filetopump = IO.File.OpenWrite(sfd.FileName) ' Opens the file that was just copied

Dim size = filetopump.Seek(0, IO.SeekOrigin.[End]) ' Reads how many bytes are currently in the file

While size < filesize ' While filesize (The size you want) is bigger than the current file size wanted...

filetopump.WriteByte(0) ' Add a byte

size += 1 ' Give size + 1, the while statement will end once size = filesize

End While ' End statement

filetopump.Close() ' Close the writing

MsgBox("Successfully Pumped!") ' MsgBox showing that the files done

#DB, here's the code with a description for you.


* - Theref - Nov 28, 2009

(Nov 26, 2009 07:38 PM)Eprouvez Wrote:  
Code
Dim sfd As New SaveFileDialog ' Creates a new SaveFileDialog named 'sfd' shortens code

sfd.Filter = "Exe Files|*.exe" ' The SaveFileDialog Filter e.g. All files (*.*)

sfd.ShowDialog() ' Shows the SaveFileDialog

Dim filesize As Double = Val(NumericUpDown1.Value) ' Creates and assigns 'filesize' as a large integer

IO.File.Copy(TextBox1.Text, sfd.FileName) ' Copys the file from one directory (TextBox1.Text) to another (sfd.FileName)

'sfd.FileName is the directory which is chosen when you click 'Save' or Ok in the SaveFileDialog (sfd)

If RadioButton1.Checked Then ' If Kilobytes is selected

filesize = filesize * 1024 ' Then times the size by 1024, because we are working with bytes (1 Kb = 1024 Bytes)

End If ' Ends the if statement

If RadioButton2.Checked Then ' If Megabytes is selected (The End If and If here could be replaced with ElseIf Statement)

filesize = filesize * 1048576 ' Then times by 104576 (1 Mb = 1048576 Bytes)

End If ' End if statement

Dim filetopump = IO.File.OpenWrite(sfd.FileName) ' Opens the file that was just copied

Dim size = filetopump.Seek(0, IO.SeekOrigin.[End]) ' Reads how many bytes are currently in the file

While size < filesize ' While filesize (The size you want) is bigger than the current file size wanted...

filetopump.WriteByte(0) ' Add a byte

size += 1 ' Give size + 1, the while statement will end once size = filesize

End While ' End statement

filetopump.Close() ' Close the writing

MsgBox("Successfully Pumped!") ' MsgBox showing that the files done

#DB, here's the code with a description for you.

well thanks mate 😝


* - -=C0d3ak=- - Nov 28, 2009

Very cool, thanks theref!


* - BETAhkr - Nov 28, 2009

How about if your file is 2 big?

Maybe you should also make one that decreases the size just for
good measures (just an idea)

@HaxGurl

https://hackforums.net/showthread.php?tid=132596&page=2

Will show you how to compile the .exe application.


* - Viperx28 - Nov 29, 2009

Awesome Tutorial MAN
Thanks!!


* - Stormchant - Dec 2, 2009

Great tutorial! Works correctly.


* - ♥ ♥ ♥ - Dec 2, 2009

Works, My bad :) I'll edit this post in a sec.


* - BETAhkr - Dec 2, 2009

Theref, Posting tutorials isn't for rep, & ratings, It's for respect as a programmer and helping people.