Tanoda
FilePickerTextureMapper.cs
Go to the documentation of this file.
1
using
System;
2
using
System.Collections.Generic;
3
using
TriLibCore
.Interfaces;
4
using
TriLibCore
.
SFB
;
5
using
TriLibCore
.
Utils
;
6
7
namespace
TriLibCore.Mappers
8
{
10
public
class
FilePickerTextureMapper
: TextureMapper
11
{
13
public
override
TextureLoadingContext
Map
(AssetLoaderContext assetLoaderContext, ITexture texture)
14
{
15
if
(
string
.IsNullOrEmpty(texture.Filename))
return
null
;
16
if
(assetLoaderContext.CustomData is IEnumerable<ItemWithStream> itemsWithStream)
17
{
18
var shortFileName = FileUtils.GetShortFilename(texture.Filename).ToLowerInvariant();
19
foreach
(var itemWithStream
in
itemsWithStream)
20
{
21
if
(!itemWithStream.HasData)
continue
;
22
var checkingFileShortName = FileUtils.GetShortFilename(itemWithStream.Name).ToLowerInvariant();
23
if
(shortFileName == checkingFileShortName)
24
{
25
var textureLoadingContext =
new
TextureLoadingContext
26
{
27
Context = assetLoaderContext,
28
Stream = itemWithStream.OpenStream(),
29
Texture = texture
30
};
31
return
textureLoadingContext;
32
}
33
}
34
}
35
else
36
{
37
throw
new
Exception(
"Missing custom context data."
);
38
}
39
40
return
null
;
41
}
42
}
43
}
TriLibCore.Mappers.FilePickerTextureMapper
Represents a class used to load Textures from a list of selected files.
Definition:
FilePickerTextureMapper.cs:11
TriLibCore.Mappers.FilePickerTextureMapper.Map
override TextureLoadingContext Map(AssetLoaderContext assetLoaderContext, ITexture texture)
Definition:
FilePickerTextureMapper.cs:13
TriLibCore.Mappers
Definition:
AnimatorOverrideAnimationClipMapper.cs:4
TriLibCore.SFB
Definition:
ExtensionFilter.cs:2
TriLibCore.Utils
Definition:
GraphicsSettingsUtils.cs:4
TriLibCore
Definition:
AssetLoaderOptionsEditor.cs:6
Source
Assets
TriLib
TriLibStandaloneFileBrowser
StandaloneFileBrowser
TriLib
Mappers
FilePickerTextureMapper.cs
Generated by
1.9.3