357 lines
9.8 KiB
C#
357 lines
9.8 KiB
C#
using System;
|
|
using System.Globalization;
|
|
using System.Runtime.Serialization;
|
|
using System.Security;
|
|
|
|
namespace System.Reflection
|
|
{
|
|
// Token: 0x0200025E RID: 606
|
|
[Serializable]
|
|
internal class MonoProperty : PropertyInfo, ISerializable
|
|
{
|
|
// Token: 0x06001F76 RID: 8054 RVA: 0x000738CC File Offset: 0x00071ACC
|
|
private void CachePropertyInfo(PInfo flags)
|
|
{
|
|
if ((this.cached & flags) != flags)
|
|
{
|
|
MonoPropertyInfo.get_property_info(this, ref this.info, flags);
|
|
this.cached |= flags;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005D5 RID: 1493
|
|
// (get) Token: 0x06001F77 RID: 8055 RVA: 0x000738F8 File Offset: 0x00071AF8
|
|
public override PropertyAttributes Attributes
|
|
{
|
|
get
|
|
{
|
|
this.CachePropertyInfo(PInfo.Attributes);
|
|
return this.info.attrs;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005D6 RID: 1494
|
|
// (get) Token: 0x06001F78 RID: 8056 RVA: 0x0007390C File Offset: 0x00071B0C
|
|
public override bool CanRead
|
|
{
|
|
get
|
|
{
|
|
this.CachePropertyInfo(PInfo.GetMethod);
|
|
return this.info.get_method != null;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005D7 RID: 1495
|
|
// (get) Token: 0x06001F79 RID: 8057 RVA: 0x00073928 File Offset: 0x00071B28
|
|
public override bool CanWrite
|
|
{
|
|
get
|
|
{
|
|
this.CachePropertyInfo(PInfo.SetMethod);
|
|
return this.info.set_method != null;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005D8 RID: 1496
|
|
// (get) Token: 0x06001F7A RID: 8058 RVA: 0x00073944 File Offset: 0x00071B44
|
|
public override Type PropertyType
|
|
{
|
|
get
|
|
{
|
|
this.CachePropertyInfo(PInfo.GetMethod | PInfo.SetMethod);
|
|
if (this.info.get_method != null)
|
|
{
|
|
return this.info.get_method.ReturnType;
|
|
}
|
|
ParameterInfo[] parameters = this.info.set_method.GetParameters();
|
|
return parameters[parameters.Length - 1].ParameterType;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005D9 RID: 1497
|
|
// (get) Token: 0x06001F7B RID: 8059 RVA: 0x00073998 File Offset: 0x00071B98
|
|
public override Type ReflectedType
|
|
{
|
|
get
|
|
{
|
|
this.CachePropertyInfo(PInfo.ReflectedType);
|
|
return this.info.parent;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005DA RID: 1498
|
|
// (get) Token: 0x06001F7C RID: 8060 RVA: 0x000739AC File Offset: 0x00071BAC
|
|
public override Type DeclaringType
|
|
{
|
|
get
|
|
{
|
|
this.CachePropertyInfo(PInfo.DeclaringType);
|
|
return this.info.parent;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005DB RID: 1499
|
|
// (get) Token: 0x06001F7D RID: 8061 RVA: 0x000739C4 File Offset: 0x00071BC4
|
|
public override string Name
|
|
{
|
|
get
|
|
{
|
|
this.CachePropertyInfo(PInfo.Name);
|
|
return this.info.name;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001F7E RID: 8062 RVA: 0x000739DC File Offset: 0x00071BDC
|
|
public override MethodInfo[] GetAccessors(bool nonPublic)
|
|
{
|
|
int num = 0;
|
|
int num2 = 0;
|
|
this.CachePropertyInfo(PInfo.GetMethod | PInfo.SetMethod);
|
|
if (this.info.set_method != null && (nonPublic || this.info.set_method.IsPublic))
|
|
{
|
|
num2 = 1;
|
|
}
|
|
if (this.info.get_method != null && (nonPublic || this.info.get_method.IsPublic))
|
|
{
|
|
num = 1;
|
|
}
|
|
MethodInfo[] array = new MethodInfo[num + num2];
|
|
int num3 = 0;
|
|
if (num2 != 0)
|
|
{
|
|
array[num3++] = this.info.set_method;
|
|
}
|
|
if (num != 0)
|
|
{
|
|
array[num3++] = this.info.get_method;
|
|
}
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06001F7F RID: 8063 RVA: 0x00073A8C File Offset: 0x00071C8C
|
|
public override MethodInfo GetGetMethod(bool nonPublic)
|
|
{
|
|
this.CachePropertyInfo(PInfo.GetMethod);
|
|
if (this.info.get_method != null && (nonPublic || this.info.get_method.IsPublic))
|
|
{
|
|
return this.info.get_method;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// Token: 0x06001F80 RID: 8064 RVA: 0x00073AD8 File Offset: 0x00071CD8
|
|
public override ParameterInfo[] GetIndexParameters()
|
|
{
|
|
this.CachePropertyInfo(PInfo.GetMethod | PInfo.SetMethod);
|
|
ParameterInfo[] array;
|
|
if (this.info.get_method != null)
|
|
{
|
|
array = this.info.get_method.GetParameters();
|
|
}
|
|
else
|
|
{
|
|
if (this.info.set_method == null)
|
|
{
|
|
return new ParameterInfo[0];
|
|
}
|
|
ParameterInfo[] parameters = this.info.set_method.GetParameters();
|
|
array = new ParameterInfo[parameters.Length - 1];
|
|
Array.Copy(parameters, array, array.Length);
|
|
}
|
|
for (int i = 0; i < array.Length; i++)
|
|
{
|
|
ParameterInfo parameterInfo = array[i];
|
|
array[i] = new ParameterInfo(parameterInfo, this);
|
|
}
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06001F81 RID: 8065 RVA: 0x00073B78 File Offset: 0x00071D78
|
|
public override MethodInfo GetSetMethod(bool nonPublic)
|
|
{
|
|
this.CachePropertyInfo(PInfo.SetMethod);
|
|
if (this.info.set_method != null && (nonPublic || this.info.set_method.IsPublic))
|
|
{
|
|
return this.info.set_method;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// Token: 0x06001F82 RID: 8066 RVA: 0x00073BC4 File Offset: 0x00071DC4
|
|
public override bool IsDefined(Type attributeType, bool inherit)
|
|
{
|
|
return MonoCustomAttrs.IsDefined(this, attributeType, false);
|
|
}
|
|
|
|
// Token: 0x06001F83 RID: 8067 RVA: 0x00073BD0 File Offset: 0x00071DD0
|
|
public override object[] GetCustomAttributes(bool inherit)
|
|
{
|
|
return MonoCustomAttrs.GetCustomAttributes(this, false);
|
|
}
|
|
|
|
// Token: 0x06001F84 RID: 8068 RVA: 0x00073BDC File Offset: 0x00071DDC
|
|
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
|
|
{
|
|
return MonoCustomAttrs.GetCustomAttributes(this, attributeType, false);
|
|
}
|
|
|
|
// Token: 0x06001F85 RID: 8069 RVA: 0x00073BE8 File Offset: 0x00071DE8
|
|
private static object GetterAdapterFrame<T, R>(MonoProperty.Getter<T, R> getter, object obj)
|
|
{
|
|
return getter((T)((object)obj));
|
|
}
|
|
|
|
// Token: 0x06001F86 RID: 8070 RVA: 0x00073BFC File Offset: 0x00071DFC
|
|
private static object StaticGetterAdapterFrame<R>(MonoProperty.StaticGetter<R> getter, object obj)
|
|
{
|
|
return getter();
|
|
}
|
|
|
|
// Token: 0x06001F87 RID: 8071 RVA: 0x00073C0C File Offset: 0x00071E0C
|
|
private static MonoProperty.GetterAdapter CreateGetterDelegate(MethodInfo method)
|
|
{
|
|
Type[] array;
|
|
Type type;
|
|
string text;
|
|
if (method.IsStatic)
|
|
{
|
|
array = new Type[] { method.ReturnType };
|
|
type = typeof(MonoProperty.StaticGetter<>);
|
|
text = "StaticGetterAdapterFrame";
|
|
}
|
|
else
|
|
{
|
|
array = new Type[] { method.DeclaringType, method.ReturnType };
|
|
type = typeof(MonoProperty.Getter<, >);
|
|
text = "GetterAdapterFrame";
|
|
}
|
|
Type type2 = type.MakeGenericType(array);
|
|
object obj = Delegate.CreateDelegate(type2, method, false);
|
|
if (obj == null)
|
|
{
|
|
throw new MethodAccessException();
|
|
}
|
|
MethodInfo methodInfo = typeof(MonoProperty).GetMethod(text, BindingFlags.Static | BindingFlags.NonPublic);
|
|
methodInfo = methodInfo.MakeGenericMethod(array);
|
|
return (MonoProperty.GetterAdapter)Delegate.CreateDelegate(typeof(MonoProperty.GetterAdapter), obj, methodInfo, true);
|
|
}
|
|
|
|
// Token: 0x06001F88 RID: 8072 RVA: 0x00073CCC File Offset: 0x00071ECC
|
|
public override object GetValue(object obj, object[] index)
|
|
{
|
|
return this.GetValue(obj, BindingFlags.Default, null, index, null);
|
|
}
|
|
|
|
// Token: 0x06001F89 RID: 8073 RVA: 0x00073CDC File Offset: 0x00071EDC
|
|
public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
|
|
{
|
|
object obj2 = null;
|
|
MethodInfo getMethod = this.GetGetMethod(true);
|
|
if (getMethod == null)
|
|
{
|
|
throw new ArgumentException("Get Method not found for '" + this.Name + "'");
|
|
}
|
|
try
|
|
{
|
|
if (index == null || index.Length == 0)
|
|
{
|
|
obj2 = getMethod.Invoke(obj, invokeAttr, binder, null, culture);
|
|
}
|
|
else
|
|
{
|
|
obj2 = getMethod.Invoke(obj, invokeAttr, binder, index, culture);
|
|
}
|
|
}
|
|
catch (SecurityException ex)
|
|
{
|
|
throw new TargetInvocationException(ex);
|
|
}
|
|
return obj2;
|
|
}
|
|
|
|
// Token: 0x06001F8A RID: 8074 RVA: 0x00073D74 File Offset: 0x00071F74
|
|
public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
|
|
{
|
|
MethodInfo setMethod = this.GetSetMethod(true);
|
|
if (setMethod == null)
|
|
{
|
|
throw new ArgumentException("Set Method not found for '" + this.Name + "'");
|
|
}
|
|
object[] array;
|
|
if (index == null || index.Length == 0)
|
|
{
|
|
array = new object[] { value };
|
|
}
|
|
else
|
|
{
|
|
int num = index.Length;
|
|
array = new object[num + 1];
|
|
index.CopyTo(array, 0);
|
|
array[num] = value;
|
|
}
|
|
setMethod.Invoke(obj, invokeAttr, binder, array, culture);
|
|
}
|
|
|
|
// Token: 0x06001F8B RID: 8075 RVA: 0x00073DF4 File Offset: 0x00071FF4
|
|
public override string ToString()
|
|
{
|
|
return this.PropertyType.ToString() + " " + this.Name;
|
|
}
|
|
|
|
// Token: 0x06001F8C RID: 8076 RVA: 0x00073E1C File Offset: 0x0007201C
|
|
public override Type[] GetOptionalCustomModifiers()
|
|
{
|
|
Type[] typeModifiers = MonoPropertyInfo.GetTypeModifiers(this, true);
|
|
if (typeModifiers == null)
|
|
{
|
|
return Type.EmptyTypes;
|
|
}
|
|
return typeModifiers;
|
|
}
|
|
|
|
// Token: 0x06001F8D RID: 8077 RVA: 0x00073E40 File Offset: 0x00072040
|
|
public override Type[] GetRequiredCustomModifiers()
|
|
{
|
|
Type[] typeModifiers = MonoPropertyInfo.GetTypeModifiers(this, false);
|
|
if (typeModifiers == null)
|
|
{
|
|
return Type.EmptyTypes;
|
|
}
|
|
return typeModifiers;
|
|
}
|
|
|
|
// Token: 0x06001F8E RID: 8078 RVA: 0x00073E64 File Offset: 0x00072064
|
|
public void GetObjectData(SerializationInfo info, StreamingContext context)
|
|
{
|
|
MemberInfoSerializationHolder.Serialize(info, this.Name, this.ReflectedType, this.ToString(), MemberTypes.Property);
|
|
}
|
|
|
|
// Token: 0x04000AE0 RID: 2784
|
|
internal IntPtr klass;
|
|
|
|
// Token: 0x04000AE1 RID: 2785
|
|
internal IntPtr prop;
|
|
|
|
// Token: 0x04000AE2 RID: 2786
|
|
private MonoPropertyInfo info;
|
|
|
|
// Token: 0x04000AE3 RID: 2787
|
|
private PInfo cached;
|
|
|
|
// Token: 0x04000AE4 RID: 2788
|
|
private MonoProperty.GetterAdapter cached_getter;
|
|
|
|
// Token: 0x020006CC RID: 1740
|
|
// (Invoke) Token: 0x060041B8 RID: 16824
|
|
private delegate object GetterAdapter(object _this);
|
|
|
|
// Token: 0x020006CD RID: 1741
|
|
// (Invoke) Token: 0x060041BC RID: 16828
|
|
private delegate R Getter<T, R>(T _this);
|
|
|
|
// Token: 0x020006CE RID: 1742
|
|
// (Invoke) Token: 0x060041C0 RID: 16832
|
|
private delegate R StaticGetter<R>();
|
|
}
|
|
}
|