Class UrlReferenceContentManagerExtenstions
- Namespace
- Stride.Core.Serialization
- Assembly
- Stride.Core.Serialization.dll
Extension methods of IContentManager to allow usage of UrlReference and UrlReference<T>.
public static class UrlReferenceContentManagerExtenstions- Inheritance
- 
      objectUrlReferenceContentManagerExtenstions
Methods
Exists(IContentManager, IUrlReference)
Check if the specified asset url exists.
public static bool Exists(this IContentManager content, IUrlReference urlReference)Parameters
- contentIContentManager
- The IContentManager. 
- urlReferenceIUrlReference
- The URL. 
Returns
- bool
- trueif the specified asset url exists,- falseotherwise.
Exceptions
- ArgumentNullException
- If - urlReferenceis- nullor- empty. Or- contentis- null.
Get<T>(IContentManager, UrlReference<T>)
Gets a previously loaded asset from its URL.
public static T? Get<T>(this IContentManager content, UrlReference<T> urlReference) where T : classParameters
- contentIContentManager
- urlReferenceUrlReference<T>
- The URL of the asset to retrieve. 
Returns
- T
- The loaded asset, or - nullif the asset has not been loaded.
Type Parameters
- T
- The type of asset to retrieve. 
Remarks
This function does not increase the reference count on the asset.
Exceptions
- ArgumentNullException
- If - urlReferenceis- nullor- empty. Or- contentis- null.
IsLoaded(IContentManager, IUrlReference, bool)
Gets whether an asset with the given URL is currently loaded.
public static bool IsLoaded(this IContentManager content, IUrlReference urlReference, bool loadedManuallyOnly = false)Parameters
- contentIContentManager
- urlReferenceIUrlReference
- The URL to check. 
- loadedManuallyOnlybool
- If - true, this method will return true only if an asset with the given URL has been manually loaded via Load<T>(IContentManager, UrlReference<T>, ContentManagerLoaderSettings?), and not if the asset has been only loaded indirectly from another asset.
Returns
- bool
- Trueif an asset with the given URL is currently loaded,- falseotherwise.
Exceptions
- ArgumentNullException
- If - urlReferenceis- nullor- empty. Or- contentis- null.
LoadAsync<T>(IContentManager, UrlReference<T>, ContentManagerLoaderSettings?)
Loads content from the specified URL asynchronously.
public static Task<T> LoadAsync<T>(this IContentManager content, UrlReference<T> urlReference, ContentManagerLoaderSettings? settings = null) where T : classParameters
- contentIContentManager
- The IContentManager. 
- urlReferenceUrlReference<T>
- The URL to load from. 
- settingsContentManagerLoaderSettings
- The settings. If null, fallback to Default. 
Returns
- Task<T>
- The loaded content. 
Type Parameters
- T
- The content type. 
Exceptions
- ArgumentNullException
- If - urlReferenceis- nullor- empty. Or- contentis- null.
Load<T>(IContentManager, UrlReference<T>, ContentManagerLoaderSettings?)
Loads content from the specified URL.
public static T Load<T>(this IContentManager content, UrlReference<T> urlReference, ContentManagerLoaderSettings? settings = null) where T : classParameters
- contentIContentManager
- The IContentManager. 
- urlReferenceUrlReference<T>
- The URL to load from. 
- settingsContentManagerLoaderSettings
- The settings. If null, fallback to Default. 
Returns
- T
- The loaded content. 
Type Parameters
- T
- The content type. 
Exceptions
- ArgumentNullException
- If - urlReferenceis- nullor- empty. Or- contentis- null.
OpenAsStream(IContentManager, UrlReference, StreamFlags)
Opens the specified URL as a stream used for custom raw asset loading.
public static Stream OpenAsStream(this IContentManager content, UrlReference urlReference, StreamFlags streamFlags = StreamFlags.None)Parameters
- contentIContentManager
- The IContentManager. 
- urlReferenceUrlReference
- The URL to the raw asset. 
- streamFlagsStreamFlags
- The type of stream needed 
Returns
- Stream
- A stream to the raw asset. 
Exceptions
- ArgumentNullException
- If - urlReferenceis- nullor- empty. Or- contentis- null.
Unload(IContentManager, IUrlReference)
Unloads the asset at the specified URL.
public static void Unload(this IContentManager content, IUrlReference urlReference)Parameters
- contentIContentManager
- urlReferenceIUrlReference
- The URL. 
Exceptions
- ArgumentNullException
- If - urlReferenceis- nullor- empty. Or- contentis- null.