summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-05-28 17:34:53 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-05-28 17:34:53 -0400
commite20db6e8e4279dc95371e6f98c0e73dd19020c0f (patch)
treeb97d6f4650f4dead44f323e2230cdda27df918c4 /src/StardewModdingAPI
parent423a2f501249e237fe907cbe5e8568852b0710c5 (diff)
downloadSMAPI-e20db6e8e4279dc95371e6f98c0e73dd19020c0f.tar.gz
SMAPI-e20db6e8e4279dc95371e6f98c0e73dd19020c0f.tar.bz2
SMAPI-e20db6e8e4279dc95371e6f98c0e73dd19020c0f.zip
add token support for instance fields, expand unit test (#296)
Diffstat (limited to 'src/StardewModdingAPI')
-rw-r--r--src/StardewModdingAPI/Translation.cs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/StardewModdingAPI/Translation.cs b/src/StardewModdingAPI/Translation.cs
index 8dcaee0f..31a1b7e1 100644
--- a/src/StardewModdingAPI/Translation.cs
+++ b/src/StardewModdingAPI/Translation.cs
@@ -107,8 +107,11 @@ namespace StardewModdingAPI
// from object properties
else
{
- foreach (PropertyInfo prop in tokens.GetType().GetProperties())
+ Type type = tokens.GetType();
+ foreach (PropertyInfo prop in type.GetProperties())
tokenLookup[prop.Name] = prop.GetValue(tokens)?.ToString();
+ foreach (FieldInfo field in type.GetFields())
+ tokenLookup[field.Name] = field.GetValue(tokens)?.ToString();
}
}