Provides data for the
DiskFull event.
Shows how to handle the DiskFull event.
using System;
using ComponentPro.Compression;
...
void HandleDiskFullEvent()
{
// Create a new instance.
Zip zip = new Zip();
zip.SpanningMode = SpanningMode.Splitting;
// Create a splitting archive.
zip.Create(@"D:\test.zip");
// Handle the event.
zip.DiskFull += zip_DiskFull;
// ...
// Add some files to it.
zip.AddFiles(@"c:\my dir");
// ...
// Close.
zip.Close();
}
void zip_DiskFull(object sender, DiskFullEventArgs e)
{
Console.WriteLine("Disk full! Please choose different location for file: " + e.VolumeFileName);
Console.Write("Enter new file path: ");
string path = Console.ReadLine();
e.VolumeFileName = path;
if (string.IsNullOrEmpty(path))
e.Cancel = true;
}
Imports ComponentPro.Compression
...
Private Sub HandleDiskFullEvent()
' Create a new instance.
Dim zip As New Zip()
zip.SpanningMode = SpanningMode.Splitting
' Create a splitting archive.
zip.Create("D:\test.zip")
' Handle the event.
AddHandler zip.DiskFull, AddressOf zip_DiskFull
' ...
' Add some files to it.
zip.AddFiles("c:\my dir")
' ...
' Close.
zip.Close()
End Sub
Private Sub zip_DiskFull(ByVal sender As Object, ByVal e As DiskFullEventArgs)
Console.WriteLine("Disk full! Please choose different location for file: " & e.VolumeFileName)
Console.Write("Enter new file path: ")
Dim path As String = Console.ReadLine()
e.VolumeFileName = path
If String.IsNullOrEmpty(path) Then
e.Cancel = True
End If
End Sub
ComponentPro.Compression.ComponentPro.Compression.DiskFullEventArgs