示例#1
0
        public static string GetBaseType(Type actorType)
        {
            ActorAttribute actorAttribute = Attribute.GetCustomAttribute(actorType, typeof(ActorAttribute), false) as ActorAttribute;

            if (actorAttribute != null)
            {
                if (actorAttribute.BaseName != string.Empty)
                {
                    return(actorAttribute.BaseName);
                }
            }

            Type realBaseType = actorType.BaseType;

            if (realBaseType != null)
            {
                if (realBaseType.GetInterface(typeof(IActor).FullName) != null)
                {
                    if (!realBaseType.IsAbstract)
                    {
                        return(Utility.GetTypeName(realBaseType));
                    }
                }
            }
            return(string.Empty);
        }
示例#2
0
        public static string GetTypeName(Type actorType)
        {
            ActorAttribute actorAttribute = Attribute.GetCustomAttribute(actorType, typeof(ActorAttribute), false) as ActorAttribute;

            if (actorAttribute != null)
            {
                return(actorAttribute.Name);
            }
            else
            {
                return(actorType.Name);
            }
        }