using System; using System.Linq; using System.Text; namespace NAudio.Utils { /// /// Chunk Identifier helpers /// public class ChunkIdentifier { /// /// Chunk identifier to Int32 (replaces mmioStringToFOURCC) /// /// four character chunk identifier /// Chunk identifier as int 32 public static int ChunkIdentifierToInt32(string s) { if (s.Length != 4) throw new ArgumentException("Must be a four character string"); var bytes = Encoding.UTF8.GetBytes(s); if (bytes.Length != 4) throw new ArgumentException("Must encode to exactly four bytes"); return BitConverter.ToInt32(bytes, 0); } } }