public class QuickIOTransferFileCopyJob : QuickIOTransferJobWriteJob
File Copy job implementation
File Copy job with observer
public void CopyJobWithObserver( IQuickIOTransferObserver observer, String sourceFile, String targetDirectory, Int32 maxBufferSize )
{
var copyJob = new QuickIOTransferFileCopyJob( observer, sourceFile, targetDirectory, maxBufferSize, overwrite: true, parentExistanceCheck: true );
copyJob.CopyStarted += OnCopyStarted;
copyJob.CopyProgress += OnCopyProgress;
copyJob.CopyFinished += OnFileCopyFinished;
copyJob.Run( );
}
File copy job
public void CopyJob( String sourceFile, String targetDirectory, Int32 maxBufferSize )
{
var copyJob = new QuickIOTransferFileCopyJob( sourceFile, targetDirectory, maxBufferSize, overwrite: true, parentExistanceCheck: true );
copyJob.CopyStarted += OnCopyStarted;
copyJob.CopyProgress += OnCopyProgress;
copyJob.CopyFinished += OnFileCopyFinished;
copyJob.Run( );
}
Event definitions for this example
private static void OnFileCopyFinished( object sender, QuickIOTransferFileCopyFinishedArgs e )
{
Console.WriteLine( "TestFileCopyJob: Copy Finished." );
}
private static void OnCopyProgress( object sender, QuickIOTransferFileCopyProgressArgs e )
{
Console.WriteLine( "TestFileCopyJob: Copy progresss: " + e.Percentage.ToString( "0.00" ) );
}
private static void OnCopyStarted( object sender, QuickIOTransferFileCopyStartedArgs e )
{
Console.WriteLine( "TestFileCopyJob: Copy started." );
}
private Boolean _copyTimestamps
private Nullable<DateTime> _transferStarted
private readonly object _transferStartedLock
DirectoryCreated
This event is raised when a directory was created
public DirectoryCreated
DirectoryCreating
This event is raised before an upcoming directory creation operation is performed
public DirectoryCreating
Error
This event is raised if file copy operation fails
public Error
Finished
This event is raised at the end of the file copy operation.
public Finished
Progress
This event is raised during a copy of a file. It provides current information such as progress, speed and estimated time.
public Progress
Started
This event is triggered at the beginning of the file copy operation.
public Started
QuickIOTransferFileCopyJob(IQuickIOTransferObserver observer, String source, String target, Int32 maxBufferSize, Boolean overwrite, Boolean parentExistanceCheck, Int32 prorityLevel)
Creates a new queue item
public void QuickIOTransferFileCopyJob(IQuickIOTransferObserver observer, String source, String target, Int32 maxBufferSize, Boolean overwrite, Boolean parentExistanceCheck, Int32 prorityLevel)
Parameters
observer
IQuickIOTransferObserverObserver
source
StringFullname source
target
StringFullname target
maxBufferSize
Int32Set max buffer size for copy transfer
overwrite
Booleantrue overwrites existing files
parentExistanceCheck
Booleantrue to verify parent existance
prorityLevel
Int32Priority level of directory creation should be higher than file creation without parent check
QuickIOTransferFileCopyJob(String source, String target, Int32 maxBufferSize, Boolean overwrite, Boolean parentExistanceCheck, Int32 prorityLevel)
Creates a new queue item
public void QuickIOTransferFileCopyJob(String source, String target, Int32 maxBufferSize, Boolean overwrite, Boolean parentExistanceCheck, Int32 prorityLevel)
Parameters
source
StringFullname source
target
StringFullname target
maxBufferSize
Int32Set max buffer size for copy transfer
overwrite
Booleantrue overwrites existing files
parentExistanceCheck
Booleantrue to verify parent existance
prorityLevel
Int32Priority level of directory creation should be higher than file creation without parent check
Implementation()
Executes the Copy process
protected void Implementation()
OnCopyFinished(Int64 totalBytes)
Fire Finished
private void OnCopyFinished(Int64 totalBytes)
OnCopyProgress(Int64 totalBytes, UInt64 bytesTransfered)
Fire Progress
private void OnCopyProgress(Int64 totalBytes, UInt64 bytesTransfered)
OnCopyStarted(Int64 totalBytes)
Fire Started
private void OnCopyStarted(Int64 totalBytes)
OnDirectoryCreated(String directoryPath)
Fire DirectoryCreated
private void OnDirectoryCreated(String directoryPath)
OnDirectoryCreating(String directoryPath)
Fire DirectoryCreating
private void OnDirectoryCreating(String directoryPath)
OnError(Exception e)
Fires Error
protected void OnError(Exception e)
Parameters
e
ExceptionCopyAttributes
true to copy attribute information. Default: false
public Boolean CopyAttributes { get; set; }
Remarks
Will reduce the processing speed, because a single physical access is required for each setting.
CopyTimestamps
true to copy all datetime information such as CreationTime, LastAccessTime and LastWriteTime. Default: false
public Boolean CopyTimestamps { get; set; }
Remarks
Will reduce the processing speed, because a single physical access is required for each setting.
JobType
JobType
internal override QuickIOTransferJobType JobType { get; }
Source
Fullname source
public String Source { get; set; }
Target
Fullname target
public String Target { get; set; }
TransferStarted
Transfer started
public Nullable<DateTime> TransferStarted { get; set; }