Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    UrlReferenceContentManagerExtenstions Class

    Namespace: Stride.Core.Serialization
    Assembly: Stride.Core.Serialization.dll

    Extension methods of IContentManager to allow usage of UrlReference and UrlReference<T>.

    System.Object → UrlReferenceContentManagerExtenstions
    Derived from UrlReferenceContentManagerExtenstions:

    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.

    | Improve this Doc View Source

    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

    true if the specified asset url exists, false otherwise.

    Exceptions
    Type Condition
    System.ArgumentNullException

    If urlReference is null or empty. Or content is 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 : 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 null if the asset has not been loaded.

    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 urlReference is null or empty. Or content is null.


    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 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
    Type Description
    System.Boolean

    True if an asset with the given URL is currently loaded, false otherwise.

    Exceptions
    Type Condition
    System.ArgumentNullException

    If urlReference is null or empty. Or content is 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 : 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 urlReference is null or empty. Or content is 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 : 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 urlReference is null or empty. Or content is 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
    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 urlReference is null or empty. Or content is null.


    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 urlReference is null or empty. Or content is null.


    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation