Table of Contents

Class FileAvDataLoader

Loads avatars from on-device files.

public class FileAvDataLoader : IAvDataLoader
Inheritance
object
FileAvDataLoader
Implements

Constructors

FileAvDataLoader(string, string, string?, string?)

Creates a loader configured to load avatar data from paths to each file.

public FileAvDataLoader(string modelFilePath, string metadataFilePath, string? fullRenderFilePath = null, string? bustRenderFilePath = null)

Parameters

modelFilePath string

Path to the model.

metadataFilePath string

Path to the avatar metadata.

fullRenderFilePath string

Path to the full render of the avatar (optional).

bustRenderFilePath string

Path to the bust render of the avatar (optional).

Exceptions

NotSupportedException

Thrown if the file extension of modelFilePath, fullRenderFilePath or bustRenderFilePath is not supported.

FileAvDataLoader(string, AvModelFileExtension, AvImageFileExtension, AvImageFileExtension, bool, bool)

Creates a loader configured to load avatar data from the directory at basePath.

public FileAvDataLoader(string basePath, AvModelFileExtension modelFormat = AvModelFileExtension.None, AvImageFileExtension fullRenderFormat = AvImageFileExtension.None, AvImageFileExtension bustRenderFormat = AvImageFileExtension.None, bool shouldLoadFullRender = false, bool shouldLoadBustRender = false)

Parameters

basePath string

The base directory containing the avatar and its metadata.

modelFormat AvModelFileExtension

The expected file extension(s) of the model, leave as None to auto detect of all supported formats.

fullRenderFormat AvImageFileExtension

The expected file extension(s) of the model's full render, leave as None to auto detect of all supported formats.

bustRenderFormat AvImageFileExtension

The expected file extension(s) of the model's bust render, leave as None to auto detect of all supported formats.

shouldLoadFullRender bool

Should the full render be loaded?

shouldLoadBustRender bool

Should the bust render be loaded?

Remarks

basePath must contain the avatar and associated data in the following structure:

basePath/
├─ model.[supported model extension]      # The avatar's model
├─ metadata.json                          # Metadata
├─ full.[supported image extension]       # Full render of the avatar (optional)
└─ bust.[supported image extension]       # Bust render of the avatar (optional)

If you want to use a different file structure, call FileAvDataLoader(string, string, string?, string?) instead.

Methods

LoadAvatarAsync(bool, CancellationToken)

Tries loading an avatar into an AvSourceData.

public Awaitable<AvSourceData?> LoadAvatarAsync(bool throwOnFail, CancellationToken token = default)

Parameters

throwOnFail bool

Should this method throw errors on failures or log them as warnings and return null?

token CancellationToken

Returns

Awaitable<AvSourceData>

The loaded data if successful; null on failure.

TrySearchForBustRender(string, AvImageFileExtension, out string?, out AvImageFileExtension)

Searches for a supported bust-render image file inside directory using the default bust-render file name.

public static bool TrySearchForBustRender(string directory, AvImageFileExtension searchFilter, out string? foundPath, out AvImageFileExtension foundExtension)

Parameters

directory string

The directory to search in.

searchFilter AvImageFileExtension

The expected image file extension(s). Use None or grouped values to search across all supported formats.

foundPath string

When this method returns true, contains the full path to the found image file.

foundExtension AvImageFileExtension

When this method returns true, contains the detected image file extension.

Returns

bool

true if a valid image file was found; otherwise, false.

TrySearchForFullRender(string, AvImageFileExtension, out string?, out AvImageFileExtension)

Searches for a supported full-render image file inside directory using the default full-render file name.

public static bool TrySearchForFullRender(string directory, AvImageFileExtension searchFilter, out string? foundPath, out AvImageFileExtension foundExtension)

Parameters

directory string

The directory to search in.

searchFilter AvImageFileExtension

The expected image file extension(s). Use None or grouped values to search across all supported formats.

foundPath string

When this method returns true, contains the full path to the found image file.

foundExtension AvImageFileExtension

When this method returns true, contains the detected image file extension.

Returns

bool

true if a valid image file was found; otherwise, false.

TrySearchForImageFile(string, string, AvImageFileExtension, out string?, out AvImageFileExtension)

Searches for a supported image file inside directory using a custom base file name.

public static bool TrySearchForImageFile(string directory, string fileNameWithoutExtensino, AvImageFileExtension searchFilter, out string? foundPath, out AvImageFileExtension foundExtension)

Parameters

directory string

The directory to search in.

fileNameWithoutExtensino string

The image file name without an extension.

searchFilter AvImageFileExtension

The expected image file extension(s). Use None or grouped values to search across all supported formats.

foundPath string

When this method returns true, contains the full path to the found image file.

foundExtension AvImageFileExtension

When this method returns true, contains the detected image file extension.

Returns

bool

true if a valid image file was found; otherwise, false.

TrySearchForModelFile(string, string, AvModelFileExtension, out string?, out AvModelFileExtension)

Searches for a supported avatar model file inside directory using a custom base file name.

public static bool TrySearchForModelFile(string directory, string fileNameWithoutExtensino, AvModelFileExtension searchFilter, out string? foundPath, out AvModelFileExtension foundExtension)

Parameters

directory string

The directory to search in.

fileNameWithoutExtensino string

The model file name without an extension.

searchFilter AvModelFileExtension

The expected model file extension(s). Use None or grouped values to search across all supported formats.

foundPath string

When this method returns true, contains the full path to the found model file.

foundExtension AvModelFileExtension

When this method returns true, contains the detected model file extension.

Returns

bool

true if a valid model file was found; otherwise, false.

TrySearchForModelFile(string, AvModelFileExtension, out string?, out AvModelFileExtension)

Searches for a supported avatar model file inside directory using the default model file name.

public static bool TrySearchForModelFile(string directory, AvModelFileExtension searchFilter, out string? foundPath, out AvModelFileExtension foundExtension)

Parameters

directory string

The directory to search in.

searchFilter AvModelFileExtension

The expected model file extension(s). Use None or grouped values to search across all supported formats.

foundPath string

When this method returns true, contains the full path to the found model file.

foundExtension AvModelFileExtension

When this method returns true, contains the detected model file extension.

Returns

bool

true if a valid model file was found; otherwise, false.