Example #1
0
 private static void SetValue19(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle obj, global::net.sf.jni4net.utils.JniLocalHandle value)
 {
     // (Lsystem/Object;Lsystem/Object;)V
     // (LSystem/Object;LSystem/Object;)V
     global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
     try {
         global::System.Reflection.PropertyInfo @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C <global::System.Reflection.PropertyInfo>(@__env, @__obj);
         @__real.SetValue(global::net.sf.jni4net.utils.Convertor.FullJ2C <object>(@__env, obj), global::net.sf.jni4net.utils.Convertor.FullJ2C <object>(@__env, value));
     }catch (global::System.Exception __ex) { @__env.ThrowExisting(__ex); }
 }
Example #2
0
        // Token: 0x060005D8 RID: 1496 RVA: 0x0001CA9C File Offset: 0x0001AC9C
        public static void SetPropertyOrField <T>(T obj, string name, object value)
        {
            global::System.Reflection.PropertyInfo property = typeof(T).GetProperty(name, 52);
            global::System.Reflection.FieldInfo    field    = typeof(T).GetField(name, 52);
            bool flag = property != null;

            if (flag)
            {
                property.SetValue(obj, value, null);
            }
            else
            {
                bool flag2 = field != null;
                if (flag2)
                {
                    field.SetValue(obj, value);
                }
                else
                {
                    global::VRGIN.Core.VRLog.Warn("Prop/Field not found!", global::System.Array.Empty <object>());
                }
            }
        }
Example #3
0
        public static object slowSetField(object obj, string field, object @value)
        {
            if ((obj == null))
            {
                throw new global::System.NullReferenceException(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("Cannot access field \'", field), "\' of null."));
            }

            global::System.Type t = ((global::System.Type)((obj as global::System.Type)));
            global::System.Reflection.BindingFlags bf = default(global::System.Reflection.BindingFlags);
            if ((t == null))
            {
                t  = ((global::System.Type)(obj.GetType()));
                bf = ((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Instance)) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Public))))) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.FlattenHierarchy)))));
            }
            else
            {
                obj = null;
                bf  = ((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Static)) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Public)))));
            }

            global::System.Reflection.FieldInfo f = t.GetField(((string)(field)), ((global::System.Reflection.BindingFlags)(bf)));
            if ((f != null))
            {
                if ((f.FieldType as global::System.Reflection.MemberInfo).ToString().StartsWith("haxe.lang.Null"))
                {
                    @value = global::haxe.lang.Runtime.mkNullable(@value, f.FieldType);
                }

                if ((((@value != null) && global::System.Object.ReferenceEquals(((global::System.Type)(typeof(global::System.Double))), ((object)(@value.GetType())))) && !(global::System.Object.ReferenceEquals(((object)(t)), ((object)(f.FieldType))))))
                {
                    @value = ((global::System.IConvertible)((@value as global::System.IConvertible))).ToType(((global::System.Type)(f.FieldType)), default(global::System.IFormatProvider));
                }

                f.SetValue(((object)(obj)), ((object)(@value)));
                return(@value);
            }
            else
            {
                global::System.Reflection.PropertyInfo prop = t.GetProperty(((string)(field)), ((global::System.Reflection.BindingFlags)(bf)));
                if ((prop == null))
                {
                    if (t.IsCOMObject)
                    {
                        try {
                            return(t.InvokeMember(((string)(field)), ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.SetProperty)), default(global::System.Reflection.Binder), ((object)(obj)), ((object[])(new object[] { ((object)(@value)) }))));
                        }
                        catch (global::System.Exception e) {
                            global::haxe.lang.Exceptions.exception = e;
                        }
                    }

                    throw global::haxe.lang.HaxeException.wrap(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("Field \'", field), "\' not found for writing from Class "), global::Std.@string(t)));
                }

                if ((prop.PropertyType as global::System.Reflection.MemberInfo).ToString().StartsWith("haxe.lang.Null"))
                {
                    @value = global::haxe.lang.Runtime.mkNullable(@value, prop.PropertyType);
                }

                if ((global::System.Object.ReferenceEquals(((global::System.Type)(typeof(global::System.Double))), ((object)(@value.GetType()))) && !(global::System.Object.ReferenceEquals(((object)(t)), ((object)(f.FieldType))))))
                {
                    @value = ((global::System.IConvertible)((@value as global::System.IConvertible))).ToType(((global::System.Type)(f.FieldType)), default(global::System.IFormatProvider));
                }

                prop.SetValue(((object)(obj)), ((object)(@value)), default(object[]));
                return(@value);
            }
        }