예제 #1
0
        /// <summary>
        /// Import the raw frame data.
        /// </summary>
        /// <param name="rawFrame">the raw frame.</param>
        /// <param name="codePage">Not used</param>
        public override void Import(RawFrame rawFrame, int codePage)
        {
            ImportRawFrameHeader(rawFrame);

            using (var reader = new FrameDataReader(rawFrame.Payload))
            {
                Url = reader.ReadVariableString(Encoding.ASCII);
            }
        }
예제 #2
0
        /// <summary>
        /// Converts a raw frame to PlayCounter frame.
        /// </summary>
        /// <param name="rawFrame">the raw frame.</param>
        /// <param name="codePage">Default code page for Ansi encoding. Pass 0 to use default system encoding code page.</param>
        /// s
        public override void Import(RawFrame rawFrame, int codePage)
        {
            /*
				ID = "PCNT"
				Counter         $xx xx xx xx (xx ...)
			*/

            ImportRawFrameHeader(rawFrame);

            using (var reader = new FrameDataReader(rawFrame.Payload))
            {
                Counter = reader.ReadUInt64();
            }
        }
예제 #3
0
 /// <summary>
 /// Import the header flags from a raw frame.
 /// </summary>
 /// <param name="rawFrame">The raw frame.</param>
 protected void ImportRawFrameHeader(RawFrame rawFrame)
 {
     Descriptor.Id = rawFrame.Id;
     Descriptor.TagAlterPreservation = rawFrame.Options.TagAlterPreservation;
     Descriptor.FileAlterPreservation = rawFrame.Options.FileAlterPreservation;
     Descriptor.ReadOnly = rawFrame.Options.ReadOnly;
     Descriptor.Compression = rawFrame.Options.Compression;
     Descriptor.Encryption = rawFrame.Options.Encryption;
     Descriptor.GroupingIdentify = rawFrame.Options.GroupingIdentify;
     //
     // ID3v2.4 only
     //
     Descriptor.Unsynchronisation = rawFrame.Options.Unsynchronisation;
     Descriptor.DataLengthIndicator = rawFrame.Options.DataLengthIndicator;
 }
예제 #4
0
        /// <summary>
        /// Import the raw frame.
        /// </summary>
        /// <param name="rawFrame">the raw frame.</param>
        /// <param name="codePage">Default code page for Ansi encoding. Pass 0 to use default system encoding code page.</param>
        public override void Import(RawFrame rawFrame, int codePage)
        {
            ImportRawFrameHeader(rawFrame);

            //
            //  XX            - Encoding Byte
            //  Y1 Y2 ... Yn  - Text
            //

            using (var reader = new FrameDataReader(rawFrame.Payload))
            {
                byte encodingByte = reader.ReadByte();
                TextEncoding = reader.ReadEncoding(encodingByte, codePage);
                Content = reader.ReadVariableString(TextEncoding).TrimEnd(Char.MinValue);
            }
        }
예제 #5
0
        /// <summary>
        /// Import the raw frame.
        /// </summary>
        /// <param name="rawFrame">the raw frame.</param>
        /// <param name="codePage">Default code page for Ansi encoding. Pass 0 to use default system encoding code page.</param>
        public override void Import(RawFrame rawFrame, int codePage)
        {
            ImportRawFrameHeader(rawFrame);

            /*
				<Header for 'User defined text information frame', ID: "TXXX"> 
				Text encoding : $xx
				Description   : <text string according to encoding> $00 (00)
				Value         : <text string according to encoding>
			*/

            using (var reader = new FrameDataReader(rawFrame.Payload))
            {
                byte encodingByte = reader.ReadByte();
                TextEncoding = reader.ReadEncoding(encodingByte, codePage);
                Description = reader.ReadVariableString(TextEncoding);
                Value = reader.ReadVariableString(TextEncoding);
            }
        }
예제 #6
0
        private static IFrame AnalyseFrameId(RawFrame rawFrame, IFrameCreationService frameService)
        {
            string id = rawFrame.Id;
            IFrame frame = null;

            if (frameService.Search(id))
            {
                //
                //  Get the specific frame instance
                //
                frame = frameService.GetFrameInstance(id);
            }
            else
            {
                if (id[0] == 'T' && id[1] != 'X')
                {
                    //
                    // Handle Textfames
                    //
                    frame = frameService.GetTextFrame();
                }

                if (id[0] == 'W' && id[1] != 'X')
                {
                    //
                    // Handle Web Frames
                    //
                    frame = frameService.GetUrlLinkFrame();
                }
            }

            if (frame == null)
            {
                //
                //  If all is failed then create an Unknown frame instance
                //
                frame = new UnknownFrame();
            }

            return frame;
        }
예제 #7
0
        /// <summary>
        /// Import the raw frame.
        /// </summary>
        /// <param name="rawFrame">the raw frame.</param>
        /// <param name="codePage">Default code page for Ansi encoding. Pass 0 to use default system encoding code page.</param>
        public override void Import(RawFrame rawFrame, int codePage)
        {
            ImportRawFrameHeader(rawFrame);

            //
            //  <text> 00 <data>
            //

            using (var reader = new FrameDataReader(rawFrame.Payload))
            {
                Owner = reader.ReadVariableString(Encoding.GetEncoding(28591));
                SetData(reader.ReadBytes());
            }
        }
예제 #8
0
 /// <summary>
 /// Import the raw content to a high level frame.
 /// </summary>
 /// <param name="rawFrame">the raw frame.</param>
 /// <param name="codePage">Default code page for Ansi encoding. Pass 0 to use default system encoding code page.</param>
 public abstract void Import(RawFrame rawFrame, int codePage);
예제 #9
0
        /// <summary>
        /// Import the raw frame.
        /// </summary>
        /// <param name="rawFrame">the raw frame.</param>
        /// <param name="codePage">Default code page for Ansi encoding. Pass 0 to use default system encoding code page.</param>
        public override void Import(RawFrame rawFrame, int codePage)
        {
            ImportRawFrameHeader(rawFrame);

            /*
				ID = "COMM"
				TextEncoding    xx
				Language        xx xx xx
				Short Content   (xx xx ... xx) (00 / 00 00)
				Text            (xx xx ... xx)
            */

            using (var reader = new FrameDataReader(rawFrame.Payload))
            {
                byte encodingByte = reader.ReadByte();
                Language = reader.ReadFixedString(Encoding.ASCII, 3);
                TextEncoding = reader.ReadEncoding(encodingByte, codePage);
                ContentDescriptor = reader.ReadVariableString(TextEncoding);
                Text = reader.ReadVariableString(TextEncoding);
            }
        }
        /// <summary>
        /// Import the raw frame.
        /// </summary>
        /// <param name="rawFrame">the raw frame.</param>
        /// <param name="codePage">Default code page for Ansi encoding. Pass 0 to use default system encoding code page.</param>
        public override void Import(RawFrame rawFrame, int codePage)
        {
            ImportRawFrameHeader(rawFrame);

            /*
             *  Text Encoding   xx
             *  Description     (xx xx .. xx) (00 / 00 00)
             *  URL             (xx xx ... xx)  als ISO8859-1 !
             */

            using (var reader = new FrameDataReader(rawFrame.Payload))
            {
                byte encodingByte = reader.ReadByte();
                TextEncoding = reader.ReadEncoding(encodingByte, codePage);
                Description = reader.ReadVariableString(TextEncoding);
                Url = reader.ReadVariableString(Encoding.GetEncoding(28591));
            }
        }
예제 #11
0
        /// <summary>
        /// Import the raw content to a high level frame.
        /// </summary>
        /// <param name="rawFrame">the raw frame.</param>
        /// <param name="codePage">Default code page for Ansi encoding. Pass 0 to use default system encoding code page.</param>
        public override void Import(RawFrame rawFrame, int codePage)
        {
            /*
             * ID = "POPM"
             * Email to user   <text string> $00
             * Rating          $xx
             * Counter         $xx xx xx xx (xx ...)
             */
            ImportRawFrameHeader(rawFrame);

            using (var reader = new FrameDataReader(rawFrame.Payload))
            {
                Email = reader.ReadVariableString(Encoding.ASCII);
                Rating = reader.ReadByte();
                PlayCounter = reader.ReadUInt64();
            }
        }
        /// <summary>
        /// Imports values from the <see cref="RawFrame"/>.
        /// </summary>
        /// <param name="rawFrame">the raw frame.</param>
        /// <param name="codePage">Default code page for Ansi encoding. Pass 0 to use default system encoding code page.</param>
        public override void Import(RawFrame rawFrame, int codePage)
        {
            ImportRawFrameHeader(rawFrame);

            using (var reader = new FrameDataReader(rawFrame.Payload))
            {
                byte encodingByte = reader.ReadByte();
                Language = reader.ReadFixedString(Encoding.ASCII, 3);
                TextEncoding = reader.ReadEncoding(encodingByte, codePage);
                ContentDescriptor = reader.ReadVariableString(TextEncoding);
                Lyrics = reader.ReadVariableString(TextEncoding);
            }
        }
        /// <summary>
        /// Import the raw frame.
        /// </summary>
        /// <param name="rawFrame">the raw frame.</param>
        /// <param name="codePage">Default code page for Ansi encoding. Pass 0 to use default system encoding code page.</param>
        public override void Import(RawFrame rawFrame, int codePage)
        {
            ImportRawFrameHeader(rawFrame);

            Toc = rawFrame.Payload;
        }
예제 #14
0
        /// <summary>
        /// Import the raw frame.
        /// </summary>
        /// <param name="rawFrame">the raw frame.</param>
        /// <param name="codePage">Default code page for Ansi encoding. Pass 0 to use default system encoding code page.</param>
        public override void Import(RawFrame rawFrame, int codePage)
        {
            ImportRawFrameHeader(rawFrame);

            using (var reader = new FrameDataReader(rawFrame.Payload))
            {
                Owner = reader.ReadVariableString(Encoding.GetEncoding(28591));
                PreviewStart = reader.ReadUInt16();
                PreviewLength = reader.ReadUInt16();
                SetEncryption(reader.ReadBytes());
            }
        }
예제 #15
0
        /*
           <Header for 'Attached picture', ID: "APIC"> 
           Text encoding   $xx
           MIME type       <text string> $00
           Picture type    $xx
           Description     <text string according to encoding> $00 (00)
           Picture data    <binary data>
        */

        /// <summary>
        /// Import a raw frame
        /// </summary>
        /// <param name="rawFrame">the raw frame</param>
        /// <param name="codePage">Default code page for Ansi encoding. Pass 0 to use default system encoding code page.</param>
        public override void Import(RawFrame rawFrame, int codePage)
        {
            ImportRawFrameHeader(rawFrame);

            if (rawFrame.Payload.Count == 0)
            {
                throw new Id3TagException("Frame has no payload.");
            }

            using (var reader = new FrameDataReader(rawFrame.Payload))
            {
                byte encodingByte = reader.ReadByte();
                MimeType = reader.ReadVariableString(Encoding.ASCII);
                PictureCoding = (PictureType) reader.ReadByte();
                TextEncoding = reader.ReadEncoding(encodingByte, codePage);
                Description = reader.ReadVariableString(TextEncoding);
                SetPictureData(reader.ReadBytes());
            }
        }