static void ItemCompletionExample()
{
/* Create a reference to a FileSystemEvents object */
FileSystemEvents events = new FileSystemEvents();
/* Subscribe to the ItemCompletion event of the FileSystemEvents object using the ItemProgressionEventHandler delegate */
events.ItemCompletion += new ItemProgressionEventHandler( OnItemCompletion );
// Get a reference to an existing zip file
AbstractFile zipFile = new DiskFile( "ItemCompletionExample.zip" );
System.Diagnostics.Debug.Assert( zipFile.Exists );
Xceed.Zip.ZipArchive zip = new Xceed.Zip.ZipArchive( zipFile );
// Select an output folder
AbstractFolder destination = new DiskFolder( "Output" );
// Extract the files from the archive using the events object
zip.CopyFilesTo( events, null, destination, true, true );
}
/* Create a new method that will handle the events that are raised. For the purposes of this example, we will call the method OnItemProgression */
static void OnItemCompletion( object sender, ItemProgressionEventArgs e )
{
/* Place the desired code in the newly created event handler */
FileSystemItem targetItem = e.TargetItem;
// Remove the read-only attribute from the target file
FileAttributes attributes = targetItem.Attributes;
targetItem.Attributes = ( attributes & ~FileAttributes.ReadOnly );
}
Private Shared Sub ItemCompletionExample()
' Create a reference to a FileSystemEvents object
Dim events As New FileSystemEvents()
' Subscribe to the ItemCompletion event of the FileSystemEvents object using the ItemProgressionEventHandler delegate
AddHandler events.ItemCompletion, AddressOf OnItemCompletion
' Get a reference to an existing zip file
Dim zipFile As AbstractFile = New DiskFile("ItemCompletionExample.zip")
System.Diagnostics.Debug.Assert(zipFile.Exists)
Dim zip As New Xceed.Zip.ZipArchive(zipFile)
' Select an output folder
Dim destination As AbstractFolder = New DiskFolder("Output")
' Extract the files from the archive using the events object
zip.CopyFilesTo(events, Nothing, destination, True, True)
End Sub
' Create a new method that will handle the events that are raised. For the purposes of this example, we will call the method OnItemProgression
Private Shared Sub OnItemCompletion(ByVal sender As Object, ByVal e As ItemProgressionEventArgs)
' Place the desired code in the newly created event handler
Dim targetItem As FileSystemItem = e.TargetItem
' Remove the read-only attribute from the target file
Dim attributes As FileAttributes = targetItem.Attributes
targetItem.Attributes = (attributes And (Not FileAttributes.ReadOnly))
End Sub