Beispiel #1
0
        public static void UnboxTypedRef(object box, TypedRefPtr typedRef)
        {
            TypedReferenceHelpers.UnboxTypedRef(box, typedRef, box.GetType());
            bool flag = box is IValueTypeBox;

            if (flag)
            {
                TypedReferenceHelpers.CastTypedRef(typedRef, ((IValueTypeBox)box).GetValueType());
            }
        }
Beispiel #2
0
        public unsafe static void GetFieldAddr(EmuContext context, object obj, FieldInfo field, TypedRefPtr typedRef)
        {
            object obj2 = TypedReferenceHelpers.fieldAddrHelpers[field];
            bool   flag = obj2 == null;

            if (flag)
            {
                Hashtable obj3 = TypedReferenceHelpers.fieldAddrHelpers;
                lock (obj3) {
                    obj2 = TypedReferenceHelpers.fieldAddrHelpers[field];
                    bool flag2 = obj2 == null;
                    if (flag2)
                    {
                        obj2 = TypedReferenceHelpers.BuildAddrHelper(field);
                        TypedReferenceHelpers.fieldAddrHelpers[field] = obj2;
                    }
                }
            }
            bool           flag3 = obj == null;
            TypedReference typedReference;

            if (flag3)
            {
                typedReference = default(TypedReference);
            }
            else
            {
                bool flag4 = obj is IReference;
                if (flag4)
                {
                    ((IReference)obj).ToTypedReference(context, (void *)(&typedReference), field.DeclaringType);
                }
                else
                {
                    typedReference = __makeref(obj);
                    TypedReferenceHelpers.CastTypedRef((void *)(&typedReference), obj.GetType());
                }
            }
            ((TypedReferenceHelpers.FieldAdr)obj2)((void *)(&typedReference), typedRef);
        } // Token: 0x0600019C RID: 412 RVA: 0x0000AD9C File Offset: 0x00008F9C