Пример #1
0
        private static void TestTagUtilsWriteTagBiggerQuantize()
        {
            string fileName = VirtualDrive.VirtualFileName("TestTagUtilsWriteTagBiggerQuantize\\t1.mp3");

            TestTags.WriteDemoMp3(fileName, TestTags.demoTag2_3);
            FileInfo fileInfo = new FileInfo(fileName);
            Tag      tag      = TagUtils.ReadTag(fileInfo);
            Frame    f        = new Frame(tag.DescriptionMap, "MCDI");

            (f.Content as FrameContentBinary).Content = new byte[1024];
            tag.Add(f);

            TagUtils.WriteTagV2(tag, fileInfo, Rewriter.Strategy.Quantize);
            UnitTest.Test(VirtualDrive.FileLength(fileName) == 2048 + TestTags.mpegDummy.Length);
            TagUtils.StripTagV2(fileInfo, 0);
            UnitTest.Test(ArrayUtils.IsEqual(VirtualDrive.Load(fileName), TestTags.mpegDummy));
        }
Пример #2
0
        private static void TestTagUtilsBuildByCodeAndSerializeInVirtualStore()
        {
            foreach (ID3.Version version in ID3.Version.Versions)
            {
                string filename = VirtualDrive.VirtualFileName(
                    "TestID3TagBuildByCodeAndSerializeInVirtualStore\\" + version.ToString() + ".tag");

                Tag tag0 = TestTags.CreateDemoTag(version);

                TagUtils.WriteTag(tag0, new FileInfo(filename));

                Tag tag1 = TagUtils.ReadTag(new FileInfo(filename));

                TagEditor editor0 = new TagEditor(tag0);
                TagEditor editor1 = new TagEditor(tag1);

                UnitTest.Test(editor1.Equals(editor0));
            }
        }
Пример #3
0
        private static void TestTagUtilsReadWrite()
        {
            int counter = 0;

            foreach (var demoTag in TestTags.Demotags)
            {
                FileInfo fileInfo = VirtualDrive.CreateVirtualFileInfo(
                    "TestTagUtilsReadWrite\\" + counter + ".tag");

                TagUtils.WriteTag(demoTag, fileInfo);

                Tag tag0 = TagUtils.ReadTag(fileInfo);

                UnitTest.Test(TestTags.IsDemoTag(new TagEditor(tag0)));

                TagUtils.WriteTag(tag0, fileInfo);

                UnitTest.Test(ArrayUtils.IsEqual(TagUtils.ReadTagRaw(fileInfo), demoTag));

                counter++;
            }
        }