Пример #1
0
 public PictureFrame(FrameHeader header, ID3Version version)
     : base(header)
 {
     if (version == ID3Version.ID3v1)
         throw new InvalidEnumArgumentException("version", (int)version, typeof(ID3Version));
     _version = version;
 }
Пример #2
0
        public static Frame FromStream(Stream stream, ID3v2 tag)
        {
            bool result = false;
            FrameHeader header = new FrameHeader(stream, tag.Header.Version);
            long streamPosition = stream.Position + header.FrameSize;
            var frame = FrameFactory.Instance.TryGetFrame(header, tag.Header.Version, stream, out result);
            stream.Position = streamPosition;

            return frame;
        }
Пример #3
0
 public Frame TryGetFrame(FrameHeader header, ID3Version version, Stream stream, out bool result)
 {
     try
     {
         result = true;
         var frame = GetFrame(header, version, stream);
         return frame;
     }
     catch (Exception)
     {
         result = false;
         return null;
     }
 }
Пример #4
0
 public CommercialFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #5
0
 public DataFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #6
0
 public BinaryFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #7
0
 protected Frame(FrameHeader header)
 {
     Header = header;
 }
Пример #8
0
 public CommentAndLyricsFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #9
0
 public TimestampTextFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #10
0
 public TimestampTextFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #11
0
 public NumericTextFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #12
0
 public UserDefiniedTextFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #13
0
        private Frame GetFrame(string id, ID3Version version, FrameHeader header)
        {
            FrameID frameID = FrameIDFactory2.GetFrameEntry(id, version).ID;

            switch (frameID)
            {
            case FrameID.Length:
            case FrameID.EncodedBy:    //---
            case FrameID.Album:
            case FrameID.Composer:
            case FrameID.ContentType:
            case FrameID.CopyrightMessage:
            case FrameID.TextWriter:
            case FrameID.FileType:
            case FrameID.ContentGroupDescription:
            case FrameID.Title:
            case FrameID.Subtitle:
            case FrameID.InitialKey:
            case FrameID.Languages:
            case FrameID.MediaType:
            case FrameID.OriginalAlbum:
            case FrameID.OriginalFileName:
            case FrameID.OriginalTextWriter:
            case FrameID.OriginalArtist:
            case FrameID.FileOwner:
            case FrameID.LeadPerformers:     //--
            case FrameID.Band:
            case FrameID.Conductor:
            case FrameID.Interpreted:     //remixed
            case FrameID.PartOfASet:
            case FrameID.Publisher:
            case FrameID.TrackNumber:
            case FrameID.RecordingDates:
            case FrameID.InternetRadioStationName:
            case FrameID.InternetRadioStationOwner:
            case FrameID.ISRC:
            case FrameID.EncodingSettings:
            case FrameID.MusicicanCreditsList:
            case FrameID.InvolvedPeopleList:
            case FrameID.Mood:
            case FrameID.ProducedNotice:
            case FrameID.AlbumSortOrder:
            case FrameID.PerformerSortOrder:
            case FrameID.TitleSortOrder:
            case FrameID.SetSubtitle:
                return(new MultiStringTextFrame(header)); //multistringtextframe

            case FrameID.Size:                            //---
            case FrameID.BeatsPerMinute:
            case FrameID.Date:
            case FrameID.PlaylistDelay:
            case FrameID.Time:
            case FrameID.OriginalReleaseYear:
            case FrameID.Year:
                return(new NumericTextFrame(header));    //numerictextframe

            case FrameID.RecordingTime:
            case FrameID.OriginalReleaseTime:
            case FrameID.EncodingTime:
            case FrameID.ReleaseTime:
            case FrameID.TaggingTime:
                return(new TimestampTextFrame(header));    //Timestamptextframe

            case FrameID.CommercialInformationURL:
            case FrameID.CopyrightURL:
            case FrameID.OfficialAudioFileWebpage:
            case FrameID.OfficialArtistWebpage:
            case FrameID.OfficialAudioSourceWebpage:
            case FrameID.InternetRadioStationWebpage:
            case FrameID.PaymentURL:
            case FrameID.PublishersOfficialWebpage:
                return(new TextFrame(header));    //textframe

            case FrameID.PrivateFrame:
            case FrameID.UniqueFileIdentifier:
                return(new DataFrame(header));

            case FrameID.MusicCDIdentifier:
            case FrameID.RecommendedBufferSize:     //---
            case FrameID.EncryptedMetaData:
            case FrameID.AudioSeekPointIndex:
            case FrameID.MPEGLocationLookupTable:
            case FrameID.SynchronizedTempoCodes:
            case FrameID.RelativeVolumeAdjustment:
            case FrameID.RelativeVolumeAdjustmentOld:
            case FrameID.Equalization:
            case FrameID.EqualizationOld:
                return(new BinaryFrame(header));

            case FrameID.UserTextInformation:
            case FrameID.UserURLLinkFrame:
                return(new UserDefiniedTextFrame(header));

            case FrameID.AttachedPicutre:
                return(new PictureFrame(header, version));

            case FrameID.UnsynchronizedLyris:
            case FrameID.Comments:
                return(new CommentAndLyricsFrame(header));

            case FrameID.TermsOfUse:
                return(new TermsOfUseFrame(header));

            case FrameID.OwnershipFrame:
                return(new OwnershipFrame(header));

            case FrameID.CommercialFrame:
                return(new CommercialFrame(header));

            case FrameID.Popularimeter:
                return(new Popularimeter(header));
            }
            return(null);
        }
Пример #14
0
        private Frame GetFrame(string id, ID3Version version, FrameHeader header)
        {
            FrameID frameID = FrameIDFactory2.GetFrameEntry(id, version).ID;
            switch (frameID)
            {
                case FrameID.Length:
                case FrameID.EncodedBy://---
                case FrameID.Album:
                case FrameID.Composer:
                case FrameID.ContentType:
                case FrameID.CopyrightMessage:
                case FrameID.TextWriter:
                case FrameID.FileType:
                case FrameID.ContentGroupDescription:
                case FrameID.Title:
                case FrameID.Subtitle:
                case FrameID.InitialKey:
                case FrameID.Languages:
                case FrameID.MediaType:
                case FrameID.OriginalAlbum:
                case FrameID.OriginalFileName:
                case FrameID.OriginalTextWriter:
                case FrameID.OriginalArtist:
                case FrameID.FileOwner:
                case FrameID.LeadPerformers: //--
                case FrameID.Band:
                case FrameID.Conductor:
                case FrameID.Interpreted: //remixed
                case FrameID.PartOfASet:
                case FrameID.Publisher:
                case FrameID.TrackNumber:
                case FrameID.RecordingDates:
                case FrameID.InternetRadioStationName:
                case FrameID.InternetRadioStationOwner:
                case FrameID.ISRC:
                case FrameID.EncodingSettings:
                case FrameID.MusicicanCreditsList:
                case FrameID.InvolvedPeopleList:
                case FrameID.Mood:
                case FrameID.ProducedNotice:
                case FrameID.AlbumSortOrder:
                case FrameID.PerformerSortOrder:
                case FrameID.TitleSortOrder:
                case FrameID.SetSubtitle:
                    return new MultiStringTextFrame(header); //multistringtextframe
                case FrameID.Size://---
                case FrameID.BeatsPerMinute:
                case FrameID.Date:
                case FrameID.PlaylistDelay:
                case FrameID.Time:
                case FrameID.OriginalReleaseYear:
                case FrameID.Year:
                    return new NumericTextFrame(header); //numerictextframe
                case FrameID.RecordingTime:
                case FrameID.OriginalReleaseTime:
                case FrameID.EncodingTime:
                case FrameID.ReleaseTime:
                case FrameID.TaggingTime:
                    return new TimestampTextFrame(header); //Timestamptextframe
                case FrameID.CommercialInformationURL:
                case FrameID.CopyrightURL:
                case FrameID.OfficialAudioFileWebpage:
                case FrameID.OfficialArtistWebpage:
                case FrameID.OfficialAudioSourceWebpage:
                case FrameID.InternetRadioStationWebpage:
                case FrameID.PaymentURL:
                case FrameID.PublishersOfficialWebpage:
                    return new TextFrame(header); //textframe
                case FrameID.PrivateFrame:
                case FrameID.UniqueFileIdentifier:
                    return new DataFrame(header);

                case FrameID.MusicCDIdentifier:
                case FrameID.RecommendedBufferSize: //---
                case FrameID.EncryptedMetaData:
                case FrameID.AudioSeekPointIndex:
                case FrameID.MPEGLocationLookupTable:
                case FrameID.SynchronizedTempoCodes:
                case FrameID.RelativeVolumeAdjustment:
                case FrameID.RelativeVolumeAdjustmentOld:
                case FrameID.Equalization:
                case FrameID.EqualizationOld:
                    return new BinaryFrame(header);

                case FrameID.UserTextInformation:
                case FrameID.UserURLLinkFrame:
                    return new UserDefiniedTextFrame(header);

                case FrameID.AttachedPicutre:
                    return new PictureFrame(header, version);

                case FrameID.UnsynchronizedLyris:
                case FrameID.Comments:
                    return new CommentAndLyricsFrame(header);

                case FrameID.TermsOfUse:
                    return new TermsOfUseFrame(header);

                case FrameID.OwnershipFrame:
                    return new OwnershipFrame(header);

                case FrameID.CommercialFrame:
                    return new CommercialFrame(header);

                case FrameID.Popularimeter:
                    return new Popularimeter(header);
            }
            return null;
        }
Пример #15
0
 public Frame GetFrame(FrameHeader header, ID3Version version, Stream stream)
 {
     var frame = GetFrame(header.FrameID, version, header);
     frame.DecodeContent(ID3Utils.Read(stream, header.FrameSize));
     return frame;
 }
Пример #16
0
 public MultiStringTextFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #17
0
 public CommentAndLyricsFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #18
0
 public UserDefiniedTextFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #19
0
 public DataFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #20
0
 public CommercialFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #21
0
 public MultiStringTextFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #22
0
 public BinaryFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #23
0
 public NumericTextFrame(FrameHeader header)
     : base(header)
 {
 }
Пример #24
0
 protected Frame(FrameHeader header)
 {
     Header = header;
 }