C# Class 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).
Inheritance: PluginAsset
Afficher le fichier Open project: Burton-Radons/Alexandria Class Usage Examples

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
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.

Private Methods

Méthode Description
CreateConflictException ( AssetLoader loader, LoadMatchStrength matchStrength, IList formats ) : InvalidDataException
MatchStrengthToString ( LoadMatchStrength reference, LoadMatchStrength value ) : string

Method Details

AssetFormat() public méthode

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" }
Résultat System

Create() public méthode

Create a new Asset of the PrimaryType.
public Create ( AssetManager manager, Type resourceType ) : Asset
manager AssetManager
resourceType System.Type
Résultat Asset

Load() public méthode

Load an Asset. This should have previously matched using LoadMatch.
public Load ( AssetLoader loader ) : Asset
loader AssetLoader
Résultat Asset

LoadAsset() public static méthode

Load an Asset.
public static LoadAsset ( AssetLoader loader, IEnumerable formats, ResolveLoadConflictCallback resolveConflict = null ) : Asset
loader AssetLoader
formats IEnumerable
resolveConflict ResolveLoadConflictCallback
Résultat Asset

LoadAssetAsync() public static méthode

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
Résultat Task

LoadMatch() public méthode

Attempt to match this AssetFormat against the loader.
public LoadMatch ( AssetLoader loader ) : LoadMatchStrength
loader AssetLoader
Résultat LoadMatchStrength

LoadMatchAsset() public static méthode

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
Résultat AssetFormat

LoadMatchMagic() protected méthode

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
Résultat LoadMatchStrength

LoadMatchMagic() protected méthode

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
Résultat LoadMatchStrength

MatchStrengthToString() public static méthode

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
Résultat string

Save() public méthode

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.
Résultat void

SaveCheck() public méthode

Check whether the Asset can be saved with this AssetFormat.
public SaveCheck ( Asset resource ) : SaveCheckResult
resource Asset
Résultat SaveCheckResult