Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RuntimePropertyInfo.cs
Go to the documentation of this file.
4using System.Text;
5
6namespace System.Reflection;
7
8internal sealed class RuntimePropertyInfo : PropertyInfo
9{
10 private int m_token;
11
12 private string m_name;
13
14 private unsafe void* m_utf8name;
15
17
19
21
23
25
27
29
31
33
34 internal unsafe Signature Signature
35 {
36 get
37 {
38 if (m_signature == null)
39 {
41 m_signature = new Signature(signature.Signature.ToPointer(), signature.Length, m_declaringType);
42 }
43 return m_signature;
44 }
45 }
46
48
49 public override MemberTypes MemberType => MemberTypes.Property;
50
51 public unsafe override string Name => m_name ?? (m_name = new MdUtf8String(m_utf8name).ToString());
52
54
56
58
59 public override int MetadataToken => m_token;
60
61 public override Module Module => GetRuntimeModule();
62
64
66
68
69 public override bool CanRead => m_getterMethod != null;
70
71 public override bool CanWrite => m_setterMethod != null;
72
82
83 internal override bool CacheEquals(object o)
84 {
86 {
88 }
89 return false;
90 }
91
92 internal bool EqualsSig(RuntimePropertyInfo target)
93 {
95 }
96
97 public override string ToString()
98 {
100 sbParamList.Append(PropertyType.FormatTypeName());
101 sbParamList.Append(' ');
102 sbParamList.Append(Name);
104 if (arguments.Length != 0)
105 {
106 sbParamList.Append(" [");
109 sbParamList.Append(']');
110 }
111 return sbParamList.ToString();
112 }
113
114 public override object[] GetCustomAttributes(bool inherit)
115 {
117 }
118
119 public override object[] GetCustomAttributes(Type attributeType, bool inherit)
120 {
121 if (attributeType == null)
122 {
123 throw new ArgumentNullException("attributeType");
124 }
125 RuntimeType runtimeType = attributeType.UnderlyingSystemType as RuntimeType;
126 if (runtimeType == null)
127 {
128 throw new ArgumentException(SR.Arg_MustBeType, "attributeType");
129 }
131 }
132
133 public override bool IsDefined(Type attributeType, bool inherit)
134 {
135 if (attributeType == null)
136 {
137 throw new ArgumentNullException("attributeType");
138 }
139 RuntimeType runtimeType = attributeType.UnderlyingSystemType as RuntimeType;
140 if (runtimeType == null)
141 {
142 throw new ArgumentException(SR.Arg_MustBeType, "attributeType");
143 }
145 }
146
151
156
161
163 {
164 return Signature.GetCustomModifiers(0, required: true);
165 }
166
168 {
169 return Signature.GetCustomModifiers(0, required: false);
170 }
171
172 internal object GetConstantValue(bool raw)
173 {
174 object value = MdConstant.GetValue(GetRuntimeModule().MetadataImport, m_token, PropertyType.GetTypeHandleInternal(), raw);
175 if (value == DBNull.Value)
176 {
178 }
179 return value;
180 }
181
182 public override object GetConstantValue()
183 {
184 return GetConstantValue(raw: false);
185 }
186
187 public override object GetRawConstantValue()
188 {
189 return GetConstantValue(raw: true);
190 }
191
192 public override MethodInfo[] GetAccessors(bool nonPublic)
193 {
196 {
197 list.Add(m_getterMethod);
198 }
200 {
201 list.Add(m_setterMethod);
202 }
203 if (m_otherMethod != null)
204 {
205 for (int i = 0; i < m_otherMethod.Length; i++)
206 {
208 {
209 list.Add(m_otherMethod[i]);
210 }
211 }
212 }
213 return list.ToArray();
214 }
215
217 {
219 {
220 return null;
221 }
222 return m_getterMethod;
223 }
224
226 {
228 {
229 return null;
230 }
231 return m_setterMethod;
232 }
233
235 {
237 int num = indexParametersNoCopy.Length;
238 if (num == 0)
239 {
241 }
242 ParameterInfo[] array = new ParameterInfo[num];
244 return array;
245 }
246
248 {
249 if (m_parameters == null)
250 {
251 int num = 0;
252 ParameterInfo[] array = null;
254 if (getMethod != null)
255 {
256 array = getMethod.GetParametersNoCopy();
257 num = array.Length;
258 }
259 else
260 {
262 if (getMethod != null)
263 {
264 array = getMethod.GetParametersNoCopy();
265 num = array.Length - 1;
266 }
267 }
268 ParameterInfo[] array2 = ((num != 0) ? new ParameterInfo[num] : Array.Empty<ParameterInfo>());
269 for (int i = 0; i < array2.Length; i++)
270 {
272 }
274 }
275 return m_parameters;
276 }
277
279 [DebuggerHidden]
280 public override object GetValue(object obj, object[] index)
281 {
282 return GetValue(obj, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, index, null);
283 }
284
286 [DebuggerHidden]
287 public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
288 {
290 if (getMethod == null)
291 {
293 }
294 return getMethod.Invoke(obj, invokeAttr, binder, index, null);
295 }
296
298 [DebuggerHidden]
299 public override void SetValue(object obj, object value, object[] index)
300 {
301 SetValue(obj, value, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, index, null);
302 }
303
305 [DebuggerHidden]
306 public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
307 {
309 if (setMethod == null)
310 {
312 }
313 if (index == null)
314 {
315 setMethod.InvokeOneParameter(obj, invokeAttr, binder, value, culture);
316 return;
317 }
318 object[] array = new object[index.Length + 1];
319 for (int i = 0; i < index.Length; i++)
320 {
321 array[i] = index[i];
322 }
323 array[index.Length] = value;
325 }
326}
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624
static readonly DBNull Value
Definition DBNull.cs:8
static RuntimeMethodInfo AssignAssociates(int tkMethod, RuntimeType declaredType, RuntimeType reflectedType)
Definition Associates.cs:35
static bool IncludeAccessor(MethodInfo associate, bool nonPublic)
Definition Associates.cs:17
static object[] GetCustomAttributes(RuntimeType type, RuntimeType caType, bool inherit)
static bool IsDefined(RuntimeType type, RuntimeType caType, bool inherit)
static unsafe object GetValue(MetadataImport scope, int token, RuntimeTypeHandle fieldTypeHandle, bool raw)
Definition MdConstant.cs:5
static void AppendParameters(ref ValueStringBuilder sbParamList, Type[] parameterTypes, CallingConventions callingConvention)
static IList< CustomAttributeData > GetCustomAttributesInternal(RuntimeType target)
override MethodInfo[] GetAccessors(bool nonPublic)
override bool IsDefined(Type attributeType, bool inherit)
override object GetValue(object obj, object[] index)
override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
override ParameterInfo[] GetIndexParameters()
override IList< CustomAttributeData > GetCustomAttributesData()
override void SetValue(object obj, object value, object[] index)
override RuntimeMethodInfo GetSetMethod(bool nonPublic)
override PropertyAttributes Attributes
override bool HasSameMetadataDefinitionAs(MemberInfo other)
override RuntimeMethodInfo GetGetMethod(bool nonPublic)
override object[] GetCustomAttributes(Type attributeType, bool inherit)
RuntimeType.RuntimeTypeCache m_reflectedTypeCache
unsafe RuntimePropertyInfo(int tkProperty, RuntimeType declaredType, RuntimeType.RuntimeTypeCache reflectedTypeCache, out bool isPrivate)
override object[] GetCustomAttributes(bool inherit)
override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
bool EqualsSig(RuntimePropertyInfo target)
override bool IsCollectible
RuntimeModule GetRuntimeModule()
static string Arg_SetMethNotFnd
Definition SR.cs:408
static string Arg_EnumLitValueNotFound
Definition SR.cs:146
static string Arg_MustBeType
Definition SR.cs:302
static string Arg_GetMethNotFnd
Definition SR.cs:176
Definition SR.cs:7
static bool CompareSig(Signature sig1, Signature sig2)
RuntimeType ReturnType
Definition Signature.cs:31
RuntimeType[] Arguments
Definition Signature.cs:29
Type[] GetCustomModifiers(int position, bool required)
CallingConventions CallingConvention
Definition Signature.cs:27
unsafe override string ToString()
unsafe void GetPropertyProps(int mdToken, out void *name, out PropertyAttributes propertyAttributes, out ConstArray signature)
static RuntimeModule GetModule(RuntimeType type)