C# Класс Glare.Assets.AssetFormat

This describes a resource format.
To implement creating, CanCreate and Create need to be overloaded. To implement loading, CanLoad, LoadMatch, and Load need to be overloaded; LoadTypesMutable should be filled or provided in the constructor (if CanLoad is true and no types are provided in the constructor, the PrimaryType is automatically added). To implement saving, CanSave, Save, and SaveCheck need to be overloaded; SaveTypesMutable should be filled or provided in the constructor (if CanSave is true and no types are provided in the constructor, the PrimaryType is automatically added).
Наследование: PluginAsset
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AssetFormat ( PluginAsset pluginResource, Type primaryType, bool canLoad = false, IList loadTypes = null, bool canSave = false, IList saveTypes = null, bool canCreate = false, IList createTypes = null, string extension = null, IList extensions = null ) : System

Create ( AssetManager manager, Type resourceType ) : Asset

Create a new Asset of the PrimaryType.

Load ( AssetLoader loader ) : Asset

Load an Asset. This should have previously matched using LoadMatch.

LoadAsset ( AssetLoader loader, IEnumerable formats, ResolveLoadConflictCallback resolveConflict = null ) : Asset

Load an Asset.

LoadAssetAsync ( AssetLoader loader, IEnumerable formats, ResolveLoadConflictCallback resolveConflict = null, AssetLoaderProgressCallback progress = null, System.TimeSpan progressUpdateRate = null ) : Task

Load an Asset.

LoadMatch ( AssetLoader loader ) : LoadMatchStrength

Attempt to match this AssetFormat against the loader.

LoadMatchAsset ( LoadMatchStrength &matchStrength, AssetLoader loader, IEnumerable formats, ResolveLoadConflictCallback resolveConflict = null ) : AssetFormat

Find the best AssetFormat for loading an Asset.

MatchStrengthToString ( LoadMatchStrength value ) : string

Get a string describing a match strength, which handles values in between like "Perfect-2" or "Strong+3".

Save ( Asset asset, BinaryWriter writer, FileManager fileManager ) : void

Save the asset to the file.

SaveCheck ( Asset resource ) : SaveCheckResult

Check whether the Asset can be saved with this AssetFormat.

Защищенные методы

Метод Описание
LoadMatchMagic ( AssetLoader loader, int magic, int minimumLength = 4 ) : LoadMatchStrength

Perform a quick match based on a magic Int32 value.

LoadMatchMagic ( AssetLoader loader, string magic, int minimumLength ) : LoadMatchStrength

Perform a quick match based on a magic string and a minimum length.

Приватные методы

Метод Описание
CreateConflictException ( AssetLoader loader, LoadMatchStrength matchStrength, IList formats ) : InvalidDataException
MatchStrengthToString ( LoadMatchStrength reference, LoadMatchStrength value ) : string

Описание методов

AssetFormat() публичный Метод

public AssetFormat ( PluginAsset pluginResource, Type primaryType, bool canLoad = false, IList loadTypes = null, bool canSave = false, IList saveTypes = null, bool canCreate = false, IList createTypes = null, string extension = null, IList extensions = null ) : System
pluginResource PluginAsset The context for the , used to find the .
primaryType System.Type The primary type that this operates with.
canLoad bool Whether this can load s; if true, then and must be implemented.
loadTypes IList Any additional types that could be loaded beyond the ; this can only be provided if is true.
canSave bool Whether this can save s; if true, then and must be implemented, and can be provided for additional types this can save beyond the .
saveTypes IList Any additional types that this can save beyond the ; this can only be provided if is true.
canCreate bool Whether this can create an . If so, must be implemented, and can be provided for additional types this can create beyond the .
createTypes IList Any additional types that this can create beyond the ; this can only be provided if is true.
extension string File extension that this format uses in the form of ".ext".
extensions IList File extensions that this format uses in the form of new string[] { ".ext", ".ext2" }
Результат System

Create() публичный Метод

Create a new Asset of the PrimaryType.
public Create ( AssetManager manager, Type resourceType ) : Asset
manager AssetManager
resourceType System.Type
Результат Asset

Load() публичный Метод

Load an Asset. This should have previously matched using LoadMatch.
public Load ( AssetLoader loader ) : Asset
loader AssetLoader
Результат Asset

LoadAsset() публичный статический Метод

Load an Asset.
public static LoadAsset ( AssetLoader loader, IEnumerable formats, ResolveLoadConflictCallback resolveConflict = null ) : Asset
loader AssetLoader
formats IEnumerable
resolveConflict ResolveLoadConflictCallback
Результат Asset

LoadAssetAsync() публичный статический Метод

Load an Asset.
public static LoadAssetAsync ( AssetLoader loader, IEnumerable formats, ResolveLoadConflictCallback resolveConflict = null, AssetLoaderProgressCallback progress = null, System.TimeSpan progressUpdateRate = null ) : Task
loader AssetLoader
formats IEnumerable
resolveConflict ResolveLoadConflictCallback
progress AssetLoaderProgressCallback
progressUpdateRate System.TimeSpan
Результат Task

LoadMatch() публичный Метод

Attempt to match this AssetFormat against the loader.
public LoadMatch ( AssetLoader loader ) : LoadMatchStrength
loader AssetLoader
Результат LoadMatchStrength

LoadMatchAsset() публичный статический Метод

Find the best AssetFormat for loading an Asset.
public static LoadMatchAsset ( LoadMatchStrength &matchStrength, AssetLoader loader, IEnumerable formats, ResolveLoadConflictCallback resolveConflict = null ) : AssetFormat
matchStrength LoadMatchStrength
loader AssetLoader
formats IEnumerable
resolveConflict ResolveLoadConflictCallback
Результат AssetFormat

LoadMatchMagic() защищенный Метод

Perform a quick match based on a magic Int32 value.
protected LoadMatchMagic ( AssetLoader loader, int magic, int minimumLength = 4 ) : LoadMatchStrength
loader AssetLoader
magic int
minimumLength int
Результат LoadMatchStrength

LoadMatchMagic() защищенный Метод

Perform a quick match based on a magic string and a minimum length.
protected LoadMatchMagic ( AssetLoader loader, string magic, int minimumLength ) : LoadMatchStrength
loader AssetLoader
magic string
minimumLength int
Результат LoadMatchStrength

MatchStrengthToString() публичный статический Метод

Get a string describing a match strength, which handles values in between like "Perfect-2" or "Strong+3".
public static MatchStrengthToString ( LoadMatchStrength value ) : string
value LoadMatchStrength
Результат string

Save() публичный Метод

Save the asset to the file.
public Save ( Asset asset, BinaryWriter writer, FileManager fileManager ) : void
asset Asset
writer System.IO.BinaryWriter
fileManager FileManager The that might be necessary to save additional files. This can be null if it can't be supported.
Результат void

SaveCheck() публичный Метод

Check whether the Asset can be saved with this AssetFormat.
public SaveCheck ( Asset resource ) : SaveCheckResult
resource Asset
Результат SaveCheckResult