I didn't touch .NET for several months, because my current work is not connected to it. But recently I wanted to make small program for myself, reading TAG from MP3 file.
Well, I spent some time figuring out how to do it properly. My final approach at this point looks like this.
System.IO.Stream stream is parameter
byte[] buffer = new byte[30];
System.Text.Encoding enc = System.Text.Encoding.GetEncoding(0);
if (!enc.IsSingleByte)
enc = System.Text.Encoding.ASCII;
stream.Read(buffer, 0, 30);
title = enc.GetString(buffer).TrimEnd('\0');
No comments:
Post a Comment