/// <summary> /// Loads content from the specified URL asynchronously. /// </summary> /// <typeparam name="T">The content type.</typeparam> /// <param name="content">The <see cref="IContentManager"/>.</param> /// <param name="urlReference">The URL to load from.</param> /// <param name="settings">The settings. If null, fallback to <see cref="ContentManagerLoaderSettings.Default"/>.</param> /// <returns>The loaded content.</returns> /// <exception cref="ArgumentNullException">If <paramref name="urlReference"/> is <c>null</c> or <c>empty</c>. Or <paramref name="content"/> is <c>null</c>.</exception> public static Task <T> LoadAsync <T>(this IContentManager content, UrlReference <T> urlReference, ContentManagerLoaderSettings settings = null) where T : class { CheckArguments(content, urlReference); return(content.LoadAsync <T>(urlReference.Url, settings)); }
/// <summary> /// Gets a previously loaded asset from its URL. /// </summary> /// <typeparam name="T">The type of asset to retrieve.</typeparam> /// <param name="urlReference">The URL of the asset to retrieve.</param> /// <returns>The loaded asset, or <c>null</c> if the asset has not been loaded.</returns> /// <exception cref="ArgumentNullException">If <paramref name="urlReference"/> is <c>null</c> or <c>empty</c>. Or <paramref name="content"/> is <c>null</c>.</exception> /// <remarks>This function does not increase the reference count on the asset.</remarks> public static T Get <T>(this IContentManager content, UrlReference <T> urlReference) where T : class { CheckArguments(content, urlReference); return(content.Get <T>(urlReference.Url)); }
/// <summary> /// Opens the specified URL as a stream used for custom raw asset loading. /// </summary> /// <param name="content">The <see cref="IContentManager"/>.</param> /// <param name="urlReference">The URL to the raw asset.</param> /// <param name="streamFlags">The type of stream needed</param> /// <returns>A stream to the raw asset.</returns> /// <exception cref="ArgumentNullException">If <paramref name="urlReference"/> is <c>null</c> or <c>empty</c>. Or <paramref name="content"/> is <c>null</c>.</exception> public static Stream OpenAsStream(this IContentManager content, UrlReference urlReference, StreamFlags streamFlags = StreamFlags.None) { CheckArguments(content, urlReference); return(content.OpenAsStream(urlReference.Url, streamFlags)); }