From 929dccb75a1405737975d76648e015a3e7c00177 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 7 Oct 2017 23:07:10 -0400 Subject: reorganise repo structure --- .../Framework/Content/AssetData.cs | 44 ---------------------- 1 file changed, 44 deletions(-) delete mode 100644 src/StardewModdingAPI/Framework/Content/AssetData.cs (limited to 'src/StardewModdingAPI/Framework/Content/AssetData.cs') diff --git a/src/StardewModdingAPI/Framework/Content/AssetData.cs b/src/StardewModdingAPI/Framework/Content/AssetData.cs deleted file mode 100644 index 1ab9eebd..00000000 --- a/src/StardewModdingAPI/Framework/Content/AssetData.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; - -namespace StardewModdingAPI.Framework.Content -{ - /// Base implementation for a content helper which encapsulates access and changes to content being read from a data file. - /// The interface value type. - internal class AssetData : AssetInfo, IAssetData - { - /********* - ** Accessors - *********/ - /// The content data being read. - public TValue Data { get; protected set; } - - - /********* - ** Public methods - *********/ - /// Construct an instance. - /// The content's locale code, if the content is localised. - /// The normalised asset name being read. - /// The content data being read. - /// Normalises an asset key to match the cache key. - public AssetData(string locale, string assetName, TValue data, Func getNormalisedPath) - : base(locale, assetName, data.GetType(), getNormalisedPath) - { - this.Data = data; - } - - /// Replace the entire content value with the given value. This is generally not recommended, since it may break compatibility with other mods or different versions of the game. - /// The new content value. - /// The is null. - /// The 's type is not compatible with the loaded asset's type. - public void ReplaceWith(TValue value) - { - if (value == null) - throw new ArgumentNullException(nameof(value), "Can't set a loaded asset to a null value."); - if (!this.DataType.IsInstanceOfType(value)) - throw new InvalidCastException($"Can't replace loaded asset of type {this.GetFriendlyTypeName(this.DataType)} with value of type {this.GetFriendlyTypeName(value.GetType())}. The new type must be compatible to prevent game errors."); - - this.Data = value; - } - } -} -- cgit