// --------------------------------------------------------------------------- private void ReadFramesOld(String FileName, ref TagInfo Tag) { FrameHeaderOld Frame = new FrameHeaderOld(); char [] Data = new char[500]; long DataPosition; int FrameSize; int DataSize; // Get information from frames (ID3v2.2.x) try { // Set read-access, open file FileStream fs = new FileStream(FileName, FileMode.Open, FileAccess.Read); BinaryReader SourceFile = new BinaryReader(fs); fs.Seek(10, SeekOrigin.Begin); while ((fs.Position < GetTagSize(Tag)) && (fs.Position < fs.Length)) { Array.Clear(Data, 0, Data.Length); // Read frame header and check frame ID Frame.ID = SourceFile.ReadChars(3); Frame.Size = SourceFile.ReadBytes(3); if (!(Char.IsLetter(Frame.ID[0]) && Char.IsUpper(Frame.ID[0]))) { break; } // Note data position and determine significant data size DataPosition = fs.Position; FrameSize = (Frame.Size[0] << 16) + (Frame.Size[1] << 8) + Frame.Size[2]; if (FrameSize > 500) { DataSize = 500; } else { DataSize = FrameSize; } // Read frame data and set tag item if frame supported Data = SourceFile.ReadChars(DataSize); SetTagItem(new String(Frame.ID), new String(Data), ref Tag); fs.Seek(DataPosition + FrameSize, SeekOrigin.Begin); } SourceFile.Close(); fs.Close(); } catch (Exception e) { System.Console.WriteLine(e.StackTrace); } }
// --------------------------------------------------------------------------- private void ReadFramesOld(String FileName, ref TagInfo Tag) { FrameHeaderOld Frame = new FrameHeaderOld(); char [] Data = new char[500]; long DataPosition; int FrameSize; int DataSize; // Get information from frames (ID3v2.2.x) try { // Set read-access, open file FileStream fs = new FileStream(FileName, FileMode.Open, FileAccess.Read); BinaryReader SourceFile = new BinaryReader(fs); fs.Seek(10, SeekOrigin.Begin); while ( (fs.Position < GetTagSize(Tag)) && ( fs.Position < fs.Length) ) { Array.Clear(Data,0,Data.Length); // Read frame header and check frame ID Frame.ID = SourceFile.ReadChars(3); Frame.Size = SourceFile.ReadBytes(3); if ( ! ( Char.IsLetter(Frame.ID[0]) && Char.IsUpper(Frame.ID[0]) ) ) break; // Note data position and determine significant data size DataPosition = fs.Position; FrameSize = (Frame.Size[0] << 16) + (Frame.Size[1] << 8) + Frame.Size[2]; if ( FrameSize > 500 ) DataSize = 500; else DataSize = FrameSize; // Read frame data and set tag item if frame supported Data = SourceFile.ReadChars(DataSize); SetTagItem( new String(Frame.ID), new String(Data), ref Tag); fs.Seek(DataPosition + FrameSize, SeekOrigin.Begin); } SourceFile.Close(); fs.Close(); } catch (Exception e) { System.Console.WriteLine(e.StackTrace); } }