Lazy Seven Zip is a wrapper for the popular SevenZipSharp library.
It provides an easy to use set of methods to easily create and extract archives in Unity within the Editor or at
Runtime.
For the benefit of the user, the source code is easy to follow and can be modified without must difficulty.
Please note!
This library does not include creating or extracting archives via Stream.
The Lazy Archive Wrapper Class consists of 4 methods, 2 Synchronous and 2 Asynchronous methods.
This allows you to create standard or encrypted archives using the Files and Folders in your current Unity Project.
The methods in the class are shown below.
public static void Archive(string outArchive,
string[] inFiles,
OutArchiveFormat archiveFormat,
CompressionLevel compressionLevel = CompressionLevel.Normal)
{
...
}
public static void Archive(string outArchive,
string[] inFiles,
string password,
OutArchiveFormat archiveFormat,
bool encryptHeaders = false,
ZipEncryptionMethod encryptionMethod = ZipEncryptionMethod.Aes128,
CompressionLevel compressionLevel = CompressionLevel.Normal)
{
...
}
public static async Task Archive(string outArchive,
string[] inFiles,
OutArchiveFormat archiveFormat,
CompressionLevel compressionLevel = CompressionLevel.Normal)
{
...
}
public static async Task Archive(string outArchive,
string[] inFiles,
string password,
OutArchiveFormat archiveFormat,
bool encryptHeaders = false,
ZipEncryptionMethod encryptionMethod = ZipEncryptionMethod.Aes128,
CompressionLevel compressionLevel = CompressionLevel.Normal)
{
...
}
The Lazy Extractor Wrapper Class consists of 2 Extraction methods, 1 Synchronous and 1 Asynchronous method.
This allows you to extract standard or encrypted archives anywhere within the Unity Editor or on your Local Machine.
The methods in the class are shown below.
public static void Extract(string outPath, string inArchive, string password = "")
{
...
}
public static async Task ExtractAsync(string outPath, string inArchive, string password = "")
{
...
}
public void ArchiveTest(string[] filesToArchive)
{
LazyArchiver.ArchiveAsync(@"Assets/test.7z", filesToArchive , OutArchiveFormat.SevenZip);
}
public async Task ArchiveTestAsync(string[] filesToArchive)
{
await LazyArchiver.ArchiveAsync(@"Assets/test.7z", filesToArchive, OutArchiveFormat.SevenZip);
}
public void ArchivePasswordTest(string password, string[] filesToArchive)
{
LazyArchiver.ArchiveAsync(@"Assets/test.7z", filesToArchive , password, OutArchiveFormat.SevenZip);
}
public async Task ArchivePasswordTestAsync(string password, string[] filesToArchive)
{
await LazyArchiver.ArchiveAsync(@"Assets/test.7z", filesToArchive, password, OutArchiveFormat.SevenZip);
}
public void ExtractArchiveTest(string outputPath)
{
LazyExtractor.Extract(outputPath, @"Assets/test.7z");
}
public async Task ExtractArchiveTestAsync(string outputPath)
{
await LazyExtractor.ExtractAsync(outputPath, @"Assets/test.7z");
}
public void ExtractArchivePasswordTest(string outputPath, string password)
{
LazyExtractor.Extract(outputPath, @"Assets/test.7z", password);
}
public async Task ExtractArchivePasswordTestAsync(string outputPath, string password)
{
await LazyExtractor.ExtractAsync(outputPath, @"Assets/test.7z", password);
}
- Editor Window to Create Archives similar to the 7zip Archive Creator Window
- SevenZipSharp created by ToMap and currently maintained by Squid-Box
- 7Zip Library by Igor Pavlov