protected override object AddNewCore()
        {
            ISynchronizedTextItem item1 = new SynchronizedTextItem();

            base.Add(item1);
            return(item1);
        }
        protected override object AddNewCore()
        {
            ISynchronizedTextItem synchronizedTextItem = new SynchronizedTextItem();

            Add(synchronizedTextItem);

            // Not necessary to hook up event handlers, base class calls InsertItem

            return(synchronizedTextItem);
        }
Esempio n. 3
0
        public void Read(TagReadingInfo tagReadingInfo, Stream stream)
        {
            this.Items.Clear();
            this.m_FrameHeader.Read(tagReadingInfo, ref stream);
            int num1 = this.m_FrameHeader.FrameSizeExcludingAdditions;

            if (num1 >= 1)
            {
                this.TextEncoding = (EncodingType)Utils.ReadByte(stream, ref num1);
                if (num1 >= 3)
                {
                    this.LanguageCode = Utils.ReadString(EncodingType.ISO88591, stream, 3);
                    num1 -= 3;
                    if (num1 >= 2)
                    {
                        this.TimestampFormat = (IdSharp.Tagging.ID3v2.TimestampFormat)Utils.ReadByte(stream, ref num1);
                        this.ContentType     = (TextContentType)Utils.ReadByte(stream, ref num1);
                        if (num1 > 0)
                        {
                            this.ContentDescriptor = Utils.ReadString(this.TextEncoding, stream, ref num1);
                            while (num1 > 0)
                            {
                                string text1 = Utils.ReadString(this.TextEncoding, stream, ref num1);
                                if (num1 >= 4)
                                {
                                    SynchronizedTextItem item1 = new SynchronizedTextItem();
                                    item1.Text      = text1;
                                    item1.Timestamp = Utils.ReadInt32(stream);
                                    num1           -= 4;
                                    this.Items.Add(item1);
                                }
                            }
                        }
                        else
                        {
                            this.ContentDescriptor = "";
                        }
                    }
                    else
                    {
                        this.TimestampFormat   = IdSharp.Tagging.ID3v2.TimestampFormat.Milliseconds;
                        this.ContentType       = TextContentType.Other;
                        this.ContentDescriptor = "";
                    }
                }
                else
                {
                    this.LanguageCode      = "eng";
                    this.TimestampFormat   = IdSharp.Tagging.ID3v2.TimestampFormat.Milliseconds;
                    this.ContentType       = TextContentType.Other;
                    this.ContentDescriptor = "";
                }
            }
            else
            {
                this.TextEncoding      = EncodingType.ISO88591;
                this.LanguageCode      = "eng";
                this.TimestampFormat   = IdSharp.Tagging.ID3v2.TimestampFormat.Milliseconds;
                this.ContentType       = TextContentType.Other;
                this.ContentDescriptor = "";
            }
            if (num1 > 0)
            {
                stream.Seek((long)num1, SeekOrigin.Current);
            }
        }
Esempio n. 4
0
        public override void Read(TagReadingInfo tagReadingInfo, Stream stream)
        {
            Items.Clear();

            _frameHeader.Read(tagReadingInfo, ref stream);

            int bytesLeft = _frameHeader.FrameSizeExcludingAdditions;

            if (bytesLeft >= 1)
            {
                TextEncoding = (EncodingType)stream.Read1(ref bytesLeft);
                if (bytesLeft >= 3)
                {
                    LanguageCode = ID3v2Utils.ReadString(EncodingType.ISO88591, stream, 3);
                    bytesLeft   -= 3;
                    if (bytesLeft >= 2)
                    {
                        TimestampFormat = (TimestampFormat)stream.Read1(ref bytesLeft);
                        ContentType     = (TextContentType)stream.Read1(ref bytesLeft);
                        if (bytesLeft > 0)
                        {
                            ContentDescriptor = ID3v2Utils.ReadString(TextEncoding, stream, ref bytesLeft);

                            while (bytesLeft > 0)
                            {
                                string lyrics = ID3v2Utils.ReadString(TextEncoding, stream, ref bytesLeft);
                                if (bytesLeft >= 4)
                                {
                                    SynchronizedTextItem textItem = new SynchronizedTextItem();
                                    textItem.Text      = lyrics;
                                    textItem.Timestamp = stream.ReadInt32();
                                    bytesLeft         -= 4;
                                    Items.Add(textItem);
                                }
                            }
                        }
                        else
                        {
                            // Incomplete frame
                            ContentDescriptor = "";
                        }
                    }
                    else
                    {
                        // Incomplete frame
                        TimestampFormat   = TimestampFormat.Milliseconds;
                        ContentType       = TextContentType.Other;
                        ContentDescriptor = "";
                    }
                }
                else
                {
                    // Incomplete frame
                    LanguageCode      = "eng";
                    TimestampFormat   = TimestampFormat.Milliseconds;
                    ContentType       = TextContentType.Other;
                    ContentDescriptor = "";
                }
            }
            else
            {
                // Incomplete frame
                TextEncoding      = EncodingType.ISO88591;
                LanguageCode      = "eng";
                TimestampFormat   = TimestampFormat.Milliseconds;
                ContentType       = TextContentType.Other;
                ContentDescriptor = "";
            }

            if (bytesLeft > 0)
            {
                stream.Seek(bytesLeft, SeekOrigin.Current);
            }
        }