public InstanceProperty GetInstanceProperty(string name) { InstanceProperty property = null; if (!mInstanceProperties.TryGetValue(name, out property)) { if (null != this.ParentClass) { property = this.ParentClass.GetInstanceProperty(name); } } return(property); }
static protected void SetInstanceProperty(IntPtr caller, IntPtr handle, string name, IntPtr value) { try { object target = Entry.Object.GetInstance(caller); if (null == target) { return; } InstanceProperty property = Class.getInstanceProperty(target, handle, name); property?.SetValue(target, value); } catch { } }
static protected IntPtr GetInstanceProperty(IntPtr caller, IntPtr handle, string name) { try { object target = Entry.Object.GetInstance(caller); if (null == target) { return(IntPtr.Zero); } InstanceProperty property = Class.getInstanceProperty(target, handle, name); return(property?.GetValue(target) ?? IntPtr.Zero); } catch { return(IntPtr.Zero); } }
static private InstanceProperty getInstanceProperty(object target, IntPtr handle, string name) { Type type = target.GetType(); Class c = Class.FindClass(type.GetSafeFullName()); if (null == c) { Entry.LogWarning("No class registered with name {0}", type.FullName); return(null); } InstanceProperty property = Base.FindInstance <InstanceProperty>(handle); if (null == property) { property = c.GetInstanceProperty(name); } if (null == property) { Entry.LogWarning("No property registered in {0} with name {1}", type.FullName, name); return(null); } return(property); }