本文整理汇总了C#中ID3v2TagVersion类的典型用法代码示例。如果您正苦于以下问题:C# ID3v2TagVersion类的具体用法?C# ID3v2TagVersion怎么用?C# ID3v2TagVersion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ID3v2TagVersion类属于命名空间,在下文中一共展示了ID3v2TagVersion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBytes
public override byte[] GetBytes(ID3v2TagVersion tagVersion)
{
if (Items.Count == 0)
return new byte[0];
// Set TextEncoding to Unicode/UTF8 if required
if (TextEncoding == EncodingType.ISO88591)
{
foreach (ILanguageItem languageItem in Items)
{
byte[] languageCodeData = ID3v2Utils.GetStringBytes(tagVersion, TextEncoding, languageItem.LanguageCode, true);
this.RequiresFix(tagVersion, languageItem.LanguageCode, languageCodeData);
}
}
using (MemoryStream frameData = new MemoryStream())
{
frameData.WriteByte((byte)TextEncoding);
bool isTerminated = true; //(tagVersion == TagVersion.ID3v24);
for (int i = 0; i < Items.Count; i++)
{
ILanguageItem languageItem = Items[i];
if (i == Items.Count - 1)
isTerminated = false;
frameData.Write(ID3v2Utils.GetStringBytes(tagVersion, TextEncoding, languageItem.LanguageCode, isTerminated));
}
return _frameHeader.GetBytes(frameData, tagVersion, GetFrameID(tagVersion));
}
}
示例2: GetAllFrames
internal List<IFrame> GetAllFrames(ID3v2TagVersion tagVersion, string frameID)
{
if (string.IsNullOrEmpty(frameID))
throw new ArgumentNullException("frameID");
return GetAllFrames(tagVersion, new List<string> { frameID });
}
示例3: GetBytes
public byte[] GetBytes(ID3v2TagVersion tagVersion)
{
if ((this.m_PictureData == null) || (this.m_PictureData.Length == 0))
{
return new byte[0];
}
this.TextEncoding = EncodingType.ISO88591;
using (MemoryStream stream1 = new MemoryStream())
{
stream1.WriteByte((byte) this.m_TextEncoding);
if (tagVersion == ID3v2TagVersion.ID3v22)
{
string text1 = this.PictureExtension;
if (string.IsNullOrEmpty(text1) || (text1.Length < 3))
{
text1 = " ";
}
else if (text1.Length > 3)
{
text1 = text1.Substring(0, 3);
}
Utils.Write(stream1, Encoding.ASCII.GetBytes(text1));
}
else
{
this.SetMimeType();
Utils.Write(stream1, Utils.ISO88591GetBytes(this.m_MimeType));
stream1.WriteByte(0);
}
stream1.WriteByte((byte) this.m_PictureType);
Utils.Write(stream1, Utils.GetStringBytes(tagVersion, this.m_TextEncoding, this.m_Description, true));
Utils.Write(stream1, this.m_PictureData);
return this.m_FrameHeader.GetBytes(stream1, tagVersion, this.GetFrameID(tagVersion));
}
}
示例4: GetBytes
public override byte[] GetBytes(ID3v2TagVersion tagVersion)
{
if (Position == 0)
return new byte[0];
throw new NotImplementedException();
}
示例5: Commercial
public static void Commercial(ID3v2TagVersion tagVersion, bool useLogo)
{
if (tagVersion == ID3v2TagVersion.ID3v22)
throw new NotSupportedException();
IID3v2Tag id3 = new ID3v2Tag();
ICommercial aud = id3.CommercialInfoList.AddNew();
using (MemoryStream ms = new MemoryStream())
{
ms.WriteByte(0); // text encoding
Write(ms, Encoding.ASCII.GetBytes("usd10.00/cad15.00"));
ms.WriteByte(0); // terminate
Write(ms, Encoding.ASCII.GetBytes("20070610"));
Write(ms, Encoding.ASCII.GetBytes("www.google.com"));
ms.WriteByte(0); // terminate
ms.WriteByte((byte)ReceivedAs.FileOverTheInternet);
Write(ms, Encoding.ASCII.GetBytes("name of seller"));
ms.WriteByte(0); // terminate
Write(ms, Encoding.ASCII.GetBytes("description"));
ms.WriteByte(0); // terminate
if (useLogo)
{
Write(ms, Encoding.ASCII.GetBytes("image/jpeg"));
ms.WriteByte(0); // terminate
Write(ms, new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04 });
}
TestFrame(aud, tagVersion, ms.ToArray());
}
}
示例6: GetBytes
public override byte[] GetBytes(ID3v2TagVersion tagVersion)
{
if (_encapsulatedObject == null || _encapsulatedObject.Length == 0)
return new byte[0];
using (MemoryStream frameData = new MemoryStream())
{
byte[] fileNameData;
byte[] descriptionData;
do
{
fileNameData = ID3v2Utils.GetStringBytes(tagVersion, TextEncoding, FileName, true);
descriptionData = ID3v2Utils.GetStringBytes(tagVersion, TextEncoding, Description, true);
} while (
this.RequiresFix(tagVersion, FileName, fileNameData) ||
this.RequiresFix(tagVersion, Description, descriptionData)
);
frameData.WriteByte((byte)TextEncoding);
frameData.Write(ID3v2Utils.GetStringBytes(tagVersion, EncodingType.ISO88591, MimeType, true));
frameData.Write(fileNameData);
frameData.Write(descriptionData);
frameData.Write(_encapsulatedObject);
return _frameHeader.GetBytes(frameData, tagVersion, GetFrameID(tagVersion));
}
}
示例7: GetBytes
public override byte[] GetBytes(ID3v2TagVersion tagVersion)
{
// TODO: Test
if (string.IsNullOrEmpty(Text))
return new byte[0];
byte[] contentDescriptorData;
byte[] textData;
do
{
contentDescriptorData = ID3v2Utils.GetStringBytes(tagVersion, TextEncoding, ContentDescriptor, true);
textData = ID3v2Utils.GetStringBytes(tagVersion, TextEncoding, Text, false);
} while (
this.RequiresFix(tagVersion, ContentDescriptor, contentDescriptorData) ||
this.RequiresFix(tagVersion, Text, textData)
);
using (MemoryStream frameData = new MemoryStream())
{
frameData.WriteByte((byte)TextEncoding);
frameData.Write(ByteUtils.ISO88591GetBytes(LanguageCode));
frameData.Write(contentDescriptorData);
frameData.Write(textData);
return _frameHeader.GetBytes(frameData, tagVersion, GetFrameID(tagVersion));
}
}
示例8: GetBytes
public byte[] GetBytes(ID3v2TagVersion tagVersion)
{
if ((this.m_AdditionalData == null) && (this.m_AdditionalData.Length == 0))
{
return new byte[0];
}
if (tagVersion == ID3v2TagVersion.ID3v22)
{
if ((this.m_FrameIdentifier == null) || (this.m_FrameIdentifier.Length != 3))
{
return new byte[0];
}
}
else if ((this.m_FrameIdentifier == null) || (this.m_FrameIdentifier.Length != 4))
{
return new byte[0];
}
using (MemoryStream stream1 = new MemoryStream())
{
Utils.Write(stream1, Utils.ISO88591GetBytes(this.m_FrameIdentifier));
Utils.Write(stream1, Utils.GetStringBytes(tagVersion, EncodingType.ISO88591, this.m_Url, true));
Utils.Write(stream1, this.m_AdditionalData);
return this.m_FrameHeader.GetBytes(stream1, tagVersion, this.GetFrameID(tagVersion));
}
}
示例9: GetBytes
public override byte[] GetBytes(ID3v2TagVersion tagVersion)
{
if (_additionalData == null || _additionalData.Length == 0)
return new byte[0];
if (tagVersion == ID3v2TagVersion.ID3v22)
{
if (_frameIdentifier == null || _frameIdentifier.Length != 3)
return new byte[0];
}
else
{
if (_frameIdentifier == null || _frameIdentifier.Length != 4)
return new byte[0];
}
using (MemoryStream frameData = new MemoryStream())
{
frameData.Write(ByteUtils.ISO88591GetBytes(_frameIdentifier));
frameData.Write(ID3v2Utils.GetStringBytes(tagVersion, EncodingType.ISO88591, _url, true));
frameData.Write(_additionalData);
return _frameHeader.GetBytes(frameData, tagVersion, GetFrameID(tagVersion));
}
}
示例10: GetBytes
public byte[] GetBytes(ID3v2TagVersion tagVersion)
{
if (this.Items.Count == 0)
{
return new byte[0];
}
using (MemoryStream stream1 = new MemoryStream())
{
stream1.WriteByte((byte) this.m_TextEncoding);
bool flag1 = false;
using (IEnumerator<IInvolvedPerson> enumerator1 = this.Items.GetEnumerator())
{
while (enumerator1.MoveNext())
{
IInvolvedPerson person1 = enumerator1.Current;
if (!string.IsNullOrEmpty(person1.Involvement) || !string.IsNullOrEmpty(person1.Name))
{
Utils.Write(stream1, Utils.GetStringBytes(tagVersion, this.m_TextEncoding, person1.Involvement, true));
Utils.Write(stream1, Utils.GetStringBytes(tagVersion, this.m_TextEncoding, person1.Name, true));
flag1 = true;
}
}
}
if (!flag1)
{
return new byte[0];
}
return this.m_FrameHeader.GetBytes(stream1, tagVersion, this.GetFrameID(tagVersion));
}
}
示例11: GetBytes
public byte[] GetBytes(ID3v2TagVersion tagVersion)
{
if ((this.ReverbLeftMilliseconds != 0) || (this.ReverbRightMilliseconds != 0))
{
throw new NotImplementedException();
}
return new byte[0];
}
示例12: GetBytes
public byte[] GetBytes(ID3v2TagVersion tagVersion)
{
if (this.Items.Count != 0)
{
throw new NotImplementedException();
}
return new byte[0];
}
示例13: GetBytes
public byte[] GetBytes(ID3v2TagVersion tagVersion)
{
if (((this.IndexedDataLength != 0) && (this.BitsPerIndexPoint != 0)) && (this.FractionAtIndex.Count != 0))
{
throw new NotImplementedException();
}
return new byte[0];
}
示例14: GetBytes
public byte[] GetBytes(ID3v2TagVersion tagVersion)
{
if (this.m_MinimumOffsetToNextTag != 0)
{
throw new NotImplementedException();
}
return new byte[0];
}
示例15: GetBytes
public byte[] GetBytes(ID3v2TagVersion tagVersion)
{
if (this.BufferSize != 0)
{
throw new NotImplementedException();
}
return new byte[0];
}