Class FileCompressor
Since C# only has GZipStream until .NET 4.0, we are forced to implement our own packing system for artifact files. We compact all artifacts into a single GZip Stream with the header before the file name and contents. The header contains the file name length and file length (in bytes).
Inherited Members
Namespace: UnityEditor.Build.Pipeline.Utilities
Assembly: Unity.ScriptableBuildPipeline.Editor.dll
Syntax
public class FileCompressor
Methods
Compress(string, string)
Compresses all artifacts located at a specified directory.
Declaration
public static bool Compress(string directoryPath, string archiveFilePath)
Parameters
Type | Name | Description |
---|---|---|
string | directoryPath | The directory containing the artifacts. |
string | archiveFilePath | The file path at which the archive will be created. |
Returns
Type | Description |
---|---|
bool | Returns true if the directory was found and compressed. Returns false otherwise. |
Decompress(string, string)
Extracts all artifacts compressed in an archive.
Declaration
public static bool Decompress(string archiveFilePath, string directoryPath)
Parameters
Type | Name | Description |
---|---|---|
string | archiveFilePath | The archive to decompress. |
string | directoryPath | The path where the extracted artifacts will be stored. |
Returns
Type | Description |
---|---|
bool | Returns true if the archive was found and decompressed. Returns false otherwise. |