private static MusicMatchDataOffsets ReadDataOffsets(StreamBuffer sb) { if (sb == null) throw new ArgumentNullException("sb"); return new MusicMatchDataOffsets { ImageExtensionOffset = sb.ReadInt32(), ImageBinaryOffset = sb.ReadInt32(), UnusedOffset = sb.ReadInt32(), VersionInfoOffset = sb.ReadInt32(), AudioMetaDataOffset = sb.ReadInt32() }; }
////------------------------------------------------------------------------------------------------------------------------------ private bool ReadStream(StreamBuffer sb) { if (sb == null) throw new ArgumentNullException("sb"); int length = sb.ReadInt32(); Vendor = sb.ReadString(length); length = sb.ReadInt32(); int commentsRead = 0; _comments.Clear(); while ((commentsRead < length) && (sb.Position <= sb.Length)) { _comments.Add(VorbisComment.ReadStream(sb)); commentsRead++; } return true; }
private static void ReadAudioMetaFields(StreamBuffer sb, MusicMatchTag tag) { if (sb == null) throw new ArgumentNullException("sb"); // Single-line text fields tag.SongTitle = ReadTextField(sb); tag.AlbumTitle = ReadTextField(sb); tag.ArtistName = ReadTextField(sb); tag.Genre = ReadTextField(sb); tag.Tempo = ReadTextField(sb); tag.Mood = ReadTextField(sb); tag.Situation = ReadTextField(sb); tag.Preference = ReadTextField(sb); // Non-text fields tag.SongDuration = ReadTextField(sb); tag.CreationDate = DateTime.FromOADate(sb.ReadDouble()); tag.PlayCounter = sb.ReadInt32(); tag.OriginalFilename = ReadTextField(sb); tag.SerialNumber = ReadTextField(sb); tag.TrackNumber = sb.ReadInt16(); // Multi-line text fields tag.Notes = ReadTextField(sb); tag.ArtistBio = ReadTextField(sb); tag.Lyrics = ReadTextField(sb); // Internet addresses tag.ArtistUrl = ReadTextField(sb); tag.BuyCdUrl = ReadTextField(sb); tag.ArtistEmail = ReadTextField(sb); }
public void ReadInt32Test() { const int Value = 0x12345678; const int Expected = 0x12345678; StreamBuffer target = new StreamBuffer(BitConverter.GetBytes(Value)) { Position = 0 }; int actual = target.ReadInt32(); Assert.AreEqual(Expected, actual); }