PowerTCP Zip Compression for .NET
Self- Extraction



The Archive component includes the capability of creating self-extracting archives. The SelfExtactConfiguration property provides a mechanism for creating archives that do not require the Zip component (or any other Unzip utility) to extract the files contained within. Please note that it is no longer necessary to distribute the DartAttach.bin file with your application if your application will be creating self-extracting exe files.

To encrypt items in an archive:

  1. Add the Archive component to a new form.
  2. Add a button to the form.
  3. Add files or wildcard collections to the archive.
  4. Set the self-extract configuration for the archive. There are ten parameters:
    1. caption: The text to appear in the extractor's title bar.
    2. path: The default extraction path
    3. enablePath: Allows the user to modify the extraction path.
    4. overwrite: Specifies whether the extractor should overwrite existing files by default.
    5. enableOverwrite: Allows the user to dictate whether existing files should be overwritten.
    6. preservePath: Specifies if the directory path should be preserved.
    7. enablePreservePath: Specifies if the user should be presented with a preserve path option.
    8. codepage: Specifies the codepage to use.
    9. behavior: Specifies if the extraction should be user-interactive or silent.
    10. fileToExecute: Specifies if a file should execute immediately after extraction.
  5. When the resulting executable is distributed, the archived files can be extracted without the use of an unzipping utility.
C#
Copy Code
archive1.Add("c:\\Test\\*.txt");
//This archive will always extract to the Test directory. By default, existing files
//will be overwritten, but this can be changed by the end-user
archive1.SelfExtractConfiguration = new SelfExtractConfiguration("This is my self-extracting archive!",
    "c:\\Test", false, Overwrite.Always, true, true, true, archive1.Encoding.CodePage, SelfExtractBehavior.UserInteractive, "");
archive1.Zip("c:\\mySelfExtractingArchive.exe");
Visual Basic
Copy Code
Archive1.Add("c:\Test\*.txt")
'This archive will always extract to the Test directory. By default, existing files
'will be overwritten, but this can be changed by the end-user
Archive1.SelfExtractConfiguration = New SelfExtractConfiguration("This is my self-extracting archive!", _
    "c:\Test", False, Overwrite.Always, True, True, True, Archive1.Encoding.CodePage, SelfExtractBehavior.UserInteractive, "")
Archive1.Zip("c:\mySelfExtractingArchive.exe")

PowerTCP Zip for .NET Documentation Version 2.1.1
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic