diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-06-09 21:13:01 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-07-01 12:18:41 -0400 |
commit | 49c75de5fc139144b152207ba05f2936a2d25904 (patch) | |
tree | 537234c4f7c3d99323edbc77ae9f4619d4fcc568 /src/StardewModdingAPI/Framework/Content/ContentEventHelperForDictionary.cs | |
parent | 7b6b2742f65ac1d2590357babc517b6cd9b69d04 (diff) | |
download | SMAPI-49c75de5fc139144b152207ba05f2936a2d25904.tar.gz SMAPI-49c75de5fc139144b152207ba05f2936a2d25904.tar.bz2 SMAPI-49c75de5fc139144b152207ba05f2936a2d25904.zip |
rewrite content interception using latest proposed API (#255)
Diffstat (limited to 'src/StardewModdingAPI/Framework/Content/ContentEventHelperForDictionary.cs')
-rw-r--r-- | src/StardewModdingAPI/Framework/Content/ContentEventHelperForDictionary.cs | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/StardewModdingAPI/Framework/Content/ContentEventHelperForDictionary.cs b/src/StardewModdingAPI/Framework/Content/ContentEventHelperForDictionary.cs deleted file mode 100644 index 26f059e4..00000000 --- a/src/StardewModdingAPI/Framework/Content/ContentEventHelperForDictionary.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 ContentEventHelperForDictionary<TKey, TValue> : ContentEventData<IDictionary<TKey, TValue>>, IContentEventHelperForDictionary<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 ContentEventHelperForDictionary(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); - } - } -} |