public static ID3v1 FromStream(Stream stream) { if (stream == null) { throw new ArgumentNullException("stream"); } if (!stream.CanRead) { throw new ArgumentException("stream is not readable"); } long?pos = null; if (stream.CanSeek) { pos = stream.Position; stream.Position = stream.Length - 128; } ID3v1 tag = null; BinaryReader reader = new BinaryReader(stream); if (reader.ReadByte() == 0x54 && reader.ReadByte() == 0x41 && reader.ReadByte() == 0x47) { tag = new ID3v1(stream); } if (pos != null) { stream.Position = pos.Value; } return(tag); }
public static ID3v1 FromStream(Stream stream) { if (stream == null) throw new ArgumentNullException("stream"); if (!stream.CanRead) throw new ArgumentException("stream is not readable"); long? pos = null; if (stream.CanSeek) { pos = stream.Position; stream.Position = stream.Length - 128; } ID3v1 tag = null; BinaryReader reader = new BinaryReader(stream); if (reader.ReadByte() == 0x54 && reader.ReadByte() == 0x41 && reader.ReadByte() == 0x47) { tag = new ID3v1(stream); } if (pos != null) stream.Position = pos.Value; return tag; }