private static void CheckArguments(IContentManager content, IUrlReference urlReference) { if (content == null) { throw new ArgumentNullException(nameof(content)); } if (urlReference == null || urlReference.IsEmpty) { throw new ArgumentNullException(nameof(urlReference)); } }
/// <summary> /// Check if the specified asset url exists. /// </summary> /// <param name="content">The <see cref="IContentManager"/>.</param> /// <param name="urlReference">The URL.</param> /// <returns><c>true</c> if the specified asset url exists, <c>false</c> otherwise.</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 bool Exists(this IContentManager content, IUrlReference urlReference) { CheckArguments(content, urlReference); return(content.Exists(urlReference.Url)); }
/// <summary> /// Unloads the asset at the specified URL. /// </summary> /// <param name="urlReference">The URL.</param> /// <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 void Unload(this IContentManager content, IUrlReference urlReference) { CheckArguments(content, urlReference); content.Unload(urlReference.Url); }
/// <summary> /// Gets whether an asset with the given URL is currently loaded. /// </summary> /// <param name="urlReference">The URL to check.</param> /// <param name="loadedManuallyOnly">If <c>true</c>, this method will return true only if an asset with the given URL has been manually loaded via <see cref="Load"/>, and not if the asset has been only loaded indirectly from another asset.</param> /// <returns><c>True</c> if an asset with the given URL is currently loaded, <c>false</c> otherwise.</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 bool IsLoaded(this IContentManager content, IUrlReference urlReference, bool loadedManuallyOnly = false) { CheckArguments(content, urlReference); return(content.IsLoaded(urlReference.Url, loadedManuallyOnly)); }