Class ZipFileExternalDataMapper
Provides an external data mapping strategy for extracting data from Zip files.
This mapper searches through the entries of a Zip file (provided via custom context data)
for an entry whose short filename matches the specified originalFilename
.
If a match is found, it opens a stream for that Zip entry.
Inherited Members
Namespace: TriLibCore.Mappers
Assembly: Assembly-CSharp.dll
Syntax
public class ZipFileExternalDataMapper : ExternalDataMapper
Methods
Map(AssetLoaderContext, string, out string)
Declaration
public override Stream Map(AssetLoaderContext assetLoaderContext, string originalFilename, out string finalPath)
Parameters
Type | Name | Description |
---|---|---|
AssetLoaderContext | assetLoaderContext | The context containing model loading data and custom context data, including the Zip file reference. |
string | originalFilename | The original filename from the model data used to locate the corresponding Zip entry. |
string | finalPath | When a matching entry is found, this output parameter is set to the Zip file's name. |
Returns
Type | Description |
---|---|
Stream | A Stream to the matched Zip entry if found; otherwise, |
Overrides
Remarks
This method retrieves the custom context data of type ZipLoadCustomContextData from the
TriLibCore.AssetLoaderContext.CustomData. It then validates that the Zip file instance is available.
The method converts the originalFilename
to a lower-case short filename and iterates
through each file entry in the Zip. When an entry with a matching short filename is found, the method
sets finalPath
to the name of the Zip file and returns a stream opened from that entry.
If no matching entry is found, finalPath
is set to null
and null
is returned.