public virtual void TestShouldConvertFrameDataWithBlankDescriptionAndLanguageToBytesAndBackToEquivalentObject() { byte[] bytes = new byte[] { 0, 0, 0, 0, 0, (byte)('A'), (byte)('B'), (byte)('C'), (byte)('D'), (byte)('E'), (byte)('F'), (byte)('G'), (byte)('H'), (byte)('I'), (byte )('J'), (byte)('K'), (byte)('L'), (byte)('M'), (byte)('N'), (byte)('O'), (byte)( 'P'), (byte)('Q') }; ID3v2CommentFrameData frameData = new ID3v2CommentFrameData(false, bytes); Assert.AreEqual("\x0\x0\x0", frameData.GetLanguage()); Assert.AreEqual(new EncodedText(string.Empty), frameData.GetDescription()); Assert.AreEqual(new EncodedText(TEST_VALUE), frameData.GetComment()); Assert.IsTrue(Arrays.Equals(bytes, frameData.ToBytes())); }
private ID3v2CommentFrameData ExtractCommentFrameData(string id, bool itunes) { ID3v2FrameSet frameSet = frameSets.Get(id); if (frameSet != null) { Iterator<ID3v2Frame> iterator = frameSet.GetFrames().Iterator(); while (iterator.HasNext()) { ID3v2Frame frame = (ID3v2Frame)iterator.Next(); ID3v2CommentFrameData frameData; try { frameData = new ID3v2CommentFrameData(UseFrameUnsynchronisation(), frame.GetData( )); if (itunes && ITUNES_COMMENT_DESCRIPTION.Equals(frameData.GetDescription().ToString ())) { return frameData; } else { if (!itunes) { return frameData; } } } catch (InvalidDataException) { } } } // Do nothing return null; }