Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ FormatWith()

string Terraria.Localization.LocalizedText.FormatWith ( object obj)
inline

Definition at line 27 of file LocalizedText.cs.

28 {
29 string value = Value;
31 return _substitutionRegex.Replace(value, delegate(Match match)
32 {
33 if (match.Groups[1].Length != 0)
34 {
35 return "";
36 }
37 string name = match.Groups[2].ToString();
38 PropertyDescriptor propertyDescriptor = properties.Find(name, ignoreCase: false);
39 return (propertyDescriptor == null) ? "" : (propertyDescriptor.GetValue(obj) ?? "").ToString();
40 });
41 }
virtual ? PropertyDescriptor Find(string name, bool ignoreCase)
object? GetValue(object? component)
static PropertyDescriptorCollection GetProperties([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)

References Terraria.Localization.LocalizedText._substitutionRegex, System.ComponentModel.PropertyDescriptorCollection.Find(), System.ComponentModel.TypeDescriptor.GetProperties(), System.ComponentModel.PropertyDescriptor.GetValue(), System.Text.RegularExpressions.name, Terraria.Localization.LocalizedText.ToString(), System.Text.RegularExpressions.value, and Terraria.Localization.LocalizedText.Value.

Referenced by Terraria.GameContent.UI.GameTipsDisplay.GameTip.GameTip().