本文整理汇总了C#中FrameFlags类的典型用法代码示例。如果您正苦于以下问题:C# FrameFlags类的具体用法?C# FrameFlags怎么用?C# FrameFlags使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FrameFlags类属于命名空间,在下文中一共展示了FrameFlags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExtensionFrame
protected ExtensionFrame(byte extensionId)
{
_extensionId = extensionId;
_flags = FrameFlags.ExtensionFrame;
_receiveState = ExtensionFrameState.PayloadLength;
_sendCompleted = true;
}
示例2: Read
public bool Read(byte[] buffer, ref int offset, ref int bytesTransferred)
{
while (bytesTransferred > 0)
{
switch (_receiveState)
{
case ExtensionFrameState.Flags:
Flags = (FrameFlags) buffer[offset];
_receiveState = ExtensionFrameState.ExtensionId;
++offset;
--bytesTransferred;
break;
case ExtensionFrameState.ExtensionId:
var extensionId = buffer[offset];
++offset;
--bytesTransferred;
_receiveState = ExtensionFrameState.Payload;
_receiveFrame = (ExtensionFrame) _extensionFactory(extensionId);
break;
case ExtensionFrameState.Payload:
var isCompleted = _receiveFrame.Read(buffer, ref offset, ref bytesTransferred);
if (isCompleted)
{
_frameReceived(_receiveFrame);
_receiveState = ExtensionFrameState.Flags;
}
return isCompleted;
}
}
return false;
}
示例3: PositionSynchronisedFrame
/// <summary>
/// create new PositionSynchronised frame
/// </summary>
/// <param name="Flags">Flags of frame</param>
/// <param name="TimeStamp">TimeStamp to use for frame</param>
/// <param name="Position">Position of frame</param>
public PositionSynchronisedFrame(FrameFlags Flags, TimeStamps TimeStamp,
long Position)
: base("POSS", Flags)
{
this.TimeStamp = TimeStamp;
_Position = Position;
}
示例4: AttachedPictureFrame
/// <summary>
/// Create new AttachedPicture frame
/// </summary>
/// <param name="Flags">Flags of frame</param>
/// <param name="Description">Description of picture</param>
/// <param name="TextEncoding">TextEncoding use for texts</param>
/// <param name="MIMEType">MimeType of picture</param>
/// <param name="PictureType">Picture type</param>
/// <param name="Data">Data Contain picture</param>
public AttachedPictureFrame(FrameFlags Flags, string Description,
TextEncodings TextEncoding, string MIMEType, PictureTypes PictureType,
MemoryStream Data)
: base("APIC", Flags, Description, MIMEType, TextEncoding, Data)
{
_PictureType = PictureType;
}
示例5: DecodeFlags
private void DecodeFlags(byte[] flags)
{
Flag = new FrameFlags();
Flag.TagAlterPreservation = (flags[0] & 0x80) == 0x80;
Flag.FileAlterPreservation = (flags[0] & 0x40) == 0x40;
Flag.ReadOnly = (flags[0] & 0x20) == 0x20;
Flag.Compression = (flags[1] & 0x80) == 0x80;
Flag.Encryption = (flags[1] & 0x40) == 0x40;
Flag.GroupingIdentify = (flags[1] & 0x20) == 0x20;
}
示例6: LinkFrame
/// <summary>
/// New LinkedFrame from specific information
/// </summary>
/// <param name="Flags">Frame Flags</param>
/// <param name="FrameIdentifier">FrameIdentifier of frame that linked</param>
/// <param name="URL">URL address of Linked Frame</param>
/// <param name="AdditionalData">Additional data of Linked Frame</param>
public LinkFrame(FrameFlags Flags, string FrameIdentifier,
string URL, string AdditionalData)
: base("LINK", Flags)
{
this.URL = URL;
_AdditionalData = AdditionalData;
// Check if FrameIdentifier is valid
ValidatingFrameID(FrameIdentifier, ValidatingErrorTypes.Exception);
_FrameIdentifier = FrameIdentifier;
}
示例7: FrameHeader
public FrameHeader(ByteVector data, byte version)
{
if (data == null)
{
throw new ArgumentNullException("data");
}
this.flags = FrameFlags.None;
this.frame_size = 0;
if ((version < 2) || (version > 4))
{
throw new CorruptFileException("Unsupported tag version.");
}
if (data.Count < ((version != 2) ? 4 : 3))
{
throw new CorruptFileException("Data must contain at least a frame ID.");
}
switch (version)
{
case 2:
this.frame_id = ConvertId(data.Mid(0, 3), version, false);
if (data.Count >= 6)
{
this.frame_size = data.Mid(3, 3).ToUInt();
return;
}
return;
case 3:
this.frame_id = ConvertId(data.Mid(0, 4), version, false);
if (data.Count >= 10)
{
this.frame_size = data.Mid(4, 4).ToUInt();
this.flags = (FrameFlags) ((ushort) ((((data[8] << 7) & 0x7000) | ((data[9] >> 4) & 12)) | ((data[9] << 1) & 0x40)));
return;
}
return;
case 4:
this.frame_id = new ReadOnlyByteVector(data.Mid(0, 4));
if (data.Count >= 10)
{
this.frame_size = SynchData.ToUInt(data.Mid(4, 4));
this.flags = (FrameFlags) data.Mid(8, 2).ToUShort();
return;
}
return;
}
throw new CorruptFileException("Unsupported tag version.");
}
示例8: Frame
private string _ErrorMessage; // Contain Error Message if occur
/// <summary>
/// Create a new Frame class
/// </summary>
/// <param name="FrameID">4 Characters tag identifier</param>
/// <param name="Flag">Frame Falgs</param>
protected Frame(string FrameID, FrameFlags Flags)
{
// All FrameID letters must be capital
FrameID = FrameID.ToUpper();
if (!ValidatingFrameID(FrameID, ValidatingErrorTypes.Exception))
{
_MustDrop = true;
return;
}
_FrameFlags = Flags;
_FrameID = FrameID;
_MustDrop = false;
_IsLinked = false;
}
示例9: SynchronisedText
/// <summary>
/// New SynchronisedText
/// </summary>
/// <param name="FrameID">FrameID</param>
/// <param name="Flags">Frame Flag</param>
/// <param name="Data">FileStream contain current frame data</param>
internal SynchronisedText(string FrameID, FrameFlags Flags, FileStreamEx Data, int Length)
: base(FrameID, Flags)
{
_Syllables = new FramesCollection<Syllable>();
TextEncoding = (TextEncodings)Data.ReadByte();
if (!IsValidEnumValue(TextEncoding, ValidatingErrorTypes.ID3Error))
return;
Length--;
_Language = new Language(Data);
Length -= 3;
_TimeStamp = (TimeStamps)Data.ReadByte();
if (!IsValidEnumValue(_TimeStamp, ValidatingErrorTypes.ID3Error))
return;
Length--;
_ContentType = (ContentTypes)Data.ReadByte();
if (!IsValidEnumValue(_ContentType, ValidatingErrorTypes.Nothing))
_ContentType = ContentTypes.Other;
Length--;
// use Text variable for descriptor property
ContentDescriptor = Data.ReadText(Length, TextEncoding, ref Length, true);
string tempText;
uint tempTime;
while (Length > 5)
{
tempText = Data.ReadText(Length, TextEncoding, ref Length, true);
tempTime = Data.ReadUInt(4);
_Syllables.Add(new Syllable(tempTime, tempText));
Length -= 4;
}
}
示例10: DecodeFlags
/*
*
* %0abc 0000 %0h00 kmnp
*
* a = Tag Alter Preservartion
* b = File Alter Preservation
* c = Read Only
* h = Grouping Identity
* k = Compression
* m = Encryption
* n = Unsynchronisation
* p = Data Length Indicator
*/
private void DecodeFlags(byte[] flags)
{
Flag = new FrameFlags();
var isTagAlterPreservation = (flags[0] & 0x40) == 0x40;
var isFileAlterPreservation = (flags[0] & 0x20) == 0x20;
var isReadOnly = (flags[0] & 0x10) == 0x10;
var isGroupingIdentity = (flags[1] & 0x40) == 0x40;
var isCompression = (flags[1] & 0x08) == 0x08;
var isEncryption = (flags[1] & 0x04) == 0x04;
var isUnsync = (flags[1] & 0x02) == 0x02;
var isDataLengthIndicator = (flags[1] & 0x01) == 0x01;
Flag.TagAlterPreservation = isTagAlterPreservation;
Flag.FileAlterPreservation = isFileAlterPreservation;
Flag.ReadOnly = isReadOnly;
Flag.GroupingIdentify = isGroupingIdentity;
Flag.Compression = isCompression;
Flag.Encryption = isEncryption;
Flag.Unsynchronisation = isUnsync;
Flag.DataLengthIndicator = isDataLengthIndicator;
}
示例11: ReverbFrame
/// <summary>
/// Create new reveb frame
/// </summary>
/// <param name="FrameID">FrameID</param>
/// <param name="Flags">Flags of frame</param>
/// <param name="Data">Data for frame to read from</param>
/// <param name="Length">Maximum length of frame</param>
internal ReverbFrame(string FrameID, FrameFlags Flags, FileStreamEx Data, int Length)
: base(FrameID, Flags)
{
if (Length != 12)
{
//RaiseErrorEvent(new ID3Error(208, ID3Versions.ID3v2, _FrameID,
//"Reveb frame is not in correct length. it will drop", ErrorType.Error));
_MustDrop = true;
return;
}
_ReverbLeft = Convert.ToInt32(Data.ReadUInt(2));
_ReverbRight = Convert.ToInt32(Data.ReadUInt(2));
_ReverbBouncesLeft = Data.ReadByte();
_ReverbBouncesRight = Data.ReadByte();
_ReverbFeedbackLeftToLeft = Data.ReadByte();
_ReverbFeedbackLeftToRight = Data.ReadByte();
_ReverbFeedbackRightToRight = Data.ReadByte();
_ReverbFeedbackRightToLeft = Data.ReadByte();
_PremixLeftToRight = Data.ReadByte();
_PremixRightToLeft = Data.ReadByte();
}
示例12: MpegLocationLookupTable
protected uint _MilisecondBetweenRef; // 3 Bytes
#endregion Fields
#region Constructors
/// <summary>
/// Create new MpegLocationLookupTable
/// </summary>
/// <param name="FrameID">FrameID</param>
/// <param name="Flags">Flags for this frame</param>
/// <param name="Data">FileStream to read data from</param>
internal MpegLocationLookupTable(string FrameID, FrameFlags Flags, FileStreamEx Data, int Length)
: base(FrameID, Flags)
{
_FrameBetweenRef = Data.ReadUInt(2);
_ByteBetweenRef = Data.ReadUInt(3);
_ByteBetweenRef = Data.ReadUInt(3);
_BitsForByteDeviation = Data.ReadByte();
_BitsForMilisecondDeviation = Data.ReadByte();
Length -= 10;
int Sum = _BitsForByteDeviation + _BitsForMilisecondDeviation;
////BitForByteDev + BitForMilisecondDev must be multiple of four
//if (Sum % 4 != 0)
//{
// RaiseErrorEvent(new ID3Error(208, ID3Versions.ID3v2, _FrameID,
// "Error in MpegLocationLookupTable, it's not standard. it will drop", ErrorType.Error));
// _MustDrop = true;
// return;
//}
//if (Sum > 32 || Sum % 8 != 0)
//{
// RaiseErrorEvent(new ID3Error(208, ID3Versions.ID3v2, _FrameID,
// "this program can't process MpegLocation Table", ErrorType.Error));
// _MustDrop = true;
// return;
//}
uint Temp;
Sum /= 8;
while (Length >= Sum)
{
Temp = Data.ReadUInt(Sum);
Length -= Sum;
}
}
示例13: PlayCounterFrame
/// <summary>
/// Create new PlayCounter
/// </summary>
/// <param name="FrameID">4 Characters tag identifier</param>
/// <param name="Flags">2 Bytes flags identifier</param>
/// <param name="Data">Contain Data for this frame</param>
internal PlayCounterFrame(string FrameID, FrameFlags Flags, FileStream Data, int Length)
: base(FrameID, Flags)
{
byte[] Long = new byte[8];
byte[] Buf = new byte[Length];
// Less than 4 Characters
Data.Read(Buf, 0, Length);
Buf.CopyTo(Long, 8 - Buf.Length);
Array.Reverse(Long);
_Counter = BitConverter.ToInt64(Long, 0);
}
示例14: TextWithLanguageFrame
public TextWithLanguageFrame(string FrameID, FrameFlags Flags, string Text,
string Description, TextEncodings TextEncoding, string Lang)
: base(FrameID, Flags)
{
if (FrameID != "USLT" && FrameID != "COMM")
throw (new ArgumentException(FrameID + " is not valid Frame for TextWithLanguageFrame"));
Language = new Language(Lang);
this.Text = Text;
this.Description = "";
this.TextEncoding = TextEncoding;
}
示例15: TextOnlyFrame
private string _Text; // Contain text
#endregion Fields
#region Constructors
protected TextOnlyFrame(string FrameID, FrameFlags Flags)
: base(FrameID, Flags)
{
}