Beispiel #1
0
        public void UnitLogEac_Bad1()
        {
            var dName1 = @"Targets\Rips\Tester - 2000 - FLAC Silence Bad1\";
            var fName1 = dName1 + "Tester - 2000 - FLAC Silence Bad1.log";

            LogEacFormat.Model logModel;
            LogEacFormat       log;

            using (Stream fs = new FileStream(fName1, FileMode.Open))
            {
                var hdr = new byte[0x28];
                fs.Read(hdr, 0, hdr.Length);
                logModel = LogEacFormat.CreateModel(fs, hdr, fName1);
                log      = logModel.Data;
            }

            Assert.AreEqual(3, log.Tracks.Items.Count);

            for (var ix = 0; ix < log.Tracks.Items.Count; ++ix)
            {
                LogEacTrack track = log.Tracks.Items[ix];

                Assert.AreEqual(ix + 1, track.Number);
                Assert.IsTrue(track.HasOk);
                Assert.AreEqual(track.TestCRC, track.CopyCRC);
            }

            var flacs  = new List <FlacFormat>();
            var dInfo1 = new DirectoryInfo(dName1);

            FileInfo[] flacInfos = dInfo1.GetFiles("*.flac");
            foreach (var flacInfo in flacInfos)
            {
                using (Stream fs = new FileStream(flacInfo.FullName, FileMode.Open, FileAccess.Read))
                {
                    var hdr = new byte[0x28];
                    fs.Read(hdr, 0, hdr.Length);
                    var flacModel = FlacFormat.CreateModel(fs, hdr, flacInfo.FullName);

                    Assert.IsNotNull(flacModel);
                    Assert.AreEqual(Severity.Warning, flacModel.Data.Issues.MaxSeverity);

                    flacModel.CalcHashes(Hashes.Intrinsic | Hashes.PcmCRC32, Validations.None);
                    flacs.Add(flacModel.Data);
                }
            }

            logModel.ValidateRip(flacs, checkTags: false);

            Assert.AreEqual(3, flacInfos.Length);
            Assert.AreEqual(3, flacs.Count);
            Assert.AreEqual(Severity.Error, log.Issues.MaxSeverity);
        }
Beispiel #2
0
        public void Test_LogEac_FlacRip_Bad1()
        {
            LogEacFormat.Model logModel;
            LogEacFormat       log;

            var fn = @"Targets\Rips\Tester - 2000 - FLAC Silence Bad1\Tester - 2000 - FLAC Silence Bad1.log";

            using (var fs = new FileStream(fn, FileMode.Open))
            {
                var hdr = new byte[0x28];
                fs.Read(hdr, 0, hdr.Length);
                logModel = LogEacFormat.CreateModel(fs, hdr, fn);
                log      = logModel.Data;
            }

            Assert.AreEqual(3, log.Tracks.Items.Count);

            for (var ix = 0; ix < log.Tracks.Items.Count; ++ix)
            {
                LogEacTrack track = log.Tracks.Items[ix];

                Assert.AreEqual(ix + 1, track.Number);
                Assert.IsTrue(track.HasOK);
                Assert.AreEqual(track.TestCRC, track.CopyCRC);
            }

            var dInfo     = new DirectoryInfo(baseDir + "\\Targets\\Rips\\Tester - 2000 - FLAC Silence Bad1");
            var flacInfos = dInfo.GetFiles("*.flac");

            Assert.AreEqual(3, flacInfos.Length);

            var flacMods = new List <FlacFormat.Model>();

            foreach (var flacInfo in flacInfos)
            {
                var ffs = new FileStream(flacInfo.FullName, FileMode.Open, FileAccess.Read);
                var hdr = new byte[0x28];
                ffs.Read(hdr, 0, hdr.Length);

                var flacModel = FlacFormat.CreateModel(ffs, hdr, flacInfo.FullName);
                Assert.IsNotNull(flacModel);

                Assert.IsTrue(flacModel.Data.Issues.MaxSeverity < Severity.Warning);
                flacModel.CalcHashes(Hashes.Intrinsic | Hashes.PcmCRC32, Validations.None);
                flacMods.Add(flacModel);
            }

            Assert.AreEqual(3, flacMods.Count);
            logModel.MatchFlacs(flacMods);

            Assert.IsTrue(log.Issues.MaxSeverity == Severity.Fatal);
        }
Beispiel #3
0
        public void Test_LogEac_FlacRip_OK1()
        {
            LogEacFormat.Model logModel;
            LogEacFormat       log;

            var fn = @"Targets\Rips\Tester - 2000 - FLAC Silence OK1\Tester - 2000 - FLAC Silence OK1.log";

            using (var fs = new FileStream(fn, FileMode.Open))
            {
                var hdr = new byte[0x28];
                fs.Read(hdr, 0, hdr.Length);
                logModel = LogEacFormat.CreateModel(fs, hdr, fn);
                log      = logModel.Data;
            }

            Assert.AreEqual(3, log.Tracks.Items.Count);

            for (var ix = 0; ix < log.Tracks.Items.Count; ++ix)
            {
                LogEacTrack track = log.Tracks.Items[ix];

                Assert.AreEqual(ix + 1, track.Number);
                Assert.IsTrue(track.HasOK);
                Assert.AreEqual(track.TestCRC, track.CopyCRC);
            }

            var dInfo     = new DirectoryInfo(baseDir + @"\Targets\Rips\Tester - 2000 - FLAC Silence OK1");
            var flacInfos = dInfo.GetFiles("*.flac");

            Assert.AreEqual(3, flacInfos.Length);

            var flacMods = new List <FlacFormat.Model>();

            foreach (var flacInfo in flacInfos)
            {
                var ffs = new FileStream(flacInfo.FullName, FileMode.Open, FileAccess.Read);
                var hdr = new byte[0x28];
                ffs.Read(hdr, 0, hdr.Length);

                FlacFormat.Model flacModel = FlacFormat.CreateModel(ffs, hdr, flacInfo.FullName);
                Assert.IsNotNull(flacModel);

                flacModel.CalcHashes(Hashes.Intrinsic | Hashes.PcmCRC32, Validations.None);
                flacMods.Add(flacModel);
            }

            logModel.MatchFlacs(flacMods);

            for (var ix = 0; ix < log.Tracks.Items.Count; ++ix)
            {
                var track       = log.Tracks.Items[ix];
                var flac        = track.Match;
                var trackNumTag = flac.GetTag("TRACKNUMBER");

                Assert.IsNotNull(flac);
                Assert.AreEqual(1, flac.Issues.Items.Count);
                Assert.AreEqual(Severity.Noise, flac.Issues.MaxSeverity);
                Assert.AreEqual((ix + 1).ToString(), trackNumTag);
                Assert.IsFalse(flac.IsBadHeader);
                Assert.IsFalse(flac.IsBadData);
            }

            Assert.AreEqual(0x6522DF69u, log.Tracks.Items[0].Match.ActualPcmCRC32);
            Assert.AreEqual(0x003E740Du, log.Tracks.Items[1].Match.ActualPcmCRC32);
            Assert.AreEqual(0xFAB5205Fu, log.Tracks.Items[2].Match.ActualPcmCRC32);
        }
Beispiel #4
0
        public void UnitLogEac_OK1()
        {
            var dName1 = @"Targets\Rips\Tester - 2000 - FLAC Silence OK1\";
            var fName1 = dName1 + "Tester - 2000 - FLAC Silence OK1.log";

            LogEacFormat.Model logModel;
            LogEacFormat       log;

            using (Stream fs = new FileStream(fName1, FileMode.Open))
            {
                var hdr = new byte[0x28];
                fs.Read(hdr, 0, hdr.Length);
                logModel = LogEacFormat.CreateModel(fs, hdr, fName1);
                log      = logModel.Data;
            }

            Assert.AreEqual(3, log.Tracks.Items.Count);

            for (var ix = 0; ix < log.Tracks.Items.Count; ++ix)
            {
                LogEacTrack track = log.Tracks.Items[ix];

                Assert.AreEqual(ix + 1, track.Number);
                Assert.IsTrue(track.HasOk);
                Assert.AreEqual(track.TestCRC, track.CopyCRC);
            }

            var dInfo     = new DirectoryInfo(dName1);
            var flacInfos = dInfo.GetFiles("*.flac");

            Assert.AreEqual(3, flacInfos.Length);

            var flacs = new List <FlacFormat>();

            foreach (var flacInfo in flacInfos)
            {
                Stream fs  = new FileStream(flacInfo.FullName, FileMode.Open, FileAccess.Read);
                var    hdr = new byte[0x28];
                fs.Read(hdr, 0, hdr.Length);

                FlacFormat.Model flacModel = FlacFormat.CreateModel(fs, hdr, flacInfo.FullName);
                Assert.IsNotNull(flacModel);

                flacModel.CalcHashes(Hashes.Intrinsic | Hashes.PcmCRC32, Validations.None);
                flacs.Add(flacModel.Data);
            }

            logModel.ValidateRip(flacs, checkTags: true);

            for (var ix = 0; ix < log.Tracks.Items.Count; ++ix)
            {
                var track = log.Tracks.Items[ix];
                var flac  = track.Match as FlacFormat;

                Assert.IsNotNull(flac, "Assure flac.exe in PATH.");

                var trackNumTag = flac.GetTagValue("TRACKNUMBER");

                Assert.AreEqual(1, flac.Issues.Items.Count);
                Assert.AreEqual(Severity.Noise, flac.Issues.MaxSeverity);
                Assert.AreEqual((ix + 1).ToString(), trackNumTag);
                Assert.IsFalse(flac.IsBadHeader);
                Assert.IsFalse(flac.IsBadData);
            }

            Assert.AreEqual(0x6522DF69u, ((FlacFormat)log.Tracks.Items[0].Match).ActualPcmCRC32);
            Assert.AreEqual(0x003E740Du, ((FlacFormat)log.Tracks.Items[1].Match).ActualPcmCRC32);
            Assert.AreEqual(0xFAB5205Fu, ((FlacFormat)log.Tracks.Items[2].Match).ActualPcmCRC32);
        }