/// <summary>
        ///     Retrieves the frame ID from the specified frame instance.
        /// </summary>
        /// <param name="frame">The frame instance.</param>
        /// <returns>The frame ID, or null if there is no frame handler for the specified frame instance.</returns>
        internal string GetFrameIdFromFrame(Id3Frame frame)
        {
            if (frame is UnknownFrame unknownFrame)
            {
                return(unknownFrame.Id);
            }

            Type frameType = frame.GetType();

            FrameHandler handler = FrameHandlers[frameType];

            return(handler?.FrameId);
        }
        internal string GetFrameIdFromFrame(Id3Frame frame)
        {
            var unknownFrame = frame as UnknownFrame;

            if (unknownFrame != null)
            {
                return(unknownFrame.Id);
            }

            Type frameType = frame.GetType();

            FrameHandler handler = FrameHandlers[frameType];

            return(handler != null ? handler.FrameId : null);
        }
Exemple #3
0
        void ISerializationSurrogate.GetObjectData(object obj, SerializationInfo info, StreamingContext context)
        {
            var tag = (Id3Tag)obj;

            info.AddValue("MajorVersion", tag.MajorVersion);
            info.AddValue("MinorVersion", tag.MinorVersion);

            int frameCount = tag.Frames.Count;

            info.AddValue("FrameCount", frameCount);
            for (int i = 0; i < frameCount; i++)
            {
                Id3Frame frame = tag.Frames[i];
                info.AddValue("Frame" + i + "Type", frame.GetType().AssemblyQualifiedName);
                info.AddValue("Frame" + i, frame);
            }
        }