public void CRC32Test() { Assert.AreEqual <uint>(3791227907, ar.CRC32(0), "CRC32[0] was not set correctly."); Assert.AreEqual <uint>(0321342250, ar.CRC32(1), "CRC32[1] was not set correctly."); Assert.AreEqual <uint>(0037001035, ar.CRC32(2), "CRC32[2] was not set correctly."); Assert.AreEqual <uint>(0516255430, ar.CRC32(3), "CRC32[3] was not set correctly."); Assert.AreEqual <uint>(3791227907, ar2.CRC32(1), "CRC32[1](2) was not set correctly."); }
// The extraction has finished, the log dialog will // be shown soon, so we can return a string which will // be displayed in the log window and be written to // the log file. Anyway, you could also return just // an empty string, in that case no log output will be done! public string EndOfSession() { StringWriter sw = new StringWriter(); if (this.sequence_ok) { if (TOC.AudioLength * 588 != ar.Position) { #if DEBUG m_trace.WriteLine("Sequence broken on end of session"); #endif this.sequence_ok = false; } if (ar.Position != arTest.Position && arTest.Position > 0) { #if DEBUG m_trace.WriteLine("Sequence broken on end of session"); #endif this.sequence_ok = false; } } if (!this.sequence_ok) { #if DEBUG return(m_trace.ToString()); #else return(""); #endif } #if DEBUG sw.Write(m_trace.ToString()); #endif if (this.sequence_ok) { #if USEAR int conf = (int)ar.WorstConfidence() + 1; #else int conf = 1; #endif var form = new FormSubmitParity( ctdb, "EAC" + m_data.HostVersion + " CTDB 2.1.6", m_drivename, conf, (arTest.Position != 0 && arTest.CRC32(0) == ar.CRC32(0)) ? 100 : (arTest.Position == 0 && this.is_secure_mode) ? (int)(100 * (1.0 - Math.Log(m_suspicious + 1) / Math.Log(TOC.AudioLength + 1))) : (int)(49 * (1.0 - Math.Log(m_suspicious + 1) / Math.Log(TOC.AudioLength + 1))), m_data.AlbumArtist, m_data.AlbumTitle); form.ShowDialog(); sw.WriteLine("[CTDB TOCID: {0}] {1}", TOC.TOCID, ctdb.DBStatus ?? "found"); if (ctdb.SubStatus != null) { sw.WriteLine("Submit result: " + ctdb.SubStatus); } #if DEBUG ctdb.GenerateLog(sw, true); #else ctdb.GenerateLog(sw, false); #endif int fixConf = -1; int myConf = 0; if (ctdb.QueryExceptionStatus == WebExceptionStatus.Success) { foreach (DBEntry entry in ctdb.Entries) { if (!entry.hasErrors) { myConf += entry.conf; } else if (entry.canRecover) { fixConf = Math.Max(fixConf, entry.conf); } } } if (fixConf > myConf) { sw.WriteLine("If you are sure that your rip contains errors, you can use CUETools to repair it."); } #if USEAR ar.GenerateFullLog(sw, false, ArId); #endif } else { sw.WriteLine("Some tracks have been skipped"); } return(sw.ToString()); }