本文整理汇总了C#中ITagService.GetTagInfo方法的典型用法代码示例。如果您正苦于以下问题:C# ITagService.GetTagInfo方法的具体用法?C# ITagService.GetTagInfo怎么用?C# ITagService.GetTagInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITagService
的用法示例。
在下文中一共展示了ITagService.GetTagInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTrack
public static Track GetTrack(int mintracklen, int maxtracklen, string filename, ITagService tagService)
{
TagInfo tags = tagService.GetTagInfo(filename); // get file tags
string artist, title;
double duration;
if (tags == null)
{
/*The song does not contain any tags*/
artist = "Unknown Artist";
title = "Unknown Title";
duration = new FileInfo(filename).Length;
}
else
{
/*The song contains related tags*/
artist = tags.Artist;
title = tags.Title;
duration = tags.Duration;
}
/*assign a name to music files that don't have tags*/
if (string.IsNullOrEmpty(artist))
{
artist = "Unknown Artist";
}
/*assign a title to music files that don't have tags*/
if (string.IsNullOrEmpty(title))
{
title = "Unknown Title";
}
/*check the duration of a music file*/
if (duration < mintracklen || duration > maxtracklen)
{
return null;
}
Track track = new Track(artist, title, Path.GetFullPath(filename), duration);
return track;
}