////------------------------------------------------------------------------------------------------------------------------------
        private bool IsValidKeyEventType(Id3v2KeyEventType keyEventType)
        {
            // 0x17 - 0xDF  reserved for future use (Id3v2.2.0 and earlier: 0x0E - 0xDF) (Id3v2.3.0: 0x15 - 0xDF) (Id3v2.4.0 and later: 0x17 - 0xDF)
            // 0xE0 - 0xEF  not predefined sync 0-F
            // 0xF0 - 0xFC  reserved for future use
            // 0xFF      one more byte of events follows (all the following bytes with the value 0xFF have the same function)
            //
            // The 'Not predefined sync's (0xE0 - 0xEF) are for user events.
            // You might want to synchronize your music to something, like setting of an explosion on-stage,
            // turning on your screensaver etc.
            Id3v2KeyEventType maxAllowedOrderedKeyFrameType;
            if (Version < Id3v2Version.Id3v230)
                maxAllowedOrderedKeyFrameType = Id3v2KeyEventType.UnwantedNoise;
            else if ((Version >= Id3v2Version.Id3v230) && (Version < Id3v2Version.Id3v240))
                maxAllowedOrderedKeyFrameType = Id3v2KeyEventType.ThemeEnd;
            else // Id3v2.4.0 and later
                maxAllowedOrderedKeyFrameType = Id3v2KeyEventType.ProfanityEnd;

            return ((keyEventType >= Id3v2KeyEventType.Padding) && (keyEventType <= maxAllowedOrderedKeyFrameType))
                   || ((keyEventType >= (Id3v2KeyEventType)0xE0) && keyEventType <= (Id3v2KeyEventType)0xEF)
                   || ((keyEventType >= Id3v2KeyEventType.AudioEnd) && (keyEventType <= Id3v2KeyEventType.AudioFileEnds))
                   || (keyEventType == (Id3v2KeyEventType)0xFF);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Id3v2KeyEvent"/> class.
 /// </summary>
 /// <param name="eventType">Type of the event.</param>
 /// <param name="timeStamp">The time stamp.</param>
 public Id3v2KeyEvent(Id3v2KeyEventType eventType, int timeStamp)
 {
     EventType = eventType;
     TimeStamp = timeStamp;
 }