summaryrefslogtreecommitdiff
path: root/src/SMAPI/IGameContentHelper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/IGameContentHelper.cs')
-rw-r--r--src/SMAPI/IGameContentHelper.cs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/SMAPI/IGameContentHelper.cs b/src/SMAPI/IGameContentHelper.cs
index 4b967993..d40d0c82 100644
--- a/src/SMAPI/IGameContentHelper.cs
+++ b/src/SMAPI/IGameContentHelper.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
@@ -35,14 +33,16 @@ namespace StardewModdingAPI
/// <param name="assetName">The asset name to load.</param>
/// <exception cref="ArgumentException">The <paramref name="assetName"/> is empty or contains invalid characters.</exception>
/// <exception cref="ContentLoadException">The content asset couldn't be loaded (e.g. because it doesn't exist).</exception>
- T Load<T>(string assetName);
+ T Load<T>(string assetName)
+ where T : notnull;
/// <summary>Load content from the game folder or mod folder (if not already cached), and return it. When loading a <c>.png</c> file, this must be called outside the game's draw loop.</summary>
/// <typeparam name="T">The expected data type. The main supported types are <see cref="Map"/>, <see cref="Texture2D"/>, dictionaries, and lists; other types may be supported by the game's content pipeline.</typeparam>
/// <param name="assetName">The asset name to load.</param>
/// <exception cref="ArgumentException">The <paramref name="assetName"/> is empty or contains invalid characters.</exception>
/// <exception cref="ContentLoadException">The content asset couldn't be loaded (e.g. because it doesn't exist).</exception>
- T Load<T>(IAssetName assetName);
+ T Load<T>(IAssetName assetName)
+ where T : notnull;
/// <summary>Remove an asset from the content cache so it's reloaded on the next request. This will reload core game assets if needed, but references to the former asset will still show the previous content.</summary>
/// <param name="assetName">The asset key to invalidate in the content folder.</param>
@@ -59,7 +59,8 @@ namespace StardewModdingAPI
/// <summary>Remove all assets of the given type from the cache so they're reloaded on the next request. <b>This can be a very expensive operation and should only be used in very specific cases.</b> This will reload core game assets if needed, but references to the former assets will still show the previous content.</summary>
/// <typeparam name="T">The asset type to remove from the cache.</typeparam>
/// <returns>Returns whether any assets were invalidated.</returns>
- bool InvalidateCache<T>();
+ bool InvalidateCache<T>()
+ where T : notnull;
/// <summary>Remove matching assets from the content cache so they're reloaded on the next request. This will reload core game assets if needed, but references to the former asset will still show the previous content.</summary>
/// <param name="predicate">A predicate matching the assets to invalidate.</param>
@@ -70,6 +71,7 @@ namespace StardewModdingAPI
/// <typeparam name="T">The data type.</typeparam>
/// <param name="data">The asset data.</param>
/// <param name="assetName">The asset name. This is only used for tracking purposes and has no effect on the patch helper.</param>
- IAssetData GetPatchHelper<T>(T data, string assetName = null);
+ IAssetData GetPatchHelper<T>(T data, string? assetName = null)
+ where T : notnull;
}
}