示例#1
0
        public static string Command(this MediaFormat value)
        {
            FieldInfo        field = value.GetType().GetField(value.ToString());
            CommandAttribute attribute
                = Attribute.GetCustomAttribute(field, typeof(CommandAttribute))
                  as CommandAttribute;

            return(attribute == null?value.ToString() : attribute.Command);
        }
示例#2
0
        public static string LongName(this MediaFormat value)
        {
            FieldInfo         field = value.GetType().GetField(value.ToString());
            LongNameAttribute attribute
                = Attribute.GetCustomAttribute(field, typeof(LongNameAttribute))
                  as LongNameAttribute;

            return(attribute == null?value.ToString() : attribute.LongName);
        }
示例#3
0
        public static bool IsAudioFormat(this MediaFormat value)
        {
            FieldInfo field = value.GetType().GetField(value.ToString());

            return(Attribute.GetCustomAttribute(field, typeof(AudioFormatAttribute)) != null);
        }