Expand|Select|Wrap|Line Numbers
- public Track(string Location)
- {
- if (System.IO.File.Exists(Location))
- {
- System.IO.FileStream FileStream = System.IO.File.OpenRead(Location);
- System.IO.BinaryReader ByteStream = new System.IO.BinaryReader(FileStream);
- FileStream.Seek(-128, System.IO.SeekOrigin.End);
- if (System.Text.Encoding.Default.GetString(ByteStream.ReadBytes(3)) == "TAG")
- {
- this.Title = System.Text.Encoding.Default.GetString(ByteStream.ReadBytes(30)).Trim();
- this.Artist = System.Text.Encoding.Default.GetString(ByteStream.ReadBytes(30)).Trim();
- this.Album = System.Text.Encoding.Default.GetString(ByteStream.ReadBytes(30)).Trim();
- this.Year = int.Parse(System.Text.Encoding.Default.GetString(ByteStream.ReadBytes(4)).Trim());
- ByteStream.BaseStream.Position = 126;
- byte[] TrackNumber = ByteStream.ReadBytes(2);
- if (TrackNumber[0] == 0 && TrackNumber[1] != 0) this.TrackNumber = TrackNumber[1];
- this.Location = Location;
- }
- FileStream.Close();
- }
- }
Secondly, the function I found for finding the track number doesn't seem to be working at all, and I'd like to know why.
And lastly, out of all of my mp3 files, only 1002 out of 1093 contain the "TAG" ID, so I'm wondering, why is that, and does anyone know a way to get the missing ones?