Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SiliconStudio.Assets.Analysis.AssetResolver Class Reference

Helper to find available new asset locations and identifiers. More...

Public Member Functions

delegate bool ContainsAssetWithLocationDelegate (UFile location)
 Delegate to test if the specified location is already used. More...
 
delegate bool ContainsAssetWithIdDelegate (Guid guid)
 Delegate to test if an asset id is already used. More...
 
 AssetResolver ()
 Initializes a new instance of the AssetResolver class. More...
 
 AssetResolver (ContainsAssetWithLocationDelegate containsAssetWithLocation, ContainsAssetWithIdDelegate containsAssetWithId)
 Initializes a new instance of the AssetResolver class. More...
 
bool RegisterLocation (UFile location, out UFile newLocation)
 Finds a name available for a new asset. This method will try to create a name based on an existing name and will append "_" + (number++) on every try. The new location found is added to the known existing locations. More...
 
bool RegisterId (Guid assetId, out Guid newGuid)
 Registers an asset identifier for usage. More...
 

Static Public Member Functions

static AssetResolver FromPackage (Package package)
 Creates a new AssetResolver using an existing package to check the existence of asset locations and ids. More...
 
static AssetResolver FromPackage (IList< Package > packages)
 Creates a new AssetResolver using an existing package to check the existence of asset locations and ids. More...
 

Properties

HashSet< string > ExistingLocations [get]
 Gets the locations already used. More...
 
HashSet< Guid > ExistingIds [get]
 Gets the asset ids already used. More...
 
bool AlwaysCreateNewId [get, set]
 Gets or sets a value indicating whether to always generate a new id on RegisterId. More...
 
ContainsAssetWithLocationDelegate ContainsAssetWithLocation [get, set]
 Gets or sets a delegate to test if a location is already used. More...
 
ContainsAssetWithIdDelegate ContainsAssetWithId [get, set]
 Gets or sets a delegate to test if an asset id is already used. More...
 

Detailed Description

Helper to find available new asset locations and identifiers.

Definition at line 13 of file AssetResolver.cs.

Constructor & Destructor Documentation

SiliconStudio.Assets.Analysis.AssetResolver.AssetResolver ( )

Initializes a new instance of the AssetResolver class.

Definition at line 39 of file AssetResolver.cs.

SiliconStudio.Assets.Analysis.AssetResolver.AssetResolver ( ContainsAssetWithLocationDelegate  containsAssetWithLocation,
ContainsAssetWithIdDelegate  containsAssetWithId 
)

Initializes a new instance of the AssetResolver class.

Parameters
containsAssetWithLocationThe delegate used to check if an asset location is already used.
containsAssetWithIdThe delegate used to check if an asset identifier is already used.

Definition at line 48 of file AssetResolver.cs.

Member Function Documentation

delegate bool SiliconStudio.Assets.Analysis.AssetResolver.ContainsAssetWithIdDelegate ( Guid  guid)

Delegate to test if an asset id is already used.

Parameters
guidThe unique identifier.
Returns
true if an asset id is already used, false otherwise.
delegate bool SiliconStudio.Assets.Analysis.AssetResolver.ContainsAssetWithLocationDelegate ( UFile  location)

Delegate to test if the specified location is already used.

Parameters
locationThe location to try to use.
Returns
true if the specified location is already used, false otherwise.
static AssetResolver SiliconStudio.Assets.Analysis.AssetResolver.FromPackage ( Package  package)
static

Creates a new AssetResolver using an existing package to check the existence of asset locations and ids.

Parameters
packageThe package.
Returns
A new AssetResolver.
Exceptions
System.ArgumentNullExceptionpackage

Definition at line 138 of file AssetResolver.cs.

static AssetResolver SiliconStudio.Assets.Analysis.AssetResolver.FromPackage ( IList< Package packages)
static

Creates a new AssetResolver using an existing package to check the existence of asset locations and ids.

Parameters
packagesThe packages.
Returns
A new AssetResolver.
Exceptions
System.ArgumentNullExceptionpackage

Definition at line 154 of file AssetResolver.cs.

bool SiliconStudio.Assets.Analysis.AssetResolver.RegisterId ( Guid  assetId,
out Guid  newGuid 
)

Registers an asset identifier for usage.

Parameters
assetIdThe asset identifier.
newGuidThe new unique identifier if an asset has already been registered with the same id.
Returns
true if the asset id is already in used. newGuid contains a new guid, false otherwise.

Definition at line 120 of file AssetResolver.cs.

bool SiliconStudio.Assets.Analysis.AssetResolver.RegisterLocation ( UFile  location,
out UFile  newLocation 
)

Finds a name available for a new asset. This method will try to create a name based on an existing name and will append "_" + (number++) on every try. The new location found is added to the known existing locations.

Parameters
locationThe location.
newLocationThe new location.
Returns
true if there is a new location, false otherwise.

Definition at line 107 of file AssetResolver.cs.

Property Documentation

bool SiliconStudio.Assets.Analysis.AssetResolver.AlwaysCreateNewId
getset

Gets or sets a value indicating whether to always generate a new id on RegisterId.

true if [force new identifier]; otherwise, false.

Definition at line 86 of file AssetResolver.cs.

ContainsAssetWithIdDelegate SiliconStudio.Assets.Analysis.AssetResolver.ContainsAssetWithId
getset

Gets or sets a delegate to test if an asset id is already used.

A delegate to test if an asset id is already used.

Definition at line 98 of file AssetResolver.cs.

ContainsAssetWithLocationDelegate SiliconStudio.Assets.Analysis.AssetResolver.ContainsAssetWithLocation
getset

Gets or sets a delegate to test if a location is already used.

A delegate to test if a location is already used.

Definition at line 92 of file AssetResolver.cs.

HashSet<Guid> SiliconStudio.Assets.Analysis.AssetResolver.ExistingIds
get

Gets the asset ids already used.

The existing ids.

Definition at line 75 of file AssetResolver.cs.

HashSet<string> SiliconStudio.Assets.Analysis.AssetResolver.ExistingLocations
get

Gets the locations already used.

The locations.

Definition at line 63 of file AssetResolver.cs.


The documentation for this class was generated from the following file: