Ejemplo n.º 1
0
 public virtual void TestShouldReadValid32WFrame()
 {
     byte[] bytes = BufferTools.StringToByteBuffer(W_FRAME + "xxxxx", 0, W_FRAME.Length);
     TestHelper.ReplaceNumbersWithBytes(bytes, 0);
     ID3v2Frame frame = new ID3v2Frame(bytes, 0);
     Assert.AreEqual(43, frame.GetLength());
     Assert.AreEqual("WXXX", frame.GetId());
     string s = "00ABCDEFGHIJKLMNOPQRSTUVWXYZABCDE";
     byte[] expectedBytes = BufferTools.StringToByteBuffer(s, 0, s.Length);
     TestHelper.ReplaceNumbersWithBytes(expectedBytes, 0);
     Assert.IsTrue(Arrays.Equals(expectedBytes, frame.GetData()));
 }
Ejemplo n.º 2
0
 public virtual void TestShouldPackAndUnpackHeaderToGiveEquivalentObject()
 {
     byte[] bytes = new byte[26];
     for (int i = 0; i < bytes.Length; i++)
     {
         bytes[i] = unchecked((byte)((byte)('A') + i));
     }
     ID3v2Frame frame = new ID3v2Frame("TEST", bytes);
     byte[] newBytes = frame.ToBytes();
     ID3v2Frame frameCopy = new ID3v2Frame(newBytes, 0);
     Assert.AreEqual("TEST", frameCopy.GetId());
     Assert.AreEqual(frame, frameCopy);
 }
Ejemplo n.º 3
0
 private void AddFrame(ID3v2Frame frame, bool replace)
 {
     ID3v2FrameSet frameSet = frameSets.Get(frame.GetId());
     if (frameSet == null)
     {
         frameSet = new ID3v2FrameSet(frame.GetId());
         frameSet.AddFrame(frame);
         frameSets.Put(frame.GetId(), frameSet);
     }
     else
     {
         if (replace)
         {
             frameSet.Clear();
             frameSet.AddFrame(frame);
         }
         else
         {
             frameSet.AddFrame(frame);
         }
     }
 }