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

◆ GetLocalizableValue()

string System.ComponentModel.DataAnnotations.LocalizableString.GetLocalizableValue ( )
inline

Definition at line 60 of file LocalizableString.cs.

61 {
62 if (_cachedResult == null)
63 {
64 if (_propertyValue == null || _resourceType == null)
65 {
67 }
68 else
69 {
70 PropertyInfo property = _resourceType.GetRuntimeProperty(_propertyValue);
71 bool flag = false;
72 if (!_resourceType.IsVisible || property == null || property.PropertyType != typeof(string))
73 {
74 flag = true;
75 }
76 else
77 {
78 MethodInfo getMethod = property.GetMethod;
79 if (getMethod == null || !getMethod.IsPublic || !getMethod.IsStatic)
80 {
81 flag = true;
82 }
83 }
84 if (flag)
85 {
87 _cachedResult = delegate
88 {
89 throw new InvalidOperationException(exceptionMessage);
90 };
91 }
92 else
93 {
94 _cachedResult = () => (string)property.GetValue(null, null);
95 }
96 }
97 }
98 return _cachedResult();
99 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string LocalizableString_LocalizationFailed
Definition SR.cs:56
Definition SR.cs:7
bool IsVisible
Definition Type.cs:364
string? FullName
Definition Type.cs:47

References System.ComponentModel.DataAnnotations.LocalizableString._cachedResult, System.ComponentModel.DataAnnotations.LocalizableString._propertyName, System.ComponentModel.DataAnnotations.LocalizableString._propertyValue, System.ComponentModel.DataAnnotations.LocalizableString._resourceType, System.SR.Format(), System.Type.FullName, System.Reflection.MethodBase.IsPublic, System.Reflection.MethodBase.IsStatic, System.Type.IsVisible, and System.SR.LocalizableString_LocalizationFailed.

Referenced by System.ComponentModel.DataAnnotations.DisplayAttribute.GetDescription(), System.ComponentModel.DataAnnotations.DisplayAttribute.GetGroupName(), System.ComponentModel.DataAnnotations.DisplayAttribute.GetName(), System.ComponentModel.DataAnnotations.DisplayFormatAttribute.GetNullDisplayText(), System.ComponentModel.DataAnnotations.DisplayAttribute.GetPrompt(), and System.ComponentModel.DataAnnotations.DisplayAttribute.GetShortName().