Class AssetRegistry
A registry for various content associated with assets.
public static class AssetRegistry
- Inheritance
-
AssetRegistry
Properties
AssetAssemblies
Gets the list of asset assemblies currently registered.
public static IEnumerable<Assembly> AssetAssemblies { get; }
Property Value
EngineAssemblies
Gets the list of engine assemblies currently registered.
public static IEnumerable<Assembly> EngineAssemblies { get; }
Property Value
RegisteredImporters
Gets an enumeration of registered importers.
public static IEnumerable<IAssetImporter> RegisteredImporters { get; }
Property Value
- IEnumerable<IAssetImporter>
The registered importers.
SupportedPlatforms
Gets the supported platforms.
public static SolutionPlatformCollection SupportedPlatforms { get; }
Property Value
- SolutionPlatformCollection
The supported platforms.
Methods
CanBeAssignedToContentTypes(Type, bool)
Can a property of this type hold content
public static bool CanBeAssignedToContentTypes(Type type, bool checkIsUrlType)
Parameters
Returns
Remarks
You may want to use IsExactContentType(Type?) instead if you're checking if this type is a concrete content type
CanPropertyHandleAssets(Type, out HashSet<Type>)
Whether a property of this type can be set to asset content, outputs the assets it can hold if true
public static bool CanPropertyHandleAssets(Type propertyType, out HashSet<Type> assetTypes)
Parameters
Returns
Remarks
The difference between this one and CanPropertyHandleContent(Type, out IReadOnlyList<Type>) is that this one returns the asset types,
meaning the types that would be compiled into 'content' to be used at runtime.
This means that the types contained in AssetTypes are not directly assignable to propertyType
CanPropertyHandleContent(Type, out IReadOnlyList<Type>)
Whether a property of this type can be set to content, outputs the content types it can hold if true
public static bool CanPropertyHandleContent(Type propertyType, out IReadOnlyList<Type> contentTypes)
Parameters
propertyType
TypecontentTypes
IReadOnlyList<Type>
Returns
Remarks
The difference between this one and CanPropertyHandleAssets(Type, out HashSet<Type>) is that this one returns the content types,
meaning the concrete types that are types that would be compiled into 'content' to be used at runtime.
The types contained in contentTypes are not guaranteed to be assignable to propertyType
FindImporterById(Guid)
Finds an importer by its id.
public static IAssetImporter? FindImporterById(Guid importerId)
Parameters
importerId
GuidThe importer identifier.
Returns
- 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
file
stringThe file to import.
Returns
- IEnumerable<IAssetImporter>
An instance of the importer of null if not found.
GetAllAssetFactories()
public static IEnumerable<IAssetFactory<Asset>> GetAllAssetFactories()
Returns
GetAssetFactory(string)
public static IAssetFactory<Asset>? GetAssetFactory(string typeName)
Parameters
typeName
string
Returns
GetAssetTypeFromFileExtension(string)
Gets the asset type from the extension. If no asset type is found, return null.
public static Type? GetAssetTypeFromFileExtension(string extension)
Parameters
extension
stringThe extension of the asset file.
Returns
- Type
Type of the associated asset or null if not found.
GetAssetTypes(Type)
public static IReadOnlyList<Type> GetAssetTypes(Type contentType)
Parameters
contentType
Type
Returns
GetAssetUpgraders(Type, string)
Gets the AssetUpgraderCollection of an asset type, if available.
public static AssetUpgraderCollection? GetAssetUpgraders(Type assetType, string dependencyName)
Parameters
Returns
- AssetUpgraderCollection
The AssetUpgraderCollection of an asset type if available, or
null
otherwise.
GetContentType(Type)
public static Type? GetContentType(Type assetType)
Parameters
assetType
Type
Returns
GetContentTypes()
public static IList<Type> GetContentTypes()
Returns
GetCurrentFormatVersions(Type)
Gets the current format version of an asset.
public static SortedList<string, PackageVersion>? GetCurrentFormatVersions(Type assetType)
Parameters
assetType
TypeThe asset type.
Returns
- SortedList<string, PackageVersion>
The current format version of this asset.
GetDataVisitNodes()
public static IEnumerable<IDataCustomVisitor> GetDataVisitNodes()
Returns
- IEnumerable<IDataCustomVisitor>
GetDefaultExtension(Type)
Gets the default file associated with an asset.
public static string? GetDefaultExtension(Type assetType)
Parameters
assetType
TypeThe type.
Returns
- string
System.String.
GetDefaultExtension<T>()
Gets the default file associated with an asset.
public static string? GetDefaultExtension<T>() where T : Asset
Returns
- string
System.String.
Type Parameters
T
Type of the asset.
GetPackageSessionAnalysisTypes()
public static IEnumerable<Type> GetPackageSessionAnalysisTypes()
Returns
GetPackageUpgrader(string)
public static PackageUpgrader? GetPackageUpgrader(string packageName)
Parameters
packageName
string
Returns
GetPublicTypes()
Returns an array of asset types that are non-abstract and public.
public static Type[] GetPublicTypes()
Returns
IsAssetFileExtension(string?)
Determines whether the file is an asset file type.
public static bool IsAssetFileExtension(string? extension)
Parameters
extension
stringThe file.
Returns
- bool
true
if [is asset file file] [the specified file]; otherwise,false
.
IsAssetOrPackageType(Type, bool)
Check if the specified type is an asset.
public static bool IsAssetOrPackageType(Type assetType, bool throwException = false)
Parameters
assetType
TypeType of the asset.
throwException
boolA boolean indicating whether this method should throw an exception if the type is not an asset type.
Returns
- bool
true
if the asset is an asset type, false otherwise.
IsAssetType(Type, bool)
Check if the specified type is an asset.
public static bool IsAssetType(Type assetType, bool throwException = false)
Parameters
assetType
TypeType of the asset.
throwException
boolA boolean indicating whether this method should throw an exception if the type is not an asset type.
Returns
- bool
true
if the asset is an asset type, false otherwise.
IsAssetTypeAlwaysMarkAsRoot(Type)
public static bool IsAssetTypeAlwaysMarkAsRoot(Type type)
Parameters
type
Type
Returns
IsExactContentType(Type?)
Is this type a concrete content type, or derives from a concrete content type
public static bool IsExactContentType(Type? type)
Parameters
type
Type
Returns
Remarks
You may want to use CanBeAssignedToContentTypes(Type, bool) instead if you're checking whether a property of this type could hold at least one type of content
IsProjectAssetFileExtension(string?)
public static bool IsProjectAssetFileExtension(string? extension)
Parameters
extension
string
Returns
IsProjectCodeGeneratorAssetFileExtension(string?)
public static bool IsProjectCodeGeneratorAssetFileExtension(string? extension)
Parameters
extension
string
Returns
RegisterImporter(IAssetImporter)
Registers a IAssetImporter for the specified asset type.
public static void RegisterImporter(IAssetImporter importer)
Parameters
importer
IAssetImporterThe importer.
Exceptions
- ArgumentNullException
importer
RegisterSupportedPlatforms(List<SolutionPlatform>)
Registers the supported platforms.
public static void RegisterSupportedPlatforms(List<SolutionPlatform> platforms)
Parameters
platforms
List<SolutionPlatform>The platforms.
Exceptions
- ArgumentNullException
platforms