From e20db6e8e4279dc95371e6f98c0e73dd19020c0f Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 28 May 2017 17:34:53 -0400 Subject: add token support for instance fields, expand unit test (#296) --- src/StardewModdingAPI/Translation.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/StardewModdingAPI') 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(); } } -- cgit