public static string GetMessageName(this Type type) { string messageName = null; if (type.HasAttribute<ClientMessageAttribute>()) { messageName = type.GetAttribute<ClientMessageAttribute>().MessageName; } if (type.CanBeCastTo<ClientMessage>()) { messageName = Activator.CreateInstance(type).As<ClientMessage>().MessageName(); } return messageName.IsEmpty() ? type.GetDefaultMessageName() : messageName; }
public static bool IsAuthenticatedAPIRequest(this Type type) { return type.CanBeCastTo<IApi>(); }
public static bool IsClientMessage(this Type type) { if (type == null) return false; return type.HasAttribute<ClientMessageAttribute>() || type.CanBeCastTo<ClientMessage>(); }