本文整理汇总了C#中Tag.AddTrackCount方法的典型用法代码示例。如果您正苦于以下问题:C# Tag.AddTrackCount方法的具体用法?C# Tag.AddTrackCount怎么用?C# Tag.AddTrackCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag.AddTrackCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CombineTags
public static Tag CombineTags(params Tag [] tags)
{
Tag ret = new Tag();
foreach(Tag tag in tags) {
if(tag == null) {
continue;
}
foreach(TagTextField artist in tag.Artist) {
ret.AddArtist (artist.Content);
}
foreach(TagTextField album in tag.Album) {
ret.AddAlbum(album.Content);
}
foreach(TagTextField title in tag.Title) {
ret.AddTitle(title.Content);
}
foreach(TagTextField track in tag.Track) {
ret.AddTrack(track.Content);
}
foreach(TagTextField trackcount in tag.TrackCount) {
ret.AddTrackCount(trackcount.Content);
}
foreach(TagTextField year in tag.Year) {
ret.AddYear(year.Content);
}
foreach(TagTextField comment in tag.Comment) {
ret.AddComment(comment.Content);
}
foreach(TagTextField license in tag.License) {
ret.AddLicense(license.Content);
}
foreach(TagTextField genre in tag.Genre) {
ret.AddGenre(genre.Content);
}
}
return ret;
}
示例2: Read
public Tag Read(Stream apeStream)
{
Tag tag = new Tag();
//Check wether the file contains an APE tag--------------------------------
apeStream.Seek( apeStream.Length - 32 , SeekOrigin.Begin);
byte[] b = new byte[8];
apeStream.Read(b, 0, b.Length);
string tagS = new string( System.Text.Encoding.ASCII.GetChars(b) );
if(tagS != "APETAGEX" ){
throw new CannotReadException("There is no APE Tag in this file");
}
//Parse the tag -)------------------------------------------------
//Version
b = new byte[4];
apeStream.Read( b , 0, b .Length);
int version = Utils.GetNumber(b, 0,3);
if(version != 2000) {
throw new CannotReadException("APE Tag other than version 2.0 are not supported");
}
//Size
b = new byte[4];
apeStream.Read( b , 0, b .Length);
long tagSize = Utils.GetLongNumber(b, 0,3);
//Number of items
b = new byte[4];
apeStream.Read( b , 0, b .Length);
int itemNumber = Utils.GetNumber(b, 0,3);
//Tag Flags
b = new byte[4];
apeStream.Read( b , 0, b .Length);
//TODO handle these
apeStream.Seek(apeStream.Length - tagSize, SeekOrigin.Begin);
for(int i = 0; i<itemNumber; i++) {
//Content length
b = new byte[4];
apeStream.Read( b , 0, b .Length);
int contentLength = Utils.GetNumber(b, 0,3);
if(contentLength > 500000)
throw new CannotReadException("Item size is much too large: "+contentLength+" bytes");
//Item flags
b = new byte[4];
apeStream.Read( b , 0, b .Length);
//TODO handle these
bool binary = ((b[0]&0x06) >> 1) == 1;
int j = 0;
while(apeStream.ReadByte() != 0)
j++;
apeStream.Seek(apeStream.Position - j -1, SeekOrigin.Begin);
int fieldSize = j;
//Read Item key
b = new byte[fieldSize];
apeStream.Read( b , 0, b .Length);
apeStream.Seek(1, SeekOrigin.Current);
string field = new string(System.Text.Encoding.GetEncoding("ISO-8859-1").GetChars(b));
//Read Item content
b = new byte[contentLength];
apeStream.Read( b , 0, b .Length);
if(!binary) {
string content = Encoding.UTF8.GetString(b);
switch (field) {
case "Track":
string num, count;
Utils.SplitTrackNumber(content, out num, out count);
if (num != null)
tag.AddTrack(num);
if (count != null)
tag.AddTrackCount(count);
break;
default:
tag.Add(field, content);
break;
}
} //else FIXME
// tag.Add(new ApeTagBinaryField(field, b));
}
return tag;
}