コード例 #1
0
ファイル: ID3v2Frame.cs プロジェクト: felixwatts/PodPuppy
        /// <summary>
        /// Writes the header for this frame to a stream.
        /// </summary>
        /// <param name="stream">The stream to write to.</param>
        /// <param name="version">The ID3v2 version to use in writing the frame.</param>
        protected void WriteHeaderToStream(Stream stream, ID3Versions version)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            if ((version & ID3Versions.V2) == ID3Versions.V2)
            {
                string frameIDString = FrameRegistry.GetFrameId(this.frameType, version);
                if (frameIDString == null)
                {
                    throw new UnsupportedVersionException(version);
                }

                EncodedString frameID = new EncodedString(TextEncodingType.ISO_8859_1, frameIDString);
                frameID.IsTerminated             = false;
                frameID.HasEncodingTypePrepended = false;
                frameID.WriteToStream(stream);
                WriteFrameSize(stream, version);
                WriteFlags(stream, version);
                stream.Flush();
            }
            else
            {
                throw new UnsupportedVersionException(version);
            }
        }
コード例 #2
0
ファイル: ID3v2Frame.cs プロジェクト: felixwatts/PodPuppy
 /// <summary>
 /// Returns the frame ID for the given FrameType and version.
 /// </summary>
 /// <param name="frameType">The FrameType to look up.</param>
 /// <param name="version">The ID3v2 version to use.</param>
 /// <returns>The frame ID for the given FrameType and version.</returns>
 public static string GetFrameId(FrameType frameType, ID3Versions version)
 {
     return(FrameRegistry.GetFrameId(frameType, version));
 }