Ejemplo n.º 1
0
        public ComponentInspector(ECComponent component)
        {
            _component  = component;
            _inspectors = TypeInspectorUtils.GetInspectableProperties(component);

            if (_component.GetType().IsGenericType)
            {
                var genericType = _component.GetType().GetGenericArguments()[0].Name;
                _name = $"{_component.GetType().BaseType.Name}<{genericType}>";
            }
            else
            {
                _name = _component.GetType().Name;
            }

            var methods = TypeInspectorUtils.GetAllMethodsWithAttribute <InspectorDelegateAttribute>(_component.GetType());

            foreach (var method in methods)
            {
                // only allow zero param methods
                if (method.GetParameters().Length == 0)
                {
                    _componentDelegateMethods.Add((Action)Delegate.CreateDelegate(typeof(Action), _component, method));
                }
            }
        }