Login Register






There was a very particular style of DDOS attack just now, it was mitigated.
Thread Rating:
  • 0 Vote(s) - 0 Average


[VB.Net] System.IO.File Functions filter_list
Author
Message
[VB.Net] System.IO.File Functions #1
IO.File.AppendText & IO.File.AppendAllText & IO.File.CreateText & IO.File.WriteAllText & IO.File.WriteAllLines & IO.File.WriteAllBytes


Explanation: These functions are used to create TextFiles or write bytes.

Example:
Code:
IO.File.AppendText("C:\text.txt")
IO.File.AppendAllText("C:\text.txt", Textbox1.text)
IO.File.CreateText("C:\Text.txt")
IO.File.WriteAllText("C:\test.txt", Textbox1.text)
IO.File.WriteAllLines("C:\text.txt", Textbox1.text)
IO.File.WriteAllBytes("C:\file.exe", Nothing)


Format:
Code:
IO.File.AppendText(Path)
IO.File.AppendAllText(Path, Contents)
IO.File.CreateText(Path)
IO.File.WriteAllText(Path, Contents)
IO.File.WriteAllLines(Path, Contents)
IO.File.WriteAllBytes(Path, Byte)







IO.File.Copy


Explanation: This function is used to copy files.

Example:
Code:
IO.File.Copy(Application.ExecutablePath, "C:\copied.exe")


Format:
Code:
IO.File.Copy(SourceFileName, Destinationfilename)





IO.File.Create


Explanation: Creates a file of any format.

Example:
Code:
IO.File.Create("C:\new.exe")


Format:
Code:
IO.File.Create(Path)







IO.File.Delete


Explanation: Deletes an existing file.

Example:
Code:
IO.File.Delete("C:\file.exe")


Format:
Code:
IO.File.Delete(Path)







IO.File.Exists


Explanation: Gets a boolean ( True or False ) value whether the file exists or no.

Example:
Code:
If IO.File.Exists("C:\file.exe") = True Then
MsgBox("File Exists")
Else
MsgBox("File Does not Exist")
End If


Format:
Code:
IO.File.Exists(Path)







IO.File.GetAttributes


Explanation: Gets the value of a file's Attribute.

Example:
Code:
MsgBox(IO.File.GetAttributes("C:\hidden.exe"))


Format:
Code:
IO.File.GetAttributes(Path)







IO.File.GetCreationTime & IO.File.GetCreationTimeUtc & IO.File.GetLastAccessTime & IO.File.GetLastAccessTimeUtc & IO.File.GetLastWriteTime


Explanation: Gets values of a file's Creation time, which the time a file is created and its date for utc ones. And gets its last editing time or creation time or when its last opened.

Example:
Code:
IO.File.GetCreationTime("C:\file.exe")
IO.File.GetCreationTimeUtc("C:\file.exe")
IO.File.GetLastAccessTime("C:\file.exe")
IO.File.GetLastAccessTimeUtc("C:\file.exe")
IO.File.GetLastWriteTime("C:\file.exe")


Format:
Code:
IO.File.GetCreationTime(Path)
IO.File.GetCreationTimeUtc(Path)
IO.File.GetLastAccessTime(Path)
IO.File.GetLastAccessTimeUtc(Path)
IO.File.GetLastWriteTime(Path)







IO.File.Move


Explanation: Moves a file to a new directory. Same like Cut and Paste.

Example:
Code:
IO.File.Move(Application.ExecutablePath, "C:\moved.exe")


Format:
Code:
IO.File.Move(SourceFileName, Destinationfilename)







IO.File.Open & IO.File.OpenRead & IO.File.OpenText & IO.File.OpenWrite


Explanation: Open's a file for either reading or writing to it.

Example:
Code:
IO.File.Open("C:\file.exe", IO.FileMode.Open)
Textbox1.text = IO.File.OpenRead("C:\text.txt")
Textbox1.text = IO.File.OpenText("C:\text.txt")
IO.File.OpenWrite("C:\text.txt")


Format:
Code:
IO.File.Open(Path, Mode)
IO.File.OpenRead(Path)
IO.File.OpenText(Path)
IO.File.OpenWrite(Path)







IO.File.ReadAllBytes & IO.File.ReadAllLines & IO.File.ReadAllText


Explanation: Opens a file to read its byte array or all Textlines or its text.

Example:
Code:
Dim aByteArray As Byte() = IO.File.ReadAllBytes("C:\file.exe")
Dim aStringArray As String() = IO.File.ReadAllLines("C:\text.txt")
Dim aString As String = IO.File.ReadAllText("C:\text.txt")


Format:
Code:
IO.File.ReadAllBytes(Path)
IO.File.ReadAllLines(Path)
IO.File.ReadAllText(Path)







IO.File.Replace


Explanation: Rewrites a existing file and makes a backup of it.

Example:
Code:
IO.File.Replace(Application.ExecutablePath, "C:\copy.exe", "C:\backup.exe")


Format:
Code:
IO.File.Replace(SourceFileName, DestinationFileName, DestinationBackupFileName)






IO.File.SetAttributes


Explanation: Sets or changes a file's attribute.

Example:
Code:
IO.File.SetAttributes("C:\Unhidden.exe", FileAttribute.Hidden)


Format:
Code:
IO.File.SetAttributes(Path, FileAttributes)







IO.File.SetCreationTime & IO.File.SetCreationTimeUtc & IO.File.SetLastAccessTime & IO.File.SetLastAccessTimeUtc & IO.File.SetLastWriteTime


Explanation: Can set a file's creation date, the same date and time it got created or its last opened date and time or its last Edited time. Very useful for virus makers to fool the opener to think the binded file's creation date is like 2 years ago.

Example:
Code:
IO.File.SetCreationTime("C:\file.exe", Date.Today)
IO.File.SetCreationTimeUtc("C:\file.exe", Date.UtcNow)
IO.File.SetLastAccessTime("C:\file.exe", Date.Now)
IO.File.SetLastAccessTimeUtc("C:\file.exe", Date.Now)
IO.File.SetLastWriteTime("C:\file.exe", Date.Now)


Format:
Code:
IO.File.SetCreationTime(Path, Date)
IO.File.SetCreationTimeUtc(Path, Date)
IO.File.SetLastAccessTime(Path, Date)
IO.File.SetLastAccessTimeUtc(Path, Date)
IO.File.SetLastWriteTime(Path, Date)








File.Attributes: The Properties of files. The VB Attributes are:
  • FileAttribute.Archive
  • FileAttribute.Directory
  • FileAttribute.Hidden
  • FileAttribute.Normal
  • FileAttribute.ReadOnly
  • FileAttribute.System
  • FileAttribute.Volume



Boolean: The Conditions that can connect codes. There are known booleans as:
  • True ( Saying something is True )
  • False ( Saying something is False )
  • = ( Saying something is equal to another Code )
  • <> ( Saying something is not equal to another Code )
  • < ( Saying something is bigger then the Code's value )
  • > ( Saying something is smaller then the Code's Value )



Examples:
Code:
If IO.File.Exists("C:\file.exe") = true then
If IO.File.Exists("C:\file.exe") = false then
If integer = 1 = true then
If integer <> 1 = true then
If integer < 1 = true then
If integer > 1 = true then












Writed by 1234hotmaster. Please don't leech or give credits and source if you share.

Have a Great day Smile
(This post was last modified: 02-20-2011, 06:12 PM by Skullmeat.)
Pierce the life fibers with your drill.

Reply

RE: [VB.Net] System.IO.File Functions #2
Code:
Imports System.IO
Tongue

Nice guide!!! I really like it!!!

btw, in the boolean, you use double checking, which is not necessary Smile
Spoiler:
Code:
If integer = 1 = true then
The code will be read:
Quote:If integer is 1 = true = true then

Boolean is set as "true" by default Smile

That means, its more simple to use:
Code:
If integer = 1 then
it will be read:
Quote:If integer is 1 = true then

However, for boolean false you will need it Smile

so:
Code:
If integer = 1 = false then
will be read:
Quote:If integer is 1 = false then

Smile
Staff will never ever ask you for your personal information.
We know everything about you anyway.

Reply

RE: [VB.Net] System.IO.File Functions #3
well, still even double checking works Tongue

Glad you liked it. More guides to come Smile
(This post was last modified: 02-20-2011, 05:21 PM by Skullmeat.)
Pierce the life fibers with your drill.

Reply

RE: [VB.Net] System.IO.File Functions #4
(02-20-2011, 05:20 PM)1234hotmaster Wrote: well, still even double checking works Tongue

Glad you liked it. More guides to come Smile

Yeh, but it slows down the process a little bit. And also more words = more complicated Tongue

Looking forward for more great guides!!!!!!!
Staff will never ever ask you for your personal information.
We know everything about you anyway.

Reply

RE: [VB.Net] System.IO.File Functions #5
Nice thread, keep it up. Smile

You can show the return values more clearly like:

Code:
Dim aByteArray As Byte() = IO.File.ReadAllBytes("C:\file.exe")
Dim aStringArray As String() = IO.File.ReadAllLines("C:\text.txt")
Dim aString As String = IO.File.ReadAllText("C:\text.txt")
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: [VB.Net] System.IO.File Functions #6
Tnx for the examples. Edited Smile
Pierce the life fibers with your drill.

Reply

RE: [VB.Net] System.IO.File Functions #7
Nice things you got goin. good tut.

Reply

RE: [VB.Net] System.IO.File Functions #8
thanks man ! awesome !
this must be transfered in the important thread category .

Reply

RE: [VB.Net] System.IO.File Functions #9
What will be the source file name

Reply







Users browsing this thread:






This forum uses Lukasz Tkacz MyBB addons.