AssetRegistry Class
Namespace: Stride.Core.AssetsAssembly: Stride.Core.Assets.dll
A registry for various content associated with assets.
public static class AssetRegistry
| Name | Description | |
|---|---|---|
| Properties | ||
| AssetAssemblies | Gets the list of asset assemblies currently registered. |
|
| EngineAssemblies | Gets the list of engine assemblies currently registered. |
|
| RegisteredImporters | Gets an enumeration of registered importers. |
|
| SupportedPlatforms | Gets the supported platforms. |
|
| Methods | ||
| FindImporterById(Guid) | Finds an importer by its id. |
|
| FindImporterForFile(String) | Finds the importer associated with an asset by the file of the file to import. |
|
| GetAllAssetFactories() | ||
| GetAssetFactory(String) | ||
| GetAssetTypeFromFileExtension(String) | Gets the asset type from the extension. If no asset type is found, return null. |
|
| GetAssetTypes(Type) | ||
| GetAssetUpgraders(Type, String) | Gets the AssetUpgraderCollection of an asset type, if available. |
|
| GetContentType(Type) | ||
| GetContentTypes() | ||
| GetCurrentFormatVersions(Type) | Gets the current format version of an asset. |
|
| GetDataVisitNodes() | ||
| GetDefaultExtension(Type) | Gets the default file associated with an asset. |
|
| GetDefaultExtension<T>() | Gets the default file associated with an asset. |
|
| GetPackageSessionAnalysisTypes() | ||
| GetPackageUpgrader(String) | ||
| GetPublicTypes() | Returns an array of asset types that are non-abstract and public. |
|
| IsAssetFileExtension(String) | Determines whether the file is an asset file type. |
|
| IsAssetOrPackageType(Type, Boolean) | Check if the specified type is an asset. |
|
| IsAssetType(Type, Boolean) | Check if the specified type is an asset. |
|
| IsAssetTypeAlwaysMarkAsRoot(Type) | ||
| IsContentType(Type) | ||
| IsProjectAssetFileExtension(String) | ||
| IsProjectCodeGeneratorAssetFileExtension(String) | ||
| RegisterImporter(IAssetImporter) | Registers a IAssetImporter for the specified asset type. |
|
| RegisterSupportedPlatforms(List<SolutionPlatform>) | Registers the supported platforms. |
|
Properties
AssetAssemblies
Gets the list of asset assemblies currently registered.
public static IEnumerable<Assembly> AssetAssemblies { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<System.Reflection.Assembly> |
EngineAssemblies
Gets the list of engine assemblies currently registered.
public static IEnumerable<Assembly> EngineAssemblies { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<System.Reflection.Assembly> |
RegisteredImporters
Gets an enumeration of registered importers.
public static IEnumerable<IAssetImporter> RegisteredImporters { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<IAssetImporter> | The registered importers. |
SupportedPlatforms
Gets the supported platforms.
public static SolutionPlatformCollection SupportedPlatforms { get; }
Property Value
| Type | Description |
|---|---|
| SolutionPlatformCollection | The supported platforms. |
Methods
FindImporterById(Guid)
Finds an importer by its id.
public static IAssetImporter FindImporterById(Guid importerId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Guid | importerId | The importer identifier. |
Returns
| Type | Description |
|---|---|
| IAssetImporter | An instance of the importer of null if not found. |
FindImporterForFile(String)
Finds the importer associated with an asset by the file of the file to import.
public static IEnumerable<IAssetImporter> FindImporterForFile(string file)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | file | The file to import. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<IAssetImporter> | An instance of the importer of null if not found. |
GetAllAssetFactories()
public static IEnumerable<IAssetFactory<Asset>> GetAllAssetFactories()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<IAssetFactory<Asset>> |
GetAssetFactory(String)
public static IAssetFactory<Asset> GetAssetFactory(string typeName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | typeName |
Returns
| Type | Description |
|---|---|
| IAssetFactory<Asset> |
GetAssetTypeFromFileExtension(String)
Gets the asset type from the extension. If no asset type is found, return null.
public static Type GetAssetTypeFromFileExtension(string extension)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | extension | The extension of the asset file. |
Returns
| Type | Description |
|---|---|
| System.Type | Type of the associated asset or null if not found. |
GetAssetTypes(Type)
public static IReadOnlyList<Type> GetAssetTypes(Type contentType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | contentType |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyList<System.Type> |
GetAssetUpgraders(Type, String)
Gets the AssetUpgraderCollection of an asset type, if available.
public static AssetUpgraderCollection GetAssetUpgraders(Type assetType, string dependencyName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | assetType | The asset type. |
| System.String | dependencyName | The dependency name. |
Returns
| Type | Description |
|---|---|
| AssetUpgraderCollection | The AssetUpgraderCollection of an asset type if available, or |
GetContentType(Type)
public static Type GetContentType(Type assetType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | assetType |
Returns
| Type | Description |
|---|---|
| System.Type |
GetContentTypes()
public static IList<Type> GetContentTypes()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IList<System.Type> |
GetCurrentFormatVersions(Type)
Gets the current format version of an asset.
public static SortedList<string, PackageVersion> GetCurrentFormatVersions(Type assetType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | assetType | The asset type. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.SortedList<System.String, Stride.Core.PackageVersion> | The current format version of this asset. |
GetDataVisitNodes()
public static IEnumerable<IDataCustomVisitor> GetDataVisitNodes()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<Stride.Core.Reflection.IDataCustomVisitor> |
GetDefaultExtension(Type)
Gets the default file associated with an asset.
public static string GetDefaultExtension(Type assetType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | assetType | The type. |
Returns
| Type | Description |
|---|---|
| System.String | System.String. |
GetDefaultExtension<T>()
Gets the default file associated with an asset.
public static string GetDefaultExtension<T>()
where T : Asset
Returns
| Type | Description |
|---|---|
| System.String | System.String. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the asset. |
GetPackageSessionAnalysisTypes()
public static IEnumerable<Type> GetPackageSessionAnalysisTypes()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<System.Type> |
GetPackageUpgrader(String)
public static PackageUpgrader GetPackageUpgrader(string packageName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | packageName |
Returns
| Type | Description |
|---|---|
| PackageUpgrader |
GetPublicTypes()
Returns an array of asset types that are non-abstract and public.
public static Type[] GetPublicTypes()
Returns
| Type | Description |
|---|---|
| System.Type[] | An array of System.Type elements. |
IsAssetFileExtension(String)
Determines whether the file is an asset file type.
public static bool IsAssetFileExtension(string extension)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | extension | The file. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
IsAssetOrPackageType(Type, Boolean)
Check if the specified type is an asset.
public static bool IsAssetOrPackageType(Type assetType, bool throwException = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | assetType | Type of the asset. |
| System.Boolean | throwException | A boolean indicating whether this method should throw an exception if the type is not an asset type. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
IsAssetType(Type, Boolean)
Check if the specified type is an asset.
public static bool IsAssetType(Type assetType, bool throwException = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | assetType | Type of the asset. |
| System.Boolean | throwException | A boolean indicating whether this method should throw an exception if the type is not an asset type. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
IsAssetTypeAlwaysMarkAsRoot(Type)
public static bool IsAssetTypeAlwaysMarkAsRoot(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | type |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsContentType(Type)
public static bool IsContentType(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | type |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsProjectAssetFileExtension(String)
public static bool IsProjectAssetFileExtension(string extension)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | extension |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsProjectCodeGeneratorAssetFileExtension(String)
public static bool IsProjectCodeGeneratorAssetFileExtension(string extension)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | extension |
Returns
| Type | Description |
|---|---|
| System.Boolean |
RegisterImporter(IAssetImporter)
Registers a IAssetImporter for the specified asset type.
public static void RegisterImporter(IAssetImporter importer)
Parameters
| Type | Name | Description |
|---|---|---|
| IAssetImporter | importer | The importer. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | importer |
RegisterSupportedPlatforms(List<SolutionPlatform>)
Registers the supported platforms.
public static void RegisterSupportedPlatforms(List<SolutionPlatform> platforms)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<SolutionPlatform> | platforms | The platforms. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | platforms |