diff options
| author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-10-07 23:20:36 -0400 |
|---|---|---|
| committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-10-07 23:20:36 -0400 |
| commit | d0dd2f7ba729de6be749d326a2fed78988ba9d7b (patch) | |
| tree | a22127da6a8900e9f29bbb847bfd5d3347f6b952 /src/StardewModdingAPI/Framework/Content/AssetDataForDictionary.cs | |
| parent | 7889676ea24cafc945899bf25608784e3f5bc9e0 (diff) | |
| parent | 5928f5f86c4493ddb6b89bce0b7d0fb73a884c09 (diff) | |
| download | SMAPI-d0dd2f7ba729de6be749d326a2fed78988ba9d7b.tar.gz SMAPI-d0dd2f7ba729de6be749d326a2fed78988ba9d7b.tar.bz2 SMAPI-d0dd2f7ba729de6be749d326a2fed78988ba9d7b.zip | |
Merge branch 'add-mod-build-config' into develop
Diffstat (limited to 'src/StardewModdingAPI/Framework/Content/AssetDataForDictionary.cs')
| -rw-r--r-- | src/StardewModdingAPI/Framework/Content/AssetDataForDictionary.cs | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/StardewModdingAPI/Framework/Content/AssetDataForDictionary.cs b/src/StardewModdingAPI/Framework/Content/AssetDataForDictionary.cs deleted file mode 100644 index e9b29b12..00000000 --- a/src/StardewModdingAPI/Framework/Content/AssetDataForDictionary.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace StardewModdingAPI.Framework.Content -{ - /// <summary>Encapsulates access and changes to dictionary content being read from a data file.</summary> - internal class AssetDataForDictionary<TKey, TValue> : AssetData<IDictionary<TKey, TValue>>, IAssetDataForDictionary<TKey, TValue> - { - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - /// <param name="locale">The content's locale code, if the content is localised.</param> - /// <param name="assetName">The normalised asset name being read.</param> - /// <param name="data">The content data being read.</param> - /// <param name="getNormalisedPath">Normalises an asset key to match the cache key.</param> - public AssetDataForDictionary(string locale, string assetName, IDictionary<TKey, TValue> data, Func<string, string> getNormalisedPath) - : base(locale, assetName, data, getNormalisedPath) { } - - /// <summary>Add or replace an entry in the dictionary.</summary> - /// <param name="key">The entry key.</param> - /// <param name="value">The entry value.</param> - public void Set(TKey key, TValue value) - { - this.Data[key] = value; - } - - /// <summary>Add or replace an entry in the dictionary.</summary> - /// <param name="key">The entry key.</param> - /// <param name="value">A callback which accepts the current value and returns the new value.</param> - public void Set(TKey key, Func<TValue, TValue> value) - { - this.Data[key] = value(this.Data[key]); - } - - /// <summary>Dynamically replace values in the dictionary.</summary> - /// <param name="replacer">A lambda which takes the current key and value for an entry, and returns the new value.</param> - public void Set(Func<TKey, TValue, TValue> replacer) - { - foreach (var pair in this.Data.ToArray()) - this.Data[pair.Key] = replacer(pair.Key, pair.Value); - } - } -} |
