Encrypts a folder with its contents into a a password protected SFX (self extracting) executable file.
The generated executable file requires .NET Framework 2.0 or upper.
Namespace: DidiSoft.SfxThe generated executable file requires .NET Framework 2.0 or upper.
Assembly: DidiSoft.Pgp (in DidiSoft.Pgp.dll) Version: 1.7.3.35547
Syntax
| C# |
|---|
public void EnryptFolderToExe( FileInfo inputFolder, string encryptionPassword, SfxOptions options, FileInfo outputExeFile ) |
| Visual Basic |
|---|
Public Sub EnryptFolderToExe ( _ inputFolder As FileInfo, _ encryptionPassword As String, _ options As SfxOptions, _ outputExeFile As FileInfo _ ) |
| Visual C++ |
|---|
public: void EnryptFolderToExe( FileInfo^ inputFolder, String^ encryptionPassword, SfxOptions^ options, FileInfo^ outputExeFile ) |
Parameters
- inputFolder
- Type: System.IO..::..FileInfo
input folder to be encrypted
- encryptionPassword
- Type: System..::..String
encryption/decryption password
- options
- Type: DidiSoft.Sfx..::..SfxOptions
Options for customization of the generated executable file
- outputExeFile
- Type: System.IO..::..FileInfo
output executable file location
Remarks
The generated SFX (self extracting) executable file upon execution shows a dialog box
that requires the same password used for encryption in order to extract the encrypted file.
If the output exe file already exists, it will be overwritten.
If the output exe file already exists, it will be overwritten.
Examples
This example shows how to create a password protected self extracting (SFX) executable file
with default options from a folder.
CopyC#
CopyVB.NET
using System; using System.IO; using DidiSoft.Sfx; class SfxFromFolder { static void Main(string[] args) { // customization options for the result EXE file SfxOptions options = new SfxOptions(); options.Copyright = "Copyright (c) My Company Name"; options.ProductName = "My SFX Demo"; options.Description = "My SFX Demo description"; // decryption password string password = "pass123"; // create the self extracting file SfxCreator sfx = new SfxCreator(); sfx.TargetDotNetFramework = SfxCreator.DotNetFramework.SELECT_FROM_EXECUTING_PROGRAM; sfx.EnryptFolderToExe(new FileInfo(@"DataFiles\test.txt"), password, new FileInfo("sfx_demo.exe")); } }
Imports System Imports System.IO Imports DidiSoft.Sfx Module SfxExeFromFolderDemo Sub Main() ' customization options for the result EXE file Dim options As New SfxOptions() options.Copyright = "Copyright (c) My Company Name" options.ProductName = "My SFX Demo" options.Description = "My SFX Demo description" ' decryption password Dim password As String = "pass123" ' create the self extracting file Dim sfx As New SfxCreator() sfx.TargetDotNetFramework = SfxCreator.DotNetFramework.SELECT_FROM_EXECUTING_PROGRAM sfx.EnryptFolderToExe(New FileInfo("DataFiles"), password, New FileInfo("sfx_demo.exe")) End Sub End Module