CompressionUtilities
A class in Root.Township, the global namespace.
Editor tool plus static helpers that pack a file or folder into a gzip file with a simple custom layout, and unpack it. Not a standard zip or tar.
- Listed in Global namespace: C to D
- Inherits or implements
MonoBehaviour - Nested types
ProgressDelegate
Constructors
| Member | What it is |
|---|---|
CompressionUtilities() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
Methods
6 private and internal methods
| Member | What it is |
|---|---|
private static void CompressDirectory(string directoryPath, string compressedPath, CompressionUtilities.ProgressDelegate progress = null) | Writes every file under a folder into one gzip stream, after a leading 1 byte that marks it as a folder. |
private static void CompressFile(string filePath, string relativePath, string compressedPath) | Public overload: packs a file or folder into name.gz in the destination folder and returns that path. The private ones write single entries. |
private static void CompressFile(string filePath, string relativePath, GZipStream zipStream) | Public overload: packs a file or folder into name.gz in the destination folder and returns that path. The private ones write single entries. |
private static bool Decompress(string compressedFilePath, string outputFileName, string destinationPath, CompressionUtilities.ProgressDelegate progress = null) | Reads the leading byte, then unpacks every entry (folder) or the single entry (file). |
private static bool DecompressFile(string folderPath, GZipStream compressedStream, CompressionUtilities.ProgressDelegate progress = null) | Public overload: unpacks a packed file into a folder and can delete the packed file. The private one reads one entry. |
private void OnValidate() | Runs zip or unzip when the matching inspector button is pressed. |