Пример #1
0
        private static string GetSignals(Type componentType)
        {
            var memberNames = CoreReflector.GetFieldAndPropertyNames(componentType);
            //memberNames.Sort(MemberInfoSort);
            List <MemberInfo> infos = new List <MemberInfo>();

            foreach (var name in memberNames)
            {
                MemberWrapper mw = new MemberWrapper(componentType, name);
                if (mw.MemberType == typeof(Signal))
                {
                    infos.Add(mw.MemberInfo);
                }
            }

            infos.Sort(MemberInfoSort);

            StringBuilder sb = new StringBuilder();

            foreach (var memberInfo in infos)
            {
                sb.AppendLine(memberInfo.Name);
            }

            return(string.Format(@"Signals ({0}):
{1}
{2}", infos.Count, Line, sb) + NewLine /* + NewLine*/);
        }
Пример #2
0
        /// <summary>
        /// Describes mulricast delegates
        /// </summary>
        /// <param name="componentType"></param>
        /// <returns></returns>
        public static string GetMulticastDelegates(Type componentType)
        {
            var memberNames = CoreReflector.GetFieldAndPropertyNames(componentType);
            //memberNames.Sort(MemberInfoSort);
            List <string> data = new List <string>();

            foreach (var name in memberNames)
            {
                MemberWrapper mw = new MemberWrapper(componentType, name);
                if (mw.MemberType == typeof(Core.Events.MulticastDelegate))
                {
                    var output = mw.MemberInfo.Name;

                    /*var clazz = mw.MemberInfo.DeclaringType;
                     * if (null != clazz)
                     * {
                     *  var types =
                     *
                     *
                     *  var instance = Activator.CreateInstance(clazz);
                     *  var value = mw.GetValue(instance);
                     *  if (null != value)
                     *      output = string.Format(@"{0} [{1}]", output, value.GetType().FullName);
                     * }*/

                    var attributes = CoreReflector.GetMemberAttributes <EventAttribute>(mw.MemberInfo);
                    if (attributes.Count > 0)
                    {
                        var eventAttribute = attributes[0];
                        output = string.Format(@"{0} → {1}", output, eventAttribute);
                    }

                    data.Add(output);
                }
            }

            data.Sort();

            StringBuilder sb = new StringBuilder();

            foreach (var item in data)
            {
                sb.AppendLine(item);
            }

            return(string.Format(@"Multicast delegates ({0}):
{1}
{2}", data.Count, Line, sb) + NewLine /* + NewLine*/);
        }