public static ILyricParser GetLyricParserInstance(LyricParserTypeEnum value) { FieldInfo fi = typeof(LyricParserTypeEnum).GetField(value.ToString()); LyricParserAttribute[] attributes = (LyricParserAttribute[])fi.GetCustomAttributes( typeof(LyricParserAttribute), false); return (attributes.Length > 0) ? attributes[0].LyricParser : null; }
public static string GetLyricParserExtension(LyricParserTypeEnum value) { FieldInfo fi = typeof(LyricParserTypeEnum).GetField(value.ToString()); LyricParserAttribute[] attributes = (LyricParserAttribute[])fi.GetCustomAttributes( typeof(LyricParserAttribute), false); return (attributes.Length > 0) ? attributes[0].Extension : string.Empty; }