UrlReferenceContentManagerExtenstions Class
Namespace: Stride.Core.SerializationAssembly: Stride.Core.Serialization.dll
Extension methods of IContentManager to allow usage of UrlReference and UrlReference<T>.
public static class UrlReferenceContentManagerExtenstions
| Name | Description | |
|---|---|---|
| Methods | ||
| Exists(IContentManager, IUrlReference) | Check if the specified asset url exists. |
|
| Get<T>(IContentManager, UrlReference<T>) | Gets a previously loaded asset from its URL. |
|
| IsLoaded(IContentManager, IUrlReference, Boolean) | Gets whether an asset with the given URL is currently loaded. |
|
| Load<T>(IContentManager, UrlReference<T>, ContentManagerLoaderSettings) | Loads content from the specified URL. |
|
| LoadAsync<T>(IContentManager, UrlReference<T>, ContentManagerLoaderSettings) | Loads content from the specified URL asynchronously. |
|
| OpenAsStream(IContentManager, UrlReference, StreamFlags) | Opens the specified URL as a stream used for custom raw asset loading. |
|
| Unload(IContentManager, IUrlReference) | Unloads the asset at the specified URL. |
|
Methods
Exists(IContentManager, IUrlReference)
Check if the specified asset url exists.
public static bool Exists(this IContentManager content, IUrlReference urlReference)
Parameters
| Type | Name | Description |
|---|---|---|
| IContentManager | content | The IContentManager. |
| IUrlReference | urlReference | The URL. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | If |
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 : class
Parameters
| Type | Name | Description |
|---|---|---|
| IContentManager | content | |
| UrlReference<T> | urlReference | The URL of the asset to retrieve. |
Returns
| Type | Description |
|---|---|
| T | The loaded asset, or |
Type Parameters
| Name | Description |
|---|---|
| T | The type of asset to retrieve. |
Remarks
This function does not increase the reference count on the asset.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | If |
IsLoaded(IContentManager, IUrlReference, Boolean)
Gets whether an asset with the given URL is currently loaded.
public static bool IsLoaded(this IContentManager content, IUrlReference urlReference, bool loadedManuallyOnly = false)
Parameters
| Type | Name | Description |
|---|---|---|
| IContentManager | content | |
| IUrlReference | urlReference | The URL to check. |
| System.Boolean | loadedManuallyOnly | If |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | If |
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 : class
Parameters
| Type | Name | Description |
|---|---|---|
| IContentManager | content | The IContentManager. |
| UrlReference<T> | urlReference | The URL to load from. |
| ContentManagerLoaderSettings | settings | The settings. If null, fallback to Default. |
Returns
| Type | Description |
|---|---|
| T | The loaded content. |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | If |
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 : class
Parameters
| Type | Name | Description |
|---|---|---|
| IContentManager | content | The IContentManager. |
| UrlReference<T> | urlReference | The URL to load from. |
| ContentManagerLoaderSettings | settings | The settings. If null, fallback to Default. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<T> | The loaded content. |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | If |
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
| Type | Name | Description |
|---|---|---|
| IContentManager | content | The IContentManager. |
| UrlReference | urlReference | The URL to the raw asset. |
| StreamFlags | streamFlags | The type of stream needed |
Returns
| Type | Description |
|---|---|
| System.IO.Stream | A stream to the raw asset. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | If |
Unload(IContentManager, IUrlReference)
Unloads the asset at the specified URL.
public static void Unload(this IContentManager content, IUrlReference urlReference)
Parameters
| Type | Name | Description |
|---|---|---|
| IContentManager | content | |
| IUrlReference | urlReference | The URL. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | If |