The following example shows how to handle the archive file:
[C#]
flexCompress1.FileName = "C:\\TEST\\test.fxc";
// Create a new archive file
flexCompress1.OpenArchive(FileMode.Create);
// Let's encrypt all files
flexCompress1.Password = "The password";
// Set path to folder with some text files to BaseDir
flexCompress1.BaseDir = "Source";
// Do not compress MPEG3 files
flexCompress1.NoCompressionMasks.Add("*.mp3");
// Add all files and directories from Source excluding text files to the archive
flexCompress1.AddFiles("*.*", FileAttributes.Archive|
FileAttributes.Normal |
FileAttributes.Directory, "*.txt");// Set path to destination folder
flexCompress1.BaseDir = "Dest";
// Extract all files and directories from the archive to BaseDir
// After extracting directory Dest should contain all files from folder
// Source excluding *.txt files
flexCompress1.ExtractFiles("*.*");
// Use full path
flexCompress1.Options.StorePath = StorePathMode.FullPath;
// Set path to destination folder
flexCompress1.BaseDir = "Source1";
// Move all text files from Source1 to the archive
// After moving directory Source1 should not contain any text files
flexCompress1.MoveFiles("*.txt", FileAttributes.Normal | FileAttributes.Archive);
// Set path to current drive
flexCompress1.BaseDir = Directory.GetDirectoryRoot(Directory.GetCurrentDirectory());
// Overwrite all files
flexCompress1.Options.Overwrite = OverwriteMode.Always;
// Update all files excluding 1???.t* from Source1
flexCompress1.UpdateFiles(DemoFolder + "\\Source1\\*.*", FileAttributes.Archive | FileAttributes.Normal,
"2???.t*");
// Set temporary directory
flexCompress1.TempDir = "Temp";
// Test all files and directories in the archive
try
{
flexCompress1.TestFiles("*.*");
}
catch
{
MessageBox.Show("Archive is corrupted");
}
// Close archive
flexCompress1.CloseArchive();
[VB.NET]
flexCompress1.FileName = "C:\TEST\test.fxc";
' Create a new archive file
flexCompress1.OpenArchive(System.IO.FileMode.Create)
' Let's encrypt all files
flexCompress1.Password = "The password"
' Set path to folder with some text files to BaseDir
flexCompress1.BaseDir = "Source"
' Do not compress MPEG3 files
flexCompress1.NoCompressionMasks.Add("*.mp3")
' Add all files and directories from Source excluding text files to the archive
flexCompress1.AddFiles("*.*", System.IO.FileAttributes.Archive Or System.IO.FileAttributes.Normal Or System.IO.FileAttributes.Directory, "*.txt")
' Set path to destination folder
flexCompress1.BaseDir = "Dest"
' Extract all files and directories from the archive to BaseDir
' After extracting directory Dest should contain all files from folder
' Source excluding *.txt files
flexCompress1.ExtractFiles("*.*")
' Use full path
flexCompress1.Options.StorePath = ComponentAce.Compression.Archiver.StorePathMode.FullPath
' Set path to destination folder
flexCompress1.BaseDir = "Source1"
' Move all text files from Source1 to the archive
' After moving directory Source1 should not contain any text files
flexCompress1.MoveFiles("*.txt", System.IO.FileAttributes.Normal Or System.IO.FileAttributes.Archive)
' Set path to current drive
flexCompress1.BaseDir =
System.IO.Directory.GetDirectoryRoot(System.IO.Directory.GetCurrentDirectory())
' Overwrite all files
flexCompress1.Options.Overwrite = ComponentAce.Compression.Archiver.OverwriteMode.Always
' Update all files excluding 1???.t* from Source1
flexCompress1.UpdateFiles(DemoFolder + "\Source1\*.*", System.IO.FileAttributes.Archive Or
System.IO.FileAttributes.Normal, "2???.t*")
' Set temporary directory
flexCompress1.TempDir = DemoFolder + "Temp"
' Test all files and directories in the archive
Try
flexCompress1.TestFiles("*.*")
Catch
MessageBox.Show("Archive is corrupted")
End Try
' Use full path
flexCompress1.Options.StorePath = ComponentAce.Compression.Archiver.StorePathMode.RelativePath
flexCompress1.BaseDir = "Dest1"
' Extract all files to Dest1
flexCompress1.ExtractFiles("*.*")
' Close the archive
flexCompress1.CloseArchive()