diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-04-05 14:55:46 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-04-05 14:55:46 -0400 |
commit | dbb9bd84306830456032778fc11fb9a34dd140c7 (patch) | |
tree | 0219cab065bfffbbbb9b048b6a30044f510be2c5 /src/StardewModdingAPI/IContentEventHelperForDictionary.cs | |
parent | 9c9833c9086b758589dafee10243e3bf47e12d73 (diff) | |
parent | 4675da0600edf6781cd740549ad0a175b606fc1e (diff) | |
download | SMAPI-dbb9bd84306830456032778fc11fb9a34dd140c7.tar.gz SMAPI-dbb9bd84306830456032778fc11fb9a34dd140c7.tar.bz2 SMAPI-dbb9bd84306830456032778fc11fb9a34dd140c7.zip |
Merge branch 'develop-1.9' into stable
Diffstat (limited to 'src/StardewModdingAPI/IContentEventHelperForDictionary.cs')
-rw-r--r-- | src/StardewModdingAPI/IContentEventHelperForDictionary.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/StardewModdingAPI/IContentEventHelperForDictionary.cs b/src/StardewModdingAPI/IContentEventHelperForDictionary.cs new file mode 100644 index 00000000..2f9d5a65 --- /dev/null +++ b/src/StardewModdingAPI/IContentEventHelperForDictionary.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; + +namespace StardewModdingAPI +{ + /// <summary>Encapsulates access and changes to dictionary content being read from a data file.</summary> + public interface IContentEventHelperForDictionary<TKey, TValue> : IContentEventData<IDictionary<TKey, TValue>> + { + /********* + ** Public methods + *********/ + /// <summary>Add or replace an entry in the dictionary.</summary> + /// <param name="key">The entry key.</param> + /// <param name="value">The entry value.</param> + void Set(TKey key, TValue 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> + void Set(TKey key, Func<TValue, TValue> value); + + /// <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> + void Set(Func<TKey, TValue, TValue> replacer); + } +} |