示例#1
0
 private void DecodeFlags(byte[] flags)
 {
     Options = new FrameOptions();
     Options.TagAlterPreservation = (flags[0] & 0x80) == 0x80;
     Options.FileAlterPreservation = (flags[0] & 0x40) == 0x40;
     Options.ReadOnly = (flags[0] & 0x20) == 0x20;
     Options.Compression = (flags[1] & 0x80) == 0x80;
     Options.Encryption = (flags[1] & 0x40) == 0x40;
     Options.GroupingIdentify = (flags[1] & 0x20) == 0x20;
 }
示例#2
0
/*
        internal static RawFrame CreateV4Frame(string frameID, FrameOptions flags, byte[] payload)
        {
            var f = new RawFrameV4(frameID, flags, payload);
            return f;
        }
*/

        internal static RawFrame CreateFrame(string frameId, FrameOptions options, IList<byte> payload,
                                             TagVersion version)
        {
            RawFrame frame;
            switch (version)
            {
                case TagVersion.Id3V23:
                    frame = new RawFrameV3(frameId, options, payload);
                    break;
                case TagVersion.Id3V24:
                    frame = new RawFrameV4(frameId, options, payload);
                    break;
                default:
                    throw new Id3TagException("Unknown Tag Version found!");
            }

            return frame;
        }
示例#3
0
        /*
         * 
         *      %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[] options)
        {
            Options = new FrameOptions();

            bool isTagAlterPreservation = (options[0] & 0x40) == 0x40;
            bool isFileAlterPreservation = (options[0] & 0x20) == 0x20;
            bool isReadOnly = (options[0] & 0x10) == 0x10;
            bool isGroupingIdentity = (options[1] & 0x40) == 0x40;
            bool isCompression = (options[1] & 0x08) == 0x08;
            bool isEncryption = (options[1] & 0x04) == 0x04;
            bool isUnsync = (options[1] & 0x02) == 0x02;
            bool isDataLengthIndicator = (options[1] & 0x01) == 0x01;

            Options.TagAlterPreservation = isTagAlterPreservation;
            Options.FileAlterPreservation = isFileAlterPreservation;
            Options.ReadOnly = isReadOnly;
            Options.GroupingIdentify = isGroupingIdentity;
            Options.Compression = isCompression;
            Options.Encryption = isEncryption;
            Options.Unsynchronisation = isUnsync;
            Options.DataLengthIndicator = isDataLengthIndicator;
        }
示例#4
0
        public void ImportTest()
        {
            var payload = new byte[] {0x30, 0x31, 0x32, 0x33};
            var flags = new FrameOptions();
            var rawFrame = new RawFrameV3("ABCD", flags, payload);

            var frame = new UnknownFrame();
            frame.Import(rawFrame, 0);

            Assert.AreEqual("ABCD", frame.Descriptor.Id);
            Assert.That(frame.Content, Is.EquivalentTo(payload));
        }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RawFrameV4"/> class.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="options">The options.</param>
 /// <param name="payload">The payload.</param>
 public RawFrameV4(string id, FrameOptions options, IList<byte> payload)
     : base(id, payload)
 {
     Options = options;
 }