Tanoda
ZipFileExternalDataMapper.cs
Go to the documentation of this file.
1
using
System;
2
using
System.IO;
3
using
ICSharpCode.SharpZipLib.Zip;
4
using
TriLibCore
.
Utils
;
5
6
namespace
TriLibCore.Mappers
7
{
9
public
class
ZipFileExternalDataMapper
: ExternalDataMapper
10
{
12
public
override
Stream
Map
(AssetLoaderContext assetLoaderContext,
string
originalFilename, out
string
finalPath)
13
{
14
if
(!(assetLoaderContext.CustomData is
ZipLoadCustomContextData
zipLoadCustomContextData))
15
{
16
throw
new
Exception(
"Missing custom context data."
);
17
}
18
var zipFile = zipLoadCustomContextData.ZipFile;
19
if
(zipFile ==
null
)
20
{
21
throw
new
Exception(
"Zip file instance is null."
);
22
}
23
var shortFileName = FileUtils.GetShortFilename(originalFilename).ToLowerInvariant();
24
foreach
(ZipEntry zipEntry
in
zipFile)
25
{
26
if
(!zipEntry.IsFile)
27
{
28
continue
;
29
}
30
var checkingFileShortName = FileUtils.GetShortFilename(zipEntry.Name).ToLowerInvariant();
31
if
(shortFileName == checkingFileShortName)
32
{
33
finalPath = zipFile.Name;
34
string
_;
35
return
AssetLoaderZip.ZipFileEntryToStream(out _, zipEntry, zipFile);
36
}
37
}
38
finalPath =
null
;
39
return
null
;
40
}
41
}
42
}
TriLibCore.Mappers.ZipFileExternalDataMapper
Represents a mapper class used to load external data from Zip files.
Definition:
ZipFileExternalDataMapper.cs:10
TriLibCore.Mappers.ZipFileExternalDataMapper.Map
override Stream Map(AssetLoaderContext assetLoaderContext, string originalFilename, out string finalPath)
Definition:
ZipFileExternalDataMapper.cs:12
TriLibCore.ZipLoadCustomContextData
Represents a class passed as the custom data to the Asset Loader Context when loading Models from Zip...
Definition:
ZipLoadCustomContextData.cs:10
TriLibCore.Mappers
Definition:
AnimatorOverrideAnimationClipMapper.cs:4
TriLibCore.Utils
Definition:
GraphicsSettingsUtils.cs:4
TriLibCore
Definition:
AssetLoaderOptionsEditor.cs:6
Source
Assets
TriLib
TriLibCore
Scripts
Mappers
ZipFileExternalDataMapper.cs
Generated by
1.9.3