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); }
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); }
public static bool IsAudioFormat(this MediaFormat value) { FieldInfo field = value.GetType().GetField(value.ToString()); return(Attribute.GetCustomAttribute(field, typeof(AudioFormatAttribute)) != null); }