Пример #1
0
        private static void TestTagUtilsRewriteMP3()
        {
            byte[] tag20 = TagUtils.TagToRaw(TestTags.CreateDemoTag(Version.v2_3));
            byte[] tag10 = TestTags.demoTag1_0;

            string fileName = VirtualDrive.VirtualFileName("TestID3TagUtilsRewrite\\t1.mp3");

            using (Stream s = VirtualDrive.OpenOutStream(fileName))
            {
                s.Write(tag20, 0, tag20.Length);
                s.WriteByte(0);
                s.WriteByte(0);
                s.Write(TestTags.mpegDummy, 0, TestTags.mpegDummy.Length);
                s.Write(tag10, 0, tag10.Length);
            }

            long offset = TagUtils.OffsetTagToMpegHeader(new FileInfo(fileName));

            UnitTest.Test(offset == 2);

            TagUtils.StripTags(new FileInfo(fileName), 0, 0);

            UnitTest.Test(ArrayUtils.IsEqual(VirtualDrive.Load(fileName), TestTags.mpegDummy));
        }