/// <summary> /// Creates a new ID3 Tag representation. /// </summary> /// <param name="version">the ID3 Tag version.</param> /// <returns>the representation instance.</returns> public static TagContainer CreateId3Tag(TagVersion version) { Logger.LogInfo(string.Format("Create ID3Tag with TagVersion {0}", version)); TagContainer container; switch (version) { case TagVersion.Id3V23: container = new TagContainerV3(); break; case TagVersion.Id3V24: container = new TagContainerV4(); break; default: throw new Id3TagException("Invalid tag version!"); } return container; }
private static TagContainer DecodeV4Tag(Id3TagInfo info) { var container = new TagContainerV4(); TagDescriptorV4 descriptor = container.Tag; descriptor.SetHeaderOptions(info.Unsynchronised, info.ExtendedHeaderAvailable, info.Experimental, info.HasFooter); if (info.ExtendedHeaderAvailable) { ExtendedTagHeaderV4 extendedHeader = info.ExtendedHeader.ConvertToV24(); descriptor.SetExtendedHeader(extendedHeader.CrcDataPresent, extendedHeader.UpdateTag, extendedHeader.RestrictionPresent, extendedHeader.Restriction); if (extendedHeader.CrcDataPresent) { descriptor.SetCrc32(extendedHeader.Crc32); } } return container; }