Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom CopyFile Class
12-20-2009, 11:23 AM
Post: #1
Custom CopyFile Class
Well...It still uses the File. methods of vb.net but its just a bit different..bit of fun. Was playing around with bytes a bit and thought this would be a bit of fun lol...

Give credits if you use please, its not flash but still are due
Here it is:
Code:
Imports System.IO

Module CopyFileClass

    Sub Main()
        Console.Title = "Custom CopyFile Class"

        Dim strSrcFile, strDestFile As String
        Console.WriteLine("Please Enter Source File: ")
        strSrcFile = Console.ReadLine()

        Console.WriteLine("Please Enter Destination File: ")
        strDestFile = Console.ReadLine()

        CopyFile(strSrcFile, strDestFile)
    End Sub

    Sub CopyFile(ByVal SrcFile As String, ByVal DestFile As String)
        Try
            File.WriteAllBytes(DestFile, File.ReadAllBytes(SrcFile))
        Catch ex As Exception
            Console.WriteLine(ex.Message)
            Console.ReadLine()
            Exit Sub
        End Try
        Console.WriteLine(vbCrLf & "Successfully Copied {0} To {1}", SrcFile, DestFile)
        Console.ReadLine()
    End Sub
End Module
Enjoy

[Image: pgsig copy.png]
Visit this user's website Find all posts by this user
Quote this message in a reply
12-20-2009, 11:20 PM
Post: #2
RE: Custom CopyFile Class
This is similar as using streams in Delphi.
Very good !

There's a fine line between genius and insanity. I have erased this line.
Oscar Levant
There's a fine line between an administrator and black hat hacker. I have erased this line.
Dr DEBCOL
Visit this user's website Find all posts by this user
Quote this message in a reply
12-20-2009, 11:24 PM
Post: #3
RE: Custom CopyFile Class
I would just use the built in static method from the System.IO module
File.Copy(source,destination);
Visit this user's website Find all posts by this user
Quote this message in a reply
12-21-2009, 07:35 AM
Post: #4
RE: Custom CopyFile Class
Yeah ofc, I would too but I made this as an example for a mate who wanted to know how to read the bytes from a file and then place them in another.

[Image: pgsig copy.png]
Visit this user's website Find all posts by this user
Quote this message in a reply
12-30-2009, 12:15 AM
Post: #5
RE: Custom CopyFile Class
it good to know how this functions work , so one challenge is to make unstoppable file copier
Simple program that will copy files from cd , but if the cd is litle damaged or dirty it says data redundancy check so it will be useful to have program that will let you to eject the cd clean it and then return it back and continue , to just to put file coping on hold to do something else with your cd drive
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


 Quick Theme: