CD parity information database

This commit is contained in:
chudov
2010-02-23 15:15:08 +00:00
parent b613227ada
commit 5b9b266de5
45 changed files with 2017 additions and 793 deletions

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{CA4D64E6-6544-4A29-8BA5-7DB08D50D072}</ProjectGuid> <ProjectGuid>{CA4D64E6-6544-4A29-8BA5-7DB08D50D072}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
@@ -19,7 +19,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>

View File

@@ -11,8 +11,9 @@ namespace CUETools.AccurateRip
{ {
public class AccurateRipVerify : IAudioDest public class AccurateRipVerify : IAudioDest
{ {
public AccurateRipVerify(CDImageLayout toc) public AccurateRipVerify(CDImageLayout toc, IWebProxy proxy)
{ {
this.proxy = proxy;
_toc = toc; _toc = toc;
_accDisks = new List<AccDisk>(); _accDisks = new List<AccDisk>();
_crc32 = new Crc32(); _crc32 = new Crc32();
@@ -302,7 +303,7 @@ namespace CUETools.AccurateRip
/// <param name="count"></param> /// <param name="count"></param>
/// <param name="currentOffset"></param> /// <param name="currentOffset"></param>
/// <param name="offs"></param> /// <param name="offs"></param>
public unsafe void CalculateCRCs(int* pSampleBuff, int count, int currentOffset, int offs) public unsafe void CalculateCRCs(uint* pSampleBuff, int count, int currentOffset, int offs)
{ {
uint crcar = _CRCAR[_currentTrack, 0]; uint crcar = _CRCAR[_currentTrack, 0];
uint crcsm = _CRCSM[_currentTrack, 0]; uint crcsm = _CRCSM[_currentTrack, 0];
@@ -322,7 +323,11 @@ namespace CUETools.AccurateRip
_CRCNL[_currentTrack, offs + i] = crcnl; _CRCNL[_currentTrack, offs + i] = crcnl;
} }
uint lo = (uint)*(pSampleBuff++); uint sample = *(pSampleBuff++);
crcsm += sample;
crcar += sample * (uint)(currentOffset + i + 1);
uint lo = sample & 0xffff;
crc32 = (crc32 >> 8) ^ t[(byte)(crc32 ^ lo)]; crc32 = (crc32 >> 8) ^ t[(byte)(crc32 ^ lo)];
crc32 = (crc32 >> 8) ^ t[(byte)(crc32 ^ (lo >> 8))]; crc32 = (crc32 >> 8) ^ t[(byte)(crc32 ^ (lo >> 8))];
if (lo != 0) if (lo != 0)
@@ -332,7 +337,7 @@ namespace CUETools.AccurateRip
} }
else crcnl++; else crcnl++;
uint hi = (uint)*(pSampleBuff++); uint hi = sample >> 16;
crc32 = (crc32 >> 8) ^ t[(byte)(crc32 ^ hi)]; crc32 = (crc32 >> 8) ^ t[(byte)(crc32 ^ hi)];
crc32 = (crc32 >> 8) ^ t[(byte)(crc32 ^ (hi >> 8))]; crc32 = (crc32 >> 8) ^ t[(byte)(crc32 ^ (hi >> 8))];
if (hi != 0) if (hi != 0)
@@ -341,10 +346,6 @@ namespace CUETools.AccurateRip
crcwn = (crcwn >> 8) ^ t[(byte)(crcwn ^ (hi >> 8))]; crcwn = (crcwn >> 8) ^ t[(byte)(crcwn ^ (hi >> 8))];
} }
else crcnl++; else crcnl++;
uint sampleValue = (lo & 0xffff) + (hi << 16);
crcsm += sampleValue;
crcar += sampleValue * (uint)(currentOffset + i + 1);
} }
} }
@@ -371,17 +372,17 @@ namespace CUETools.AccurateRip
unsafe unsafe
{ {
fixed (int* pSampleBuff = &sampleBuffer.Samples[pos, 0]) fixed (byte* pSampleBuff = &sampleBuffer.Bytes[pos * 4])
//fixed (byte* pByteBuff = &sampleBuffer.Bytes[pos * sampleBuffer.BlockAlign])
{ {
uint* samples = (uint*)pSampleBuff;
if (currentSector < 10) if (currentSector < 10)
CalculateCRCs(pSampleBuff, copyCount, currentOffset, currentOffset); CalculateCRCs(samples, copyCount, currentOffset, currentOffset);
else if (remaingSectors < 10) else if (remaingSectors < 10)
CalculateCRCs(pSampleBuff, copyCount, currentOffset, 20 * 588 - (int)_samplesRemTrack); CalculateCRCs(samples, copyCount, currentOffset, 20 * 588 - (int)_samplesRemTrack);
else if (currentSector >= 445 && currentSector <= 455) else if (currentSector >= 445 && currentSector <= 455)
CalculateCRCs(pSampleBuff, copyCount, currentOffset, 20 * 588 + currentOffset - 445 * 588); CalculateCRCs(samples, copyCount, currentOffset, 20 * 588 + currentOffset - 445 * 588);
else else
CalculateCRCs(pSampleBuff, copyCount, currentOffset, -1); CalculateCRCs(samples, copyCount, currentOffset, -1);
} }
} }
pos += copyCount; pos += copyCount;
@@ -442,6 +443,7 @@ namespace CUETools.AccurateRip
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "GET"; req.Method = "GET";
req.Proxy = proxy;
try try
{ {
@@ -896,6 +898,7 @@ namespace CUETools.AccurateRip
private uint[,] _CacheCRCWN; private uint[,] _CacheCRCWN;
private uint[,] _CacheCRC32; private uint[,] _CacheCRC32;
private uint[] _CRCLOG; private uint[] _CRCLOG;
private IWebProxy proxy;
Crc32 _crc32; Crc32 _crc32;

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{5802C7E9-157E-4124-946D-70B5AE48A5A1}</ProjectGuid> <ProjectGuid>{5802C7E9-157E-4124-946D-70B5AE48A5A1}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
@@ -19,7 +19,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1DD41038-D885-46C5-8DDE-E0B82F066584}</ProjectGuid> <ProjectGuid>{1DD41038-D885-46C5-8DDE-E0B82F066584}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
@@ -19,7 +19,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>

View File

@@ -29,7 +29,7 @@ namespace CUETools.CDRepair
galois = Galois16.instance; galois = Galois16.instance;
rs = new RsDecode16(npar, galois); rs = new RsDecode16(npar, galois);
crc32 = new Crc32(); crc32 = new Crc32();
crc = 0xffffffff; //crc = 0xffffffff;
encodeGx = galois.makeEncodeGxLog(npar); encodeGx = galois.makeEncodeGxLog(npar);
laststride = stride + (finalSampleCount * 2) % stride; laststride = stride + (finalSampleCount * 2) % stride;
stridecount = (finalSampleCount * 2) / stride - 2; // minus one for leadin and one for leadout stridecount = (finalSampleCount * 2) / stride - 2; // minus one for leadin and one for leadout
@@ -97,11 +97,19 @@ namespace CUETools.CDRepair
get { throw new Exception("unsupported"); } get { throw new Exception("unsupported"); }
} }
public int NPAR
{
get
{
return npar;
}
}
public uint CRC public uint CRC
{ {
get get
{ {
return crc ^ 0xffffffff; return crc32.Combine(0xffffffff, crc, stride * 2 * stridecount) ^ 0xffffffff;
} }
} }
} }
@@ -113,19 +121,14 @@ namespace CUETools.CDRepair
protected ushort[] leadin; protected ushort[] leadin;
protected ushort[] leadout; protected ushort[] leadout;
protected bool verify; protected bool verify;
protected bool hasErrors = false, canRecover = true; protected bool encode;
protected int actualOffset = 0; protected uint crcA, crcB;
internal int[,] sigma; public CDRepairEncode(int finalSampleCount, int stride, int npar, bool verify, bool encode)
internal int[,] omega;
internal int[,] errpos;
internal int[,] erroff;
internal int[] errors;
public CDRepairEncode(int finalSampleCount, int stride, int npar, bool verify)
: base (finalSampleCount, stride, npar) : base (finalSampleCount, stride, npar)
{ {
this.verify = verify; this.verify = verify;
this.encode = encode;
parity = new byte[stride * npar * 2]; parity = new byte[stride * npar * 2];
if (verify) if (verify)
{ {
@@ -136,105 +139,21 @@ namespace CUETools.CDRepair
syndrome = new ushort[1, npar]; syndrome = new ushort[1, npar];
} }
new public unsafe void Write(AudioBuffer sampleBuffer) private unsafe void ProcessStride(int currentStride, int currentPart, int count, ushort* data)
{ {
sampleBuffer.Prepare(this); fixed (uint* crct = crc32.table)
fixed (byte* bpar = parity)
if ((sampleBuffer.ByteLength & 1) != 0)
throw new Exception("never happens");
int firstPos = Math.Max(0, stride - sampleCount * 2);
int lastPos = Math.Min(sampleBuffer.ByteLength >> 1, (finalSampleCount - sampleCount) * 2 - laststride);
fixed (byte* bytes = sampleBuffer.Bytes, par = parity)
fixed (int* gx = encodeGx)
fixed (uint* t = crc32.table)
fixed (ushort* exp = galois.ExpTbl, log = galois.LogTbl, synptr = syndrome) fixed (ushort* exp = galois.ExpTbl, log = galois.LogTbl, synptr = syndrome)
fixed (int* gx = encodeGx)
for (int pos = 0; pos < count; pos++)
{ {
ushort* data = (ushort*)bytes; ushort* par = (ushort*)bpar;
int part = currentPart + pos;
if (verify)
for (int pos = 0; pos < (sampleBuffer.ByteLength >> 1); pos++)
{
ushort dd = data[pos];
if (sampleCount * 2 + pos < 2 * stride)
leadin[sampleCount * 2 + pos] = dd;
int remaining = (finalSampleCount - sampleCount) * 2 - pos - 1;
if (remaining < stride + laststride)
leadout[remaining] = dd;
}
if (npar == 8)
{
for (int pos = firstPos; pos < lastPos; pos++)
{
int part = (sampleCount * 2 + pos) % stride;
ushort* wr = ((ushort*)par) + part * 8;
ushort dd = data[pos];
crc = (crc >> 8) ^ t[(byte)(crc ^ dd)];
crc = (crc >> 8) ^ t[(byte)(crc ^ (dd >> 8))];
int ib = wr[0] ^ dd;
if (ib != 0)
{
ushort* myexp = exp + log[ib];
wr[0] = (ushort)(wr[1] ^ myexp[19483]);
wr[1] = (ushort)(wr[2] ^ myexp[41576]);
wr[2] = (ushort)(wr[3] ^ myexp[9460]);
wr[3] = (ushort)(wr[4] ^ myexp[52075]);
wr[4] = (ushort)(wr[5] ^ myexp[9467]);
wr[5] = (ushort)(wr[6] ^ myexp[41590]);
wr[6] = (ushort)(wr[7] ^ myexp[19504]);
wr[7] = myexp[28];
}
else
{
wr[0] = wr[1];
wr[1] = wr[2];
wr[2] = wr[3];
wr[3] = wr[4];
wr[4] = wr[5];
wr[5] = wr[6];
wr[6] = wr[7];
wr[7] = 0;
}
// syn[i] += data[pos] * α^(pos*i)
if (verify && dd != 0)
{
ushort* syn = synptr + part * 8;
ushort* myexp = exp + log[dd];
int offs = stridecount - (sampleCount * 2 + pos) / stride;
syn[0] ^= dd;
syn[1] ^= myexp[offs];
syn[2] ^= myexp[(offs * 2) % 65535];
syn[3] ^= myexp[(offs * 3) % 65535];
syn[4] ^= myexp[(offs * 4) % 65535];
syn[5] ^= myexp[(offs * 5) % 65535];
syn[6] ^= myexp[(offs * 6) % 65535];
syn[7] ^= myexp[(offs * 7) % 65535];
//ushort logdd = log[dd];
//syn[1] ^= exp[(logdd + offs) % 65535];
//syn[2] ^= exp[(logdd + offs * 2) % 65535];
//syn[3] ^= exp[(logdd + offs * 3) % 65535];
//syn[4] ^= exp[(logdd + offs * 4) % 65535];
//syn[5] ^= exp[(logdd + offs * 5) % 65535];
//syn[6] ^= exp[(logdd + offs * 6) % 65535];
//syn[7] ^= exp[(logdd + offs * 7) % 65535];
}
}
}
else
{
for (int pos = firstPos; pos < lastPos; pos++)
{
int part = (sampleCount * 2 + pos) % stride;
ushort* wr = ((ushort*)par) + part * npar; ushort* wr = ((ushort*)par) + part * npar;
ushort dd = data[pos]; ushort dd = data[pos];
crc = (crc >> 8) ^ t[(byte)(crc ^ dd)]; crc = (crc >> 8) ^ crct[(byte)(crc ^ dd)];
crc = (crc >> 8) ^ t[(byte)(crc ^ (dd >> 8))]; crc = (crc >> 8) ^ crct[(byte)(crc ^ (dd >> 8))];
if (verify) if (verify)
{ {
@@ -260,41 +179,270 @@ namespace CUETools.CDRepair
} }
} }
} }
private unsafe void ProcessStride8(int currentStride, int currentPart, int count, ushort* data)
{
fixed (uint* crct = crc32.table)
fixed (byte* bpar = parity)
fixed (ushort* exp = galois.ExpTbl, log = galois.LogTbl, synptr = syndrome)
for (int pos = 0; pos < count; pos++)
{
ushort* par = (ushort*)bpar;
int part = currentPart + pos;
ushort* wr = par + part * 8;
ushort dd = data[pos];
crc = (crc >> 8) ^ crct[(byte)(crc ^ dd)];
crc = (crc >> 8) ^ crct[(byte)(crc ^ (dd >> 8))];
if (encode)
{
int ib = wr[0] ^ dd;
if (ib != 0)
{
ushort* myexp = exp + log[ib];
wr[0] = (ushort)(wr[1] ^ myexp[19483]);
wr[1] = (ushort)(wr[2] ^ myexp[41576]);
wr[2] = (ushort)(wr[3] ^ myexp[9460]);
wr[3] = (ushort)(wr[4] ^ myexp[52075]);
wr[4] = (ushort)(wr[5] ^ myexp[9467]);
wr[5] = (ushort)(wr[6] ^ myexp[41590]);
wr[6] = (ushort)(wr[7] ^ myexp[19504]);
wr[7] = myexp[28];
}
else
{
wr[0] = wr[1];
wr[1] = wr[2];
wr[2] = wr[3];
wr[3] = wr[4];
wr[4] = wr[5];
wr[5] = wr[6];
wr[6] = wr[7];
wr[7] = 0;
} }
sampleCount += sampleBuffer.Length;
} }
public unsafe bool VerifyParity(byte[] parity2) // syn[i] += data[pos] * α^(n*i)
if (verify && dd != 0)
{ {
return VerifyParity(parity2, 0, parity2.Length); int n = stridecount - currentStride;
ushort* syn = synptr + part * 8;
syn[0] ^= dd;
int idx = log[dd];
idx += n; syn[1] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[2] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[3] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[4] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[5] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[6] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[7] ^= exp[(idx & 0xffff) + (idx >> 16)];
}
}
} }
public unsafe bool VerifyParity(byte[] parity2, int pos, int len) private unsafe void ProcessStride16(int currentStride, int currentPart, int count, ushort* data)
{ {
fixed (uint* crct = crc32.table)
fixed (byte* bpar = parity)
fixed (ushort* exp = galois.ExpTbl, log = galois.LogTbl, synptr = syndrome)
for (int pos = 0; pos < count; pos++)
{
ushort* par = (ushort*)bpar;
int part = currentPart + pos;
ushort* wr = par + part * 16;
ushort dd = data[pos];
crc = (crc >> 8) ^ crct[(byte)(crc ^ dd)];
crc = (crc >> 8) ^ crct[(byte)(crc ^ (dd >> 8))];
int ib = wr[0] ^ dd;
if (ib != 0)
{
ushort* myexp = exp + log[ib];
wr[0] = (ushort)(wr[1] ^ myexp[0x000059f1]);
wr[1] = (ushort)(wr[2] ^ myexp[0x0000608f]);
wr[2] = (ushort)(wr[3] ^ myexp[0x0000918b]);
wr[3] = (ushort)(wr[4] ^ myexp[0x00004487]);
wr[4] = (ushort)(wr[5] ^ myexp[0x0000a151]);
wr[5] = (ushort)(wr[6] ^ myexp[0x0000c074]);
wr[6] = (ushort)(wr[7] ^ myexp[0x00004178]);
wr[7] = (ushort)(wr[8] ^ myexp[0x00004730]);
wr[8] = (ushort)(wr[9] ^ myexp[0x00004187]);
wr[9] = (ushort)(wr[10] ^ myexp[0x0000c092]);
wr[10] = (ushort)(wr[11] ^ myexp[0x0000a17e]);
wr[11] = (ushort)(wr[12] ^ myexp[0x000044c3]);
wr[12] = (ushort)(wr[13] ^ myexp[0x000091d6]);
wr[13] = (ushort)(wr[14] ^ myexp[0x000060e9]);
wr[14] = (ushort)(wr[15] ^ myexp[0x00005a5a]);
wr[15] = myexp[0x00000078];
}
else
{
wr[0] = wr[1];
wr[1] = wr[2];
wr[2] = wr[3];
wr[3] = wr[4];
wr[4] = wr[5];
wr[5] = wr[6];
wr[6] = wr[7];
wr[7] = wr[8];
wr[8] = wr[9];
wr[9] = wr[10];
wr[10] = wr[11];
wr[11] = wr[12];
wr[12] = wr[13];
wr[13] = wr[14];
wr[14] = wr[15];
wr[15] = 0;
}
// syn[i] += data[pos] * α^(n*i)
if (verify && dd != 0)
{
int n = stridecount - currentStride;
ushort* syn = synptr + part * 16;
syn[0] ^= dd;
int idx = log[dd];
idx += n; syn[1] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[2] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[3] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[4] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[5] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[6] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[7] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[8] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[9] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[10] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[11] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[12] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[13] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[14] ^= exp[(idx & 0xffff) + (idx >> 16)];
idx += n; syn[15] ^= exp[(idx & 0xffff) + (idx >> 16)];
}
}
}
new public unsafe void Write(AudioBuffer sampleBuffer)
{
sampleBuffer.Prepare(this);
if ((sampleBuffer.ByteLength & 1) != 0)
throw new Exception("never happens");
fixed (byte* bytes = sampleBuffer.Bytes)
{
int offs = 0;
while (offs < sampleBuffer.Length)
{
int currentPart = (sampleCount * 2) % stride;
int currentStride = (sampleCount * 2) / stride;
// Process no more than there is in the buffer, and no more than up to a stride boundary.
int copyCount = Math.Min((sampleBuffer.Length - offs) * 2, stride - currentPart);
ushort* data = ((ushort*)bytes) + offs * 2;
if (verify)
{
// remember CRC after leadin
if (sampleCount * 2 == stride * 2)
crcA = crc;
// remember CRC before leadout
if ((finalSampleCount - sampleCount) * 2 == stride + laststride)
crcB = crc;
if (currentStride < 2)
for (int pos = 0; pos < copyCount; pos++)
leadin[sampleCount * 2 + pos] = data[pos];
if (currentStride >= stridecount)
for (int pos = 0; pos < copyCount; pos++)
{
int remaining = (finalSampleCount - sampleCount) * 2 - pos - 1;
if (remaining < stride + laststride)
leadout[remaining] = data[pos];
}
}
if (currentStride >= 1 && currentStride <= stridecount)
{
if (npar == 8)
ProcessStride8(currentStride, currentPart, copyCount, data);
else if (npar == 16)
ProcessStride16(currentStride, currentPart, copyCount, data);
else
ProcessStride(currentStride, currentPart, copyCount, data);
}
sampleCount += copyCount >> 1;
offs += copyCount >> 1;
}
}
}
public unsafe CDRepairFix VerifyParity(byte[] parity2, int actualOffset)
{
return VerifyParity(npar, parity2, 0, parity2.Length, actualOffset);
}
private unsafe uint OffsettedCRC(int actualOffset)
{
fixed (uint* crct = crc32.table)
{
// calculate leadin CRC
uint crc0 = 0;
for (int off = stride - 2 * actualOffset; off < 2 * stride; off++)
{
ushort dd = leadin[off];
crc0 = (crc0 >> 8) ^ crct[(byte)(crc0 ^ dd)];
crc0 = (crc0 >> 8) ^ crct[(byte)(crc0 ^ (dd >> 8))];
}
// calculate leadout CRC
uint crc2 = 0;
for (int off = laststride + stride - 1; off >= laststride + 2 * actualOffset; off--)
{
ushort dd = leadout[off];
crc2 = (crc2 >> 8) ^ crct[(byte)(crc2 ^ dd)];
crc2 = (crc2 >> 8) ^ crct[(byte)(crc2 ^ (dd >> 8))];
}
// calculate middle CRC
uint crc1 = crc32.Combine(crcA, crcB, (stridecount - 2) * stride * 2);
// calculate offsettedCRC as sum of 0xffffffff, crc0, crc1, crc2;
return crc32.Combine(
0xffffffff,
crc32.Combine(
crc32.Combine(
crc0,
crc1,
(stridecount - 2) * stride * 2),
crc2,
(stride - 2 * actualOffset) * 2),
stridecount * stride * 2) ^ 0xffffffff;
}
}
public unsafe bool FindOffset(int npar2, byte[] parity2, int pos, uint expectedCRC, out int actualOffset, out bool hasErrors)
{
if (npar2 != npar)
throw new Exception("npar mismatch");
if (!verify) if (!verify)
throw new Exception("verify was not enabled"); throw new Exception("verify was not enabled");
if (sampleCount != finalSampleCount) if (sampleCount != finalSampleCount)
throw new Exception("sampleCount != finalSampleCount"); throw new Exception("sampleCount != finalSampleCount");
if (len != stride * npar * 2)
throw new Exception("wrong size");
sigma = new int[stride, npar / 2 + 2];
omega = new int[stride, npar / 2 + 1];
errpos = new int[stride, npar / 2];
erroff = new int[stride, npar / 2];
errors = new int[stride];
actualOffset = 0;
// find offset // find offset
fixed (byte* par2ptr = &parity2[pos]) fixed (byte* par2ptr = &parity2[pos])
{ {
ushort* par2 = (ushort*)par2ptr; ushort* par2 = (ushort*)par2ptr;
int* syn = stackalloc int[npar];
int* _sigma = stackalloc int[npar]; int* _sigma = stackalloc int[npar];
int* _omega = stackalloc int[npar];
int* _errpos = stackalloc int[npar]; int* _errpos = stackalloc int[npar];
int bestErrors = npar; bool foundOffset = false;
for (int allowed_errors = 0; allowed_errors < npar / 2 && !foundOffset; allowed_errors++)
{
int part2 = 0;
ushort* wr = par2 + part2 * npar;
// We can only use offset if Abs(offset * 2) < stride, // We can only use offset if Abs(offset * 2) < stride,
// else we might need to add/remove more than one sample // else we might need to add/remove more than one sample
@@ -303,57 +451,69 @@ namespace CUETools.CDRepair
for (int offset = 1 - stride / 2; offset < stride / 2; offset++) for (int offset = 1 - stride / 2; offset < stride / 2; offset++)
{ {
int err = 0; int err = 0;
int part = (part2 + stride - offset * 2) % stride;
int* syn = stackalloc int[npar];
for (int i = 0; i < npar; i++) for (int i = 0; i < npar; i++)
{ {
int part = (stride - 1) % stride; int synI = syndrome[part, i];
int part2 = (part + offset * 2 + stride) % stride;
ushort* wr = par2 + part2 * npar;
syn[i] = syndrome[part, i];
// offset < 0 // offset < 0
if (part < -offset * 2) if (part < -offset * 2)
{ {
syn[i] ^= galois.mulExp(leadin[stride + part], (i * (stridecount - 1)) % galois.Max); synI ^= galois.mulExp(leadin[stride + part], (i * (stridecount - 1)) % galois.Max);
syn[i] = leadout[laststride - part - 1] ^ galois.mulExp(syn[i], i); synI = leadout[laststride - part - 1] ^ galois.mulExp(synI, i);
} }
// offset > 0 // offset > 0
if (part >= stride - offset * 2) if (part >= stride - offset * 2)
{ {
syn[i] = galois.divExp(syn[i] ^ leadout[laststride + stride - part - 1], i); synI = galois.divExp(synI ^ leadout[laststride + stride - part - 1], i);
syn[i] ^= galois.mulExp(leadin[part], (i * (stridecount - 1)) % galois.Max); synI ^= galois.mulExp(leadin[part], (i * (stridecount - 1)) % galois.Max);
} }
for (int j = 0; j < npar; j++) for (int j = 0; j < npar; j++)
syn[i] = wr[j] ^ galois.mulExp(syn[i], i); synI = wr[j] ^ galois.mulExp(synI, i);
err |= syn[i]; syn[i] = synI;
err |= synI;
} }
if (err == 0) int err_count = err == 0 ? 0 : rs.calcSigmaMBM(_sigma, syn);
if (err_count == allowed_errors && (err_count == 0 || rs.chienSearch(_errpos, stridecount + npar, err_count, _sigma)))
{ {
actualOffset = offset; actualOffset = offset;
bestErrors = 0; hasErrors = err_count != 0 || OffsettedCRC(offset) != expectedCRC;
break; return true;
}
int err_count = rs.calcSigmaMBM(_sigma, _omega, syn);
if (err_count > 0 && rs.chienSearch(_errpos, stridecount + npar, err_count, _sigma))
{
if (err_count < bestErrors)
{
actualOffset = offset;
bestErrors = err_count;
} }
} }
} }
} }
actualOffset = 0;
hasErrors = true;
return false;
}
public unsafe CDRepairFix VerifyParity(int npar2, byte[] parity2, int pos, int len, int actualOffset)
{
if (len != stride * npar * 2)
throw new Exception("wrong size");
CDRepairFix fix = new CDRepairFix(this);
fix.actualOffset = actualOffset;
fix.correctableErrors = 0;
fix.hasErrors = false;
fix.canRecover = true;
fix.sigma = new int[stride, npar / 2 + 2];
fix.omega = new int[stride, npar / 2 + 1];
fix.errpos = new int[stride, npar / 2];
fix.erroff = new int[stride, npar / 2];
fix.errors = new int[stride];
hasErrors = false;
fixed (byte* par = &parity2[pos]) fixed (byte* par = &parity2[pos])
fixed (ushort* exp = galois.ExpTbl, log = galois.LogTbl) fixed (ushort* exp = galois.ExpTbl, log = galois.LogTbl)
{ {
int* syn = stackalloc int[npar]; int* syn = stackalloc int[npar];
int offset = actualOffset; int offset = fix.actualOffset;
for (int part = 0; part < stride; part++) for (int part = 0; part < stride; part++)
{ {
@@ -400,25 +560,27 @@ namespace CUETools.CDRepair
if (err != 0) if (err != 0)
{ {
hasErrors = true; fixed (int* s = &fix.sigma[part, 0], o = &fix.omega[part, 0], e = &fix.errpos[part, 0], f = &fix.erroff[part, 0])
fixed (int* s = &sigma[part, 0], o = &omega[part, 0], e = &errpos[part, 0], f = &erroff[part, 0])
{ {
errors[part] = rs.calcSigmaMBM(s, o, syn); fix.errors[part] = rs.calcSigmaMBM(s, syn);
if (errors[part] <= 0 || !rs.chienSearch(e, stridecount + npar, errors[part], s)) fix.hasErrors = true;
canRecover = false; fix.correctableErrors += fix.errors[part];
if (fix.errors[part] <= 0 || !rs.chienSearch(e, stridecount + npar, fix.errors[part], s))
fix.canRecover = false;
else else
{ {
for (int i = 0; i < errors[part]; i++) galois.mulPoly(o, s, syn, npar / 2 + 1, npar, npar);
for (int i = 0; i < fix.errors[part]; i++)
f[i] = galois.toPos(stridecount + npar, e[i]); f[i] = galois.toPos(stridecount + npar, e[i]);
} }
} }
} }
else else
errors[part] = 0; fix.errors[part] = 0;
} }
} }
return !hasErrors; return fix;
} }
public byte[] Parity public byte[] Parity
@@ -428,6 +590,55 @@ namespace CUETools.CDRepair
return parity; return parity;
} }
} }
}
public class CDRepairFix : CDRepair
{
internal bool hasErrors = false, canRecover = true;
internal int actualOffset = 0;
internal int correctableErrors = 0;
internal int[,] sigma;
internal int[,] omega;
internal int[,] errpos;
internal int[,] erroff;
internal int[] errors;
public CDRepairFix(CDRepairEncode decode)
: base(decode)
{
}
new public unsafe void Write(AudioBuffer sampleBuffer)
{
sampleBuffer.Prepare(this);
if ((sampleBuffer.ByteLength & 1) != 0)
throw new Exception("never happens");
int firstPos = Math.Max(0, stride - sampleCount * 2 - ActualOffset * 2);
int lastPos = Math.Min(sampleBuffer.ByteLength >> 1, (finalSampleCount - sampleCount) * 2 - laststride - ActualOffset * 2);
fixed (byte* bytes = sampleBuffer.Bytes)
fixed (uint* t = crc32.table)
{
ushort* data = (ushort*)bytes;
for (int pos = firstPos; pos < lastPos; pos++)
{
int part = (sampleCount * 2 + pos) % stride;
int nerrors = errors[part];
fixed (int* s = &sigma[part, 0], o = &omega[part, 0], f = &erroff[part, 0])
for (int i = 0; i < nerrors; i++)
if (f[i] == (sampleCount * 2 + ActualOffset * 2 + pos) / stride - 1)
data[pos] ^= (ushort)rs.doForney(nerrors, errpos[part, i], s, o);
ushort dd = data[pos];
crc = (crc >> 8) ^ t[(byte)(crc ^ dd)];
crc = (crc >> 8) ^ t[(byte)(crc ^ (dd >> 8))];
}
}
sampleCount += sampleBuffer.Length;
}
public bool HasErrors public bool HasErrors
{ {
@@ -445,6 +656,14 @@ namespace CUETools.CDRepair
} }
} }
public int CorrectableErrors
{
get
{
return correctableErrors;
}
}
public int ActualOffset public int ActualOffset
{ {
get get
@@ -453,47 +672,4 @@ namespace CUETools.CDRepair
} }
} }
} }
public class CDRepairFix : CDRepair
{
CDRepairEncode decode;
public CDRepairFix(CDRepairEncode decode)
: base(decode)
{
this.decode = decode;
}
new public unsafe void Write(AudioBuffer sampleBuffer)
{
sampleBuffer.Prepare(this);
if ((sampleBuffer.ByteLength & 1) != 0)
throw new Exception("never happens");
int firstPos = Math.Max(0, stride - sampleCount * 2 - decode.ActualOffset * 2);
int lastPos = Math.Min(sampleBuffer.ByteLength >> 1, (finalSampleCount - sampleCount) * 2 - laststride - decode.ActualOffset * 2);
fixed (byte* bytes = sampleBuffer.Bytes)
fixed (uint* t = crc32.table)
{
ushort* data = (ushort*)bytes;
for (int pos = firstPos; pos < lastPos; pos++)
{
int part = (sampleCount * 2 + pos) % stride;
int errors = decode.errors[part];
fixed (int* s = &decode.sigma[part, 0], o = &decode.omega[part, 0], f = &decode.erroff[part, 0])
for (int i = 0; i < errors; i++)
if (f[i] == (sampleCount * 2 + decode.ActualOffset * 2 + pos) / stride - 1)
data[pos] ^= (ushort)rs.doForney(errors, decode.errpos[part, i], s, o);
ushort dd = data[pos];
crc = (crc >> 8) ^ t[(byte)(crc ^ dd)];
crc = (crc >> 8) ^ t[(byte)(crc ^ (dd >> 8))];
}
}
sampleCount += sampleBuffer.Length;
}
}
} }

View File

@@ -34,6 +34,7 @@
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Management" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Management;
using System.Net; using System.Net;
using System.Text; using System.Text;
using CUETools.CDImage; using CUETools.CDImage;
@@ -17,17 +18,22 @@ namespace CUETools.CTDB
private CDImageLayout toc; private CDImageLayout toc;
private HttpStatusCode accResult; private HttpStatusCode accResult;
private string id; private string id;
private string subResult;
private byte[] contents; private byte[] contents;
private int pos; private int pos;
private int length; private int length;
private int confidence;
private int total; private int total;
List<DBEntry> entries = new List<DBEntry>(); List<DBEntry> entries = new List<DBEntry>();
DBEntry selectedEntry;
IWebProxy proxy;
HttpUploadHelper uploadHelper;
public CUEToolsDB(CDImageLayout toc) public CUEToolsDB(CDImageLayout toc, IWebProxy proxy)
{ {
this.toc = toc; this.toc = toc;
this.length = (int)toc.AudioLength * 588; this.length = (int)toc.AudioLength * 588;
this.proxy = proxy;
this.uploadHelper = new HttpUploadHelper();
} }
public void ContactDB(string id) public void ContactDB(string id)
@@ -51,7 +57,7 @@ namespace CUETools.CTDB
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "GET"; req.Method = "GET";
req.Proxy = WebRequest.GetSystemWebProxy(); req.Proxy = proxy;
try try
{ {
@@ -76,6 +82,8 @@ namespace CUETools.CTDB
} }
} }
Parse(); Parse();
if (entries.Count == 0)
accResult = HttpStatusCode.NoContent;
} }
catch (WebException ex) catch (WebException ex)
{ {
@@ -86,22 +94,23 @@ namespace CUETools.CTDB
} }
} }
/// <summary> static string cpuInfo = null;
/// Database entry format:
/// 'CTDB' version(0x00000100) size public static string GetCPUID()
/// 'HEAD' version(0x00000100) size disc-count total-submissions {
/// 'DISC' version(0x00000100) size if (cpuInfo == null)
/// 'TOC ' version(0x00000100) size track-count preGap {
/// 'TRAK' ersion(0x00000100) size flags(1==isAudio) length(frames) ManagementClass mc = new ManagementClass("win32_processor");
/// .... track-count foreach (ManagementObject mo in mc.GetInstances())
/// 'ARDB' version(0x00000100) size pressings-count {
/// 'ARCD' version(0x00000100) size CRC1 ... CRCN //Get only the first CPU's ID
/// .... pressings-count cpuInfo = mo.Properties["processorID"].Value.ToString();
/// 'PAR8' version(0x00000100) size parity-data break;
/// 'CONF' version(0x00000100) size confidence }
/// 'CRC ' version(0x00000100) size CRC32 min-offset max-offset ... }
/// .... disc-count return cpuInfo ?? "unknown";
/// </summary> }
public string Submit(int confidence, int total) public string Submit(int confidence, int total)
{ {
if (id == null) if (id == null)
@@ -120,75 +129,72 @@ namespace CUETools.CTDB
UploadFile[] files = new UploadFile[1]; UploadFile[] files = new UploadFile[1];
MemoryStream newcontents = new MemoryStream(); MemoryStream newcontents = new MemoryStream();
using (DBHDR CTDB = new DBHDR(newcontents, "CTDB", 0x100)) using (DBHDR FTYP = new DBHDR(newcontents, "ftyp"))
FTYP.Write("CTDB");
using (DBHDR CTDB = new DBHDR(newcontents, "CTDB"))
{ {
using (DBHDR HEAD = new DBHDR(newcontents, "HEAD", 0x100)) using (DBHDR HEAD = CTDB.HDR("HEAD"))
{ {
DBHDR.WriteInt(newcontents, 1); // disc count HEAD.Write(0x100); // version
DBHDR.WriteInt(newcontents, total); HEAD.Write(1); // disc count
HEAD.Write(total); // total submissions
HEAD.Write(DateTime.Now); // date
} }
using (DBHDR DISC = new DBHDR(newcontents, "DISC", 0x100)) using (DBHDR DISC = CTDB.HDR("DISC"))
{ {
using (DBHDR TOC = new DBHDR(newcontents, "TOC ", 0x100)) using (DBHDR TOC = DISC.HDR("TOC "))
{ {
DBHDR.WriteInt(newcontents, toc.TrackCount); using (DBHDR INFO = TOC.HDR("INFO"))
DBHDR.WriteInt(newcontents, toc.Pregap); {
INFO.Write(toc.TrackCount);
INFO.Write(toc.Pregap);
}
for (int i = 1; i <= toc.TrackCount; i++) for (int i = 1; i <= toc.TrackCount; i++)
using (DBHDR TRAK = new DBHDR(newcontents, "TRAK", 0x100)) using (DBHDR TRAK = TOC.HDR("TRAK"))
{ {
DBHDR.WriteInt(newcontents, toc[i].IsAudio ? 1 : 0); TRAK.Write(toc[i].IsAudio ? 1 : 0);
DBHDR.WriteInt(newcontents, toc[i].Length); TRAK.Write(toc[i].Length);
} }
} }
using (DBHDR PAR8 = new DBHDR(newcontents, "CONF", 0x100)) using (DBHDR USER = DISC.HDR("USER")) USER.Write(GetCPUID());
{ using (DBHDR TOOL = DISC.HDR("TOOL")) TOOL.Write("CUETools 205");
DBHDR.WriteInt(newcontents, confidence); using (DBHDR DATE = DISC.HDR("DATE")) DATE.Write(DateTime.Now);
} using (DBHDR CONF = DISC.HDR("CONF")) CONF.Write(confidence);
using (DBHDR PAR8 = new DBHDR(newcontents, "CRC ", 0x100)) using (DBHDR NPAR = DISC.HDR("NPAR")) NPAR.Write(verify.NPAR);
{ using (DBHDR CRC_ = DISC.HDR("CRC ")) CRC_.Write(verify.CRC);
DBHDR.WriteInt(newcontents, verify.CRC); using (DBHDR PAR_ = DISC.HDR("PAR ")) PAR_.Write(verify.Parity);
}
using (DBHDR PAR8 = new DBHDR(newcontents, "PAR8", 0x100))
{
newcontents.Write(verify.Parity, 0, verify.Parity.Length);
}
} }
} }
newcontents.Position = 0; newcontents.Position = 0;
files[0] = new UploadFile(newcontents, "uploadedfile", "data.bin", "image/binary"); files[0] = new UploadFile(newcontents, "uploadedfile", "data.bin", "image/binary");
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://db.cuetools.net/uploader.php"); HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://db.cuetools.net/uploader.php");
req.Proxy = WebRequest.GetSystemWebProxy(); req.Proxy = proxy;
req.UserAgent = "CUETools 205";
NameValueCollection form = new NameValueCollection(); NameValueCollection form = new NameValueCollection();
form.Add("id", String.Format("{0:d3}-{1:x8}-{2:x8}-{3:x8}", toc.AudioTracks, discId1, discId2, cddbDiscId)); form.Add("id", String.Format("{0:d3}-{1:x8}-{2:x8}-{3:x8}", toc.AudioTracks, discId1, discId2, cddbDiscId));
HttpWebResponse resp = HttpUploadHelper.Upload(req, files, form); HttpWebResponse resp = uploadHelper.Upload(req, files, form);
string errtext;
using (Stream s = resp.GetResponseStream()) using (Stream s = resp.GetResponseStream())
using (StreamReader sr = new StreamReader(s)) using (StreamReader sr = new StreamReader(s))
{ subResult = sr.ReadToEnd();
errtext = sr.ReadToEnd(); return subResult;
}
return errtext;
} }
private string ReadHDR(out int end) private string ReadHDR(out int end)
{ {
int size = ReadInt();
string res = Encoding.ASCII.GetString(contents, pos, 4); string res = Encoding.ASCII.GetString(contents, pos, 4);
pos += 4; pos += 4;
int version = ReadInt(); end = pos + size - 8;
if (version >= 0x200)
throw new Exception("unsupported CTDB version");
int size = ReadInt();
end = pos + size;
return res; return res;
} }
private int ReadInt() private int ReadInt()
{ {
int value = int value =
(contents[pos] + (contents[pos + 3] +
(contents[pos + 1] << 8) + (contents[pos + 2] << 8) +
(contents[pos + 2] << 16) + (contents[pos + 1] << 16) +
(contents[pos + 3] << 24)); (contents[pos + 0] << 24));
pos += 4; pos += 4;
return value; return value;
} }
@@ -196,10 +202,10 @@ namespace CUETools.CTDB
private uint ReadUInt() private uint ReadUInt()
{ {
uint value = uint value =
((uint)contents[pos] + ((uint)contents[pos + 3] +
((uint)contents[pos + 1] << 8) + ((uint)contents[pos + 2] << 8) +
((uint)contents[pos + 2] << 16) + ((uint)contents[pos + 1] << 16) +
((uint)contents[pos + 3] << 24)); ((uint)contents[pos + 0] << 24));
pos += 4; pos += 4;
return value; return value;
} }
@@ -212,12 +218,21 @@ namespace CUETools.CTDB
pos = 0; pos = 0;
int end; int end;
string hdr = ReadHDR(out end); string hdr = ReadHDR(out end);
if (hdr != "CTDB") throw new Exception("invalid CTDB file"); uint magic = ReadUInt();
if (end != contents.Length) throw new Exception("incomplete CTDB file"); if (hdr != "ftyp" || magic != 0x43544442 || end != pos)
throw new Exception("invalid CTDB file");
hdr = ReadHDR(out end); hdr = ReadHDR(out end);
if (hdr != "HEAD") throw new Exception("invalid CTDB file"); if (hdr != "CTDB" || end != contents.Length)
throw new Exception("invalid CTDB file");
hdr = ReadHDR(out end);
if (hdr != "HEAD")
throw new Exception("invalid CTDB file");
uint version = ReadUInt();
int discCount = ReadInt(); int discCount = ReadInt();
total = ReadInt(); total = ReadInt();
if (discCount <= 0 || version >= 0x200)
throw new Exception("invalid CTDB file");
// date
pos = end; pos = end;
while (pos < contents.Length) while (pos < contents.Length)
{ {
@@ -229,11 +244,11 @@ namespace CUETools.CTDB
} }
int endDisc = end; int endDisc = end;
uint crc = 0; uint crc = 0;
int parPos = 0, parLen = 0, conf = 0; int parPos = 0, parLen = 0, conf = 0, npar = 0;
while (pos < endDisc) while (pos < endDisc)
{ {
hdr = ReadHDR(out end); hdr = ReadHDR(out end);
if (hdr == "PAR8") if (hdr == "PAR ")
{ {
parPos = pos; parPos = pos;
parLen = end - pos; parLen = end - pos;
@@ -242,10 +257,13 @@ namespace CUETools.CTDB
crc = ReadUInt(); crc = ReadUInt();
else if (hdr == "CONF") else if (hdr == "CONF")
conf = ReadInt(); conf = ReadInt();
else if (hdr == "NPAR")
npar = ReadInt();
pos = end; pos = end;
} }
if (parPos != 0) if (parPos != 0 && npar >= 2 && npar <= 16 && conf >= 0)
entries.Add(new DBEntry(parPos, parLen, conf, crc)); //if (parPos != 0 && npar >= 2 && npar <= 16 && conf != 0)
entries.Add(new DBEntry(parPos, parLen, conf, npar, crc));
} }
} }
@@ -253,16 +271,22 @@ namespace CUETools.CTDB
{ {
foreach (DBEntry entry in entries) foreach (DBEntry entry in entries)
{ {
verify.VerifyParity(contents, entry.pos, entry.len); if (!verify.FindOffset(entry.npar, contents, entry.pos, entry.crc, out entry.offset, out entry.hasErrors))
if (!verify.HasErrors || verify.CanRecover) entry.canRecover = false;
confidence = entry.conf; else if (entry.hasErrors)
break; {
entry.repair = verify.VerifyParity(entry.npar, contents, entry.pos, entry.len, entry.offset);
entry.canRecover = entry.repair.CanRecover;
}
} }
} }
public void Init() public void Init(bool encode)
{ {
verify = new CDRepairEncode(length, 10 * 588 * 2, 8, accResult == HttpStatusCode.OK); int npar = 8;
foreach (DBEntry entry in entries)
npar = Math.Max(npar, entry.npar);
verify = new CDRepairEncode(length, 10 * 588 * 2, npar, entries.Count > 0, encode);
} }
public int Total public int Total
@@ -299,35 +323,95 @@ namespace CUETools.CTDB
} }
} }
public DBEntry SelectedEntry
{
set
{
selectedEntry = value;
}
get
{
return selectedEntry;
}
}
public string Status public string Status
{ {
get get
{ {
//sw.WriteLine("CUETools DB CRC: {0:x8}", Verify.CRC); //sw.WriteLine("CUETools DB CRC: {0:x8}", Verify.CRC);
string res = null;
if (DBStatus != null) if (DBStatus != null)
return DBStatus; res = DBStatus;
if (!verify.HasErrors) else
return string.Format("verified OK, confidence {0}/{1}", confidence, total); {
if (verify.CanRecover) DBEntry popular = null;
return string.Format("contains correctable errors, confidence {0}/{1}", confidence, total); foreach (DBEntry entry in entries)
return "could not be verified"; if (!entry.hasErrors || entry.canRecover)
if (popular == null || entry.conf > popular.conf)
popular = entry;
if (popular != null)
res = popular.Status;
foreach (DBEntry entry in entries)
if (entry != popular && (!entry.hasErrors || entry.canRecover))
res += ", or " + entry.Status;
if (res == null)
res = "could not be verified";
}
if (subResult != null)
res += ", " + subResult;
return res;
}
}
public IEnumerable<DBEntry> Entries
{
get
{
return entries;
}
}
public HttpUploadHelper UploadHelper
{
get
{
return uploadHelper;
} }
} }
} }
internal class DBEntry public class DBEntry
{ {
public int pos; public int pos;
public int len; public int len;
public int conf; public int conf;
public int npar;
public int offset;
public uint crc; public uint crc;
public bool hasErrors;
public bool canRecover;
public CDRepairFix repair;
public DBEntry(int pos, int len, int conf, uint crc) public DBEntry(int pos, int len, int conf, int npar, uint crc)
{ {
this.pos = pos; this.pos = pos;
this.len = len; this.len = len;
this.conf = conf; this.conf = conf;
this.crc = crc; this.crc = crc;
this.npar = npar;
}
public string Status
{
get
{
if (!hasErrors)
return string.Format("verified OK, confidence {0}", conf);
if (canRecover)
return string.Format("contains {1} correctable errors, confidence {0}", conf, repair.CorrectableErrors);
return "could not be verified";
}
} }
} }
@@ -336,41 +420,74 @@ namespace CUETools.CTDB
private long lenOffs; private long lenOffs;
private MemoryStream stream; private MemoryStream stream;
public DBHDR(MemoryStream stream, string name, int version) public DBHDR(MemoryStream stream, string name)
{ {
this.stream = stream; this.stream = stream;
stream.Write(Encoding.ASCII.GetBytes(name), 0, 4);
WriteInt(stream, version);
lenOffs = stream.Position; lenOffs = stream.Position;
WriteInt(stream, 0); Write(0);
Write(name);
} }
public void Dispose() public void Dispose()
{ {
long fin = stream.Position; long fin = stream.Position;
stream.Position = lenOffs; stream.Position = lenOffs;
WriteInt(stream, (int)(fin - lenOffs - 4)); Write((int)(fin - lenOffs));
stream.Position = fin; stream.Position = fin;
} }
public static void WriteInt(MemoryStream stream, int value) public void Write(int value)
{ {
byte[] temp = new byte[4]; byte[] temp = new byte[4];
temp[0] = (byte)(value & 0xff); temp[3] = (byte)(value & 0xff);
temp[1] = (byte)((value >> 8) & 0xff); temp[2] = (byte)((value >> 8) & 0xff);
temp[2] = (byte)((value >> 16) & 0xff); temp[1] = (byte)((value >> 16) & 0xff);
temp[3] = (byte)((value >> 24) & 0xff); temp[0] = (byte)((value >> 24) & 0xff);
stream.Write(temp, 0, 4); Write(temp);
} }
public static void WriteInt(MemoryStream stream, uint value) public void Write(uint value)
{ {
byte[] temp = new byte[4]; byte[] temp = new byte[4];
temp[0] = (byte)(value & 0xff); temp[3] = (byte)(value & 0xff);
temp[1] = (byte)((value >> 8) & 0xff); temp[2] = (byte)((value >> 8) & 0xff);
temp[2] = (byte)((value >> 16) & 0xff); temp[1] = (byte)((value >> 16) & 0xff);
temp[3] = (byte)((value >> 24) & 0xff); temp[0] = (byte)((value >> 24) & 0xff);
stream.Write(temp, 0, 4); Write(temp);
}
public void Write(long value)
{
byte[] temp = new byte[8];
temp[7] = (byte)((value) & 0xff);
temp[6] = (byte)((value >> 8) & 0xff);
temp[5] = (byte)((value >> 16) & 0xff);
temp[4] = (byte)((value >> 24) & 0xff);
temp[3] = (byte)((value >> 32) & 0xff);
temp[2] = (byte)((value >> 40) & 0xff);
temp[1] = (byte)((value >> 48) & 0xff);
temp[0] = (byte)((value >> 56) & 0xff);
Write(temp);
}
public void Write(string value)
{
Write(Encoding.UTF8.GetBytes(value));
}
public void Write(DateTime value)
{
Write(value.ToFileTimeUtc());
}
public void Write(byte[] value)
{
stream.Write(value, 0, value.Length);
}
public DBHDR HDR(string name)
{
return new DBHDR(stream, name);
} }
} }
} }

View File

@@ -15,10 +15,12 @@ namespace Krystalware.UploadHelper
{ {
public class HttpUploadHelper public class HttpUploadHelper
{ {
private HttpUploadHelper() public EventHandler<UploadProgressEventArgs> onProgress;
public HttpUploadHelper()
{ } { }
public static string Upload(string url, UploadFile[] files, NameValueCollection form) public string Upload(string url, UploadFile[] files, NameValueCollection form)
{ {
HttpWebResponse resp = Upload((HttpWebRequest)WebRequest.Create(url), files, form); HttpWebResponse resp = Upload((HttpWebRequest)WebRequest.Create(url), files, form);
@@ -29,7 +31,7 @@ namespace Krystalware.UploadHelper
} }
} }
public static HttpWebResponse Upload(HttpWebRequest req, UploadFile[] files, NameValueCollection form) public HttpWebResponse Upload(HttpWebRequest req, UploadFile[] files, NameValueCollection form)
{ {
List<MimePart> mimeParts = new List<MimePart>(); List<MimePart> mimeParts = new List<MimePart>();
@@ -84,16 +86,25 @@ namespace Krystalware.UploadHelper
using (Stream s = req.GetRequestStream()) using (Stream s = req.GetRequestStream())
{ {
long pos = 0;
foreach (MimePart part in mimeParts) foreach (MimePart part in mimeParts)
{ {
s.Write(part.Header, 0, part.Header.Length); s.Write(part.Header, 0, part.Header.Length);
pos += part.Header.Length;
while ((read = part.Data.Read(buffer, 0, buffer.Length)) > 0) while ((read = part.Data.Read(buffer, 0, buffer.Length)) > 0)
{
if (onProgress != null)
onProgress(part,
new UploadProgressEventArgs(req.RequestUri.AbsoluteUri, ((double)pos)/contentLength));
s.Write(buffer, 0, read); s.Write(buffer, 0, read);
pos += read;
}
part.Data.Dispose(); part.Data.Dispose();
s.Write(afterFile, 0, afterFile.Length); s.Write(afterFile, 0, afterFile.Length);
pos += afterFile.Length;
} }
s.Write(_footer, 0, _footer.Length); s.Write(_footer, 0, _footer.Length);
@@ -111,4 +122,16 @@ namespace Krystalware.UploadHelper
} }
} }
} }
public class UploadProgressEventArgs: EventArgs
{
public string uri;
public double percent;
public UploadProgressEventArgs(string uri, double percent)
{
this.uri = uri;
this.percent = percent;
}
}
} }

View File

@@ -43,6 +43,61 @@ function filesize_h($size, $dec = 1)
return round($size, $dec) . ' ' . $sizes[$i]; return round($size, $dec) . ' ' . $sizes[$i];
} }
function BigEndian2Int($byte_word, $signed = false) {
$int_value = 0;
$byte_wordlen = strlen($byte_word);
for ($i = 0; $i < $byte_wordlen; $i++) {
$int_value += ord($byte_word{$i}) * pow(256, ($byte_wordlen - 1 - $i));
}
if ($signed) {
$sign_mask_bit = 0x80 << (8 * ($byte_wordlen - 1));
if ($int_value & $sign_mask_bit) {
$int_value = 0 - ($int_value & ($sign_mask_bit - 1));
}
}
return $int_value;
}
function get_chunk_offset($fp, $offset, $filelen, $names, $namepos)
{
// echo $offset, ":", $filelen, ":", $names, ":", $namepos, ":", count($names), "<br>";
if ($namepos >= count($names))
return $offset;
while ($offset < $filelen) {
fseek($fp, $offset, SEEK_SET);
$atom_header = fread($fp, 8);
$atom_size = BigEndian2Int(substr($atom_header, 0, 4));
$atom_name = substr($atom_header, 4, 4);
// echo $atom_size, ":", $atom_name, ":", $names[$namepos], '<br>';
if ($names[$namepos] == $atom_name)
return get_chunk_offset($fp, $offset + 8, $filelen, $names, $namepos + 1);
$offset += $atom_size;
}
return -1;
}
function chunk_offset($fp, $offset, $filelen, $path)
{
$names = explode(".", $path);
return get_chunk_offset($fp, $offset, $filelen, $names, 0);
}
function read_chunk($fp, $offset, $filelen, $path, $len)
{
$offset = chunk_offset($fp, $offset, $filelen, $path);
if ($offset < 0) return;
fseek($fp, $offset, SEEK_SET);
return fread($fp, $len);
}
function read_int($fp, $offset, $filelen, $path)
{
return BigEndian2Int(read_chunk($fp, $offset, $filelen, $path, 4));
}
$file = $_FILES['uploadedfile']; $file = $_FILES['uploadedfile'];
@@ -61,17 +116,43 @@ $file = $_FILES['uploadedfile'];
echo "Error ", $file['error']; echo "Error ", $file['error'];
} }
//if ($_SERVER['HTTP_USER_AGENT'] != "CUETools 205") {
// echo "user agent ", $_SERVER['HTTP_USER_AGENT'], " is not allowed";
// return;
//}
$tmpname = $file['tmp_name'];
$size = (@file_exists($tmpname)) ? filesize($tmpname) : 0;
if ($size == 0) {
echo "no file uploaded";
return;
}
$fp = fopen($tmpname, 'rb');
$head = read_chunk($fp, 0, $size, 'CTDB.HEAD', 20);
$npar = read_int($fp, 0, $size, 'CTDB.DISC.NPAR');
$version = BigEndian2Int(substr($head,0,4));
$disccount = BigEndian2Int(substr($head,4,4));
$total = BigEndian2Int(substr($head,8,4));
printf("npar=%d, disccount=%d, total=%d,", $npar, $disccount, $total);
fclose($fp);
$id = $_POST['id']; $id = $_POST['id'];
$err = sscanf($id, "%d-%x-%x-%x", $tracks, $id1, $id2, $cddbid); $err = sscanf($id, "%03d-%04x%04x-%04x%04x-%04x%04x", $tracks, $id1a, $id1b, $id2a, $id2b, $cddbida, $cddbidb);
$target_path = sprintf("parity/%x/%x/%x", $id1 & 15, ($id1 >> 4) & 15, ($id1 >> 8) & 15); $parsedid = sprintf("%03d-%04x%04x-%04x%04x-%04x%04x", $tracks, $id1a, $id1b, $id2a, $id2b, $cddbida, $cddbidb);
$target_file = sprintf("%s/dBCT-%03d-%08x-%08x-%08x.bin", $target_path, $tracks, $id1, $id2, $cddbid); if ($id != $parsedid) {
echo "bad id ", $id;
return;
}
$target_path = sprintf("parity/%x/%x/%x", $id1b & 15, ($id1b >> 4) & 15, ($id1b >> 8) & 15);
$target_file = sprintf("%s/dBCT-%s.bin", $target_path, $parsedid);
@mkdir($target_path, 0777, true); @mkdir($target_path, 0777, true);
if(move_uploaded_file($file['tmp_name'], $target_file)) { if(move_uploaded_file($file['tmp_name'], $target_file)) {
echo "The file ". $target_file. " has been uploaded"; printf("%s has been uploaded", $parsedid);
} else{ } else{
echo "There was an error uploading the file, please try again!"; echo "there was an error uploading the file, please try again!";
} }
?> ?>

View File

@@ -268,7 +268,7 @@ namespace CUETools { namespace Codecs { namespace FLAC {
_sampleOffset += _bufferLength; _sampleOffset += _bufferLength;
} }
Int32 copyCount = Math::Min(samplesNeeded, SamplesInBuffer); Int32 copyCount = Math::Min(samplesNeeded, SamplesInBuffer);
Array::Copy(_sampleBuffer, _bufferOffset * pcm->ChannelCount, buff->Samples, buffOffset * pcm->ChannelCount, copyCount * pcm->ChannelCount); Array::Copy(_sampleBuffer->Bytes, _bufferOffset * pcm->BlockAlign, buff->Bytes, buffOffset * pcm->BlockAlign, copyCount * pcm->BlockAlign);
samplesNeeded -= copyCount; samplesNeeded -= copyCount;
buffOffset += copyCount; buffOffset += copyCount;
_bufferOffset += copyCount; _bufferOffset += copyCount;
@@ -288,7 +288,7 @@ namespace CUETools { namespace Codecs { namespace FLAC {
FLAC__StreamDecoder *_decoder; FLAC__StreamDecoder *_decoder;
Int64 _sampleCount, _sampleOffset; Int64 _sampleCount, _sampleOffset;
AudioPCMConfig^ pcm; AudioPCMConfig^ pcm;
array<Int32, 2>^ _sampleBuffer; AudioBuffer^ _sampleBuffer;
array<unsigned char>^ _readBuffer; array<unsigned char>^ _readBuffer;
String^ _path; String^ _path;
bool _decoderActive; bool _decoderActive;
@@ -318,13 +318,21 @@ namespace CUETools { namespace Codecs { namespace FLAC {
throw gcnew Exception("Format changes within a file are not allowed."); throw gcnew Exception("Format changes within a file are not allowed.");
} }
if ((_sampleBuffer == nullptr) || (_sampleBuffer->GetLength(0) < sampleCount)) { if (_bufferOffset != 0)
_sampleBuffer = gcnew array<Int32, 2>(sampleCount, pcm->ChannelCount); throw gcnew Exception("Internal buffer error.");
}
if (_sampleBuffer == nullptr || _sampleBuffer->Size < sampleCount)
_sampleBuffer = gcnew AudioBuffer(pcm, sampleCount);
_sampleBuffer->Length = sampleCount;
if (pcm->ChannelCount == 2)
_sampleBuffer->Interlace(0, (int*)buffer[0], (int*)buffer[1], sampleCount);
else
{
int _channelCount = pcm->ChannelCount; int _channelCount = pcm->ChannelCount;
for (Int32 iChan = 0; iChan < _channelCount; iChan++) { for (Int32 iChan = 0; iChan < _channelCount; iChan++)
interior_ptr<Int32> pMyBuffer = &_sampleBuffer[0, iChan]; {
interior_ptr<Int32> pMyBuffer = &_sampleBuffer->Samples[0, iChan];
const FLAC__int32 *pFLACBuffer = buffer[iChan]; const FLAC__int32 *pFLACBuffer = buffer[iChan];
const FLAC__int32 *pFLACBufferEnd = pFLACBuffer + sampleCount; const FLAC__int32 *pFLACBufferEnd = pFLACBuffer + sampleCount;
@@ -334,7 +342,7 @@ namespace CUETools { namespace Codecs { namespace FLAC {
pFLACBuffer++; pFLACBuffer++;
} }
} }
}
_bufferLength = sampleCount; _bufferLength = sampleCount;
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
} }

View File

@@ -211,17 +211,17 @@ namespace CUETools.Codecs.FLAKE
} }
} }
unsafe void interlace(int [,] buff, int offset, int count) unsafe void interlace(AudioBuffer buff, int offset, int count)
{ {
if (PCM.ChannelCount == 2) if (PCM.ChannelCount == 2)
{ {
fixed (int* res = &buff[offset, 0], src = &samplesBuffer[_samplesBufferOffset]) fixed (int* src = &samplesBuffer[_samplesBufferOffset])
AudioSamples.Interlace(res, src, src + Flake.MAX_BLOCKSIZE, count); buff.Interlace(offset, src, src + Flake.MAX_BLOCKSIZE, count);
} }
else else
{ {
for (int ch = 0; ch < PCM.ChannelCount; ch++) for (int ch = 0; ch < PCM.ChannelCount; ch++)
fixed (int* res = &buff[offset, ch], src = &samplesBuffer[_samplesBufferOffset + ch * Flake.MAX_BLOCKSIZE]) fixed (int* res = &buff.Samples[offset, ch], src = &samplesBuffer[_samplesBufferOffset + ch * Flake.MAX_BLOCKSIZE])
{ {
int* psrc = src; int* psrc = src;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
@@ -241,7 +241,7 @@ namespace CUETools.Codecs.FLAKE
{ {
if (_samplesInBuffer > 0) if (_samplesInBuffer > 0)
{ {
interlace(buff.Samples, offset, _samplesInBuffer); interlace(buff, offset, _samplesInBuffer);
sampleCount -= _samplesInBuffer; sampleCount -= _samplesInBuffer;
offset += _samplesInBuffer; offset += _samplesInBuffer;
_samplesInBuffer = 0; _samplesInBuffer = 0;
@@ -261,7 +261,7 @@ namespace CUETools.Codecs.FLAKE
_sampleOffset += _samplesInBuffer; _sampleOffset += _samplesInBuffer;
} }
interlace(buff.Samples, offset, sampleCount); interlace(buff, offset, sampleCount);
_samplesInBuffer -= sampleCount; _samplesInBuffer -= sampleCount;
_samplesBufferOffset += sampleCount; _samplesBufferOffset += sampleCount;
if (_samplesInBuffer == 0) if (_samplesInBuffer == 0)

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6458A13A-30EF-45A9-9D58-E5031B17BEE2}</ProjectGuid> <ProjectGuid>{6458A13A-30EF-45A9-9D58-E5031B17BEE2}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
@@ -19,7 +19,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>

View File

@@ -300,6 +300,8 @@ namespace CUETools.Codecs
samples = _samples; samples = _samples;
dataInSamples = true; dataInSamples = true;
dataInBytes = false; dataInBytes = false;
if (length > size)
throw new Exception("Invalid length");
} }
public void Prepare(byte[] _bytes, int _length) public void Prepare(byte[] _bytes, int _length)
@@ -309,6 +311,8 @@ namespace CUETools.Codecs
bytes = _bytes; bytes = _bytes;
dataInSamples = false; dataInSamples = false;
dataInBytes = true; dataInBytes = true;
if (length > size)
throw new Exception("Invalid length");
} }
public unsafe void Prepare(AudioBuffer _src, int _offset, int _length) public unsafe void Prepare(AudioBuffer _src, int _offset, int _length)
@@ -344,6 +348,18 @@ namespace CUETools.Codecs
buffer.dataInBytes = false; buffer.dataInBytes = false;
} }
unsafe public void Interlace(int pos, int* src1, int* src2, int n)
{
if (PCM.ChannelCount != 2 || PCM.BitsPerSample != 16)
throw new Exception("");
fixed (byte* bs = Bytes)
{
int* res = ((int*)bs) + pos;
for (int i = n; i > 0; i--)
*(res++) = (*(src1++) & 0xffff) ^ (*(src2++) << 16);
}
}
//public void Clear() //public void Clear()
//{ //{
// length = 0; // length = 0;
@@ -1517,7 +1533,6 @@ namespace CUETools.Codecs
public class UserDefinedReader : IAudioSource public class UserDefinedReader : IAudioSource
{ {
string _path, _decoder, _decoderParams; string _path, _decoder, _decoderParams;
private AudioPCMConfig pcm;
Process _decoderProcess; Process _decoderProcess;
WAVReader rdr; WAVReader rdr;
@@ -1603,7 +1618,7 @@ namespace CUETools.Codecs
get get
{ {
Initialize(); Initialize();
return pcm; return rdr.PCM;
} }
} }
@@ -1651,7 +1666,7 @@ namespace CUETools.Codecs
while (_haveData && !_close) while (_haveData && !_close)
Monitor.Wait(this); Monitor.Wait(this);
if (_close) if (_close)
throw new Exception("Decompression aborted"); break;
AudioBuffer temp = _writeBuffer; AudioBuffer temp = _writeBuffer;
_writeBuffer = _readBuffer; _writeBuffer = _readBuffer;
_readBuffer = temp; _readBuffer = temp;
@@ -1659,6 +1674,7 @@ namespace CUETools.Codecs
Monitor.Pulse(this); Monitor.Pulse(this);
} }
} while (!done); } while (!done);
_source.Close();
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{14EE067E-C218-4625-9540-2361AB27C4A6}</ProjectGuid> <ProjectGuid>{14EE067E-C218-4625-9540-2361AB27C4A6}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
@@ -19,7 +19,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>

Binary file not shown.

View File

@@ -86,10 +86,12 @@ namespace CUETools.Processor
if (o == null || !(o is IAudioDest)) if (o == null || !(o is IAudioDest))
throw new Exception("Unsupported audio type: " + path + ": " + encoder.type.FullName); throw new Exception("Unsupported audio type: " + path + ": " + encoder.type.FullName);
dest = o as IAudioDest; dest = o as IAudioDest;
} else }
else
throw new Exception("Unsupported audio type: " + path); throw new Exception("Unsupported audio type: " + path);
dest.CompressionLevel = encoder.DefaultModeIndex; dest.CompressionLevel = encoder.DefaultModeIndex;
dest.FinalSampleCount = finalSampleCount; dest.FinalSampleCount = finalSampleCount;
if (encoder.type != null)
switch (encoder.type.FullName) switch (encoder.type.FullName)
{ {
case "CUETools.Codecs.ALAC.ALACWriter": case "CUETools.Codecs.ALAC.ALACWriter":

View File

@@ -34,7 +34,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>..\bin\win32\Debug\</OutputPath> <OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@@ -74,6 +74,10 @@
<Compile Include="UserDefined.cs" /> <Compile Include="UserDefined.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\CUETools.CDRepair\CUETools.CDRepair.csproj">
<Project>{C4869B37-EBB1-47BB-9406-B1209BEAB84B}</Project>
<Name>CUETools.CDRepair</Name>
</ProjectReference>
<ProjectReference Include="..\CUETools.Codecs\CUETools.Codecs.csproj"> <ProjectReference Include="..\CUETools.Codecs\CUETools.Codecs.csproj">
<Project>{6458A13A-30EF-45A9-9D58-E5031B17BEE2}</Project> <Project>{6458A13A-30EF-45A9-9D58-E5031B17BEE2}</Project>
<Name>CUETools.Codecs</Name> <Name>CUETools.Codecs</Name>
@@ -90,6 +94,10 @@
<Project>{14EE067E-C218-4625-9540-2361AB27C4A6}</Project> <Project>{14EE067E-C218-4625-9540-2361AB27C4A6}</Project>
<Name>CUETools.Compression</Name> <Name>CUETools.Compression</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\CUETools.CTDB\CUETools.CTDB.csproj">
<Project>{AA2A9A7E-45FB-4632-AD85-85B0E556F818}</Project>
<Name>CUETools.CTDB</Name>
</ProjectReference>
<ProjectReference Include="..\CUETools.Ripper\CUETools.Ripper.csproj"> <ProjectReference Include="..\CUETools.Ripper\CUETools.Ripper.csproj">
<Project>{D2700165-3E77-4B28-928D-551F5FC11954}</Project> <Project>{D2700165-3E77-4B28-928D-551F5FC11954}</Project>
<Name>CUETools.Ripper</Name> <Name>CUETools.Ripper</Name>

View File

@@ -41,6 +41,8 @@ using System.Runtime.InteropServices;
using CUETools.Codecs; using CUETools.Codecs;
using CUETools.CDImage; using CUETools.CDImage;
using CUETools.AccurateRip; using CUETools.AccurateRip;
//using CUETools.CDRepair;
using CUETools.CTDB;
using CUETools.Ripper; using CUETools.Ripper;
using CUETools.Compression; using CUETools.Compression;
using MusicBrainz; using MusicBrainz;
@@ -928,6 +930,8 @@ namespace CUETools.Processor
public int maxAlbumArtSize; public int maxAlbumArtSize;
public string arLogFilenameFormat, alArtFilenameFormat; public string arLogFilenameFormat, alArtFilenameFormat;
public CUEStyle gapsHandling; public CUEStyle gapsHandling;
public bool separateDecodingThread;
public bool useSystemProxySettings;
public bool CopyAlbumArt { get { return copyAlbumArt; } set { copyAlbumArt = value; } } public bool CopyAlbumArt { get { return copyAlbumArt; } set { copyAlbumArt = value; } }
public bool FlaCudaThreads { get { return flaCudaThreads; } set { flaCudaThreads = value; } } public bool FlaCudaThreads { get { return flaCudaThreads; } set { flaCudaThreads = value; } }
@@ -1004,6 +1008,9 @@ namespace CUETools.Processor
arLogFilenameFormat = "%filename%.accurip"; arLogFilenameFormat = "%filename%.accurip";
alArtFilenameFormat = "folder.jpg"; alArtFilenameFormat = "folder.jpg";
separateDecodingThread = true;
useSystemProxySettings = true;
gapsHandling = CUEStyle.GapsAppended; gapsHandling = CUEStyle.GapsAppended;
language = Thread.CurrentThread.CurrentUICulture.Name; language = Thread.CurrentThread.CurrentUICulture.Name;
@@ -1090,6 +1097,29 @@ if (tracksMatch * 100 < processor.Config.encodeWhenPercent * processor.TrackCoun
processor.Action = CUEAction.Encode; processor.Action = CUEAction.Encode;
return processor.Go(); return processor.Go();
")); "));
scripts.Add("repair", new CUEToolsScript("repair", true,
new CUEAction[] { CUEAction.Encode },
@"
processor.UseCUEToolsDB();
processor.Action = CUEAction.Verify;
if (processor.CTDB.DBStatus != null)
return CTDB.DBStatus;
processor.Go();
processor.CTDB.DoVerify();
if (!processor.CTDB.Verify.HasErrors)
return ""nothing to fix"";
if (!processor.CTDB.Verify.CanRecover)
return ""cannot fix"";
processor._useCUEToolsDBFix = true;
processor.Action = CUEAction.Encode;
return processor.Go();
"));
scripts.Add("submit", new CUEToolsScript("submit", true,
new CUEAction[] { CUEAction.Verify },
@"
string status = processor.Go();
"));
defaultVerifyScript = "default"; defaultVerifyScript = "default";
defaultEncodeScript = "default"; defaultEncodeScript = "default";
} }
@@ -1145,6 +1175,9 @@ return processor.Go();
sw.Save("CheckForUpdates", checkForUpdates); sw.Save("CheckForUpdates", checkForUpdates);
sw.Save("Language", language); sw.Save("Language", language);
sw.Save("SeparateDecodingThread", separateDecodingThread);
sw.Save("UseSystemProxySettings", useSystemProxySettings);
sw.Save("WriteBasicTagsFromCUEData", writeBasicTagsFromCUEData); sw.Save("WriteBasicTagsFromCUEData", writeBasicTagsFromCUEData);
sw.Save("CopyBasicTags", copyBasicTags); sw.Save("CopyBasicTags", copyBasicTags);
sw.Save("CopyUnknownTags", copyUnknownTags); sw.Save("CopyUnknownTags", copyUnknownTags);
@@ -1289,6 +1322,9 @@ return processor.Go();
arLogFilenameFormat = sr.Load("ArLogFilenameFormat") ?? arLogFilenameFormat; arLogFilenameFormat = sr.Load("ArLogFilenameFormat") ?? arLogFilenameFormat;
alArtFilenameFormat = sr.Load("AlArtFilenameFormat") ?? alArtFilenameFormat; alArtFilenameFormat = sr.Load("AlArtFilenameFormat") ?? alArtFilenameFormat;
separateDecodingThread = sr.LoadBoolean("SeparateDecodingThread") ?? separateDecodingThread;
useSystemProxySettings = sr.LoadBoolean("UseSystemProxySettings") ?? useSystemProxySettings;
int totalEncoders = sr.LoadInt32("ExternalEncoders", 0, null) ?? 0; int totalEncoders = sr.LoadInt32("ExternalEncoders", 0, null) ?? 0;
for (int nEncoders = 0; nEncoders < totalEncoders; nEncoders++) for (int nEncoders = 0; nEncoders < totalEncoders; nEncoders++)
{ {
@@ -1477,6 +1513,7 @@ return processor.Go();
_useFreeDb = sr.LoadBoolean("FreedbLookup") ?? _useFreeDb; _useFreeDb = sr.LoadBoolean("FreedbLookup") ?? _useFreeDb;
_useMusicBrainz = sr.LoadBoolean("MusicBrainzLookup") ?? _useMusicBrainz; _useMusicBrainz = sr.LoadBoolean("MusicBrainzLookup") ?? _useMusicBrainz;
_useAccurateRip = sr.LoadBoolean("AccurateRipLookup") ?? _useAccurateRip; _useAccurateRip = sr.LoadBoolean("AccurateRipLookup") ?? _useAccurateRip;
_useCUEToolsDB = sr.LoadBoolean("CUEToolsDBLookup") ?? _useCUEToolsDB;
_outputAudioType = (AudioEncoderType?)sr.LoadInt32("OutputAudioType", null, null) ?? _outputAudioType; _outputAudioType = (AudioEncoderType?)sr.LoadInt32("OutputAudioType", null, null) ?? _outputAudioType;
_outputAudioFormat = sr.Load("OutputAudioFmt") ?? _outputAudioFormat; _outputAudioFormat = sr.Load("OutputAudioFmt") ?? _outputAudioFormat;
_action = (CUEAction?)sr.LoadInt32("AccurateRipMode", (int)CUEAction.Encode, (int)CUEAction.CorrectFilenames) ?? _action; _action = (CUEAction?)sr.LoadInt32("AccurateRipMode", (int)CUEAction.Encode, (int)CUEAction.CorrectFilenames) ?? _action;
@@ -1493,6 +1530,7 @@ return processor.Go();
sw.Save("FreedbLookup", _useFreeDb); sw.Save("FreedbLookup", _useFreeDb);
sw.Save("MusicBrainzLookup", _useMusicBrainz); sw.Save("MusicBrainzLookup", _useMusicBrainz);
sw.Save("AccurateRipLookup", _useAccurateRip); sw.Save("AccurateRipLookup", _useAccurateRip);
sw.Save("CUEToolsDBLookup", _useCUEToolsDB);
sw.Save("OutputAudioType", (int)_outputAudioType); sw.Save("OutputAudioType", (int)_outputAudioType);
sw.Save("OutputAudioFmt", _outputAudioFormat); sw.Save("OutputAudioFmt", _outputAudioFormat);
sw.Save("AccurateRipMode", (int)_action); sw.Save("AccurateRipMode", (int)_action);
@@ -1508,7 +1546,7 @@ return processor.Go();
public CUEAction _action = CUEAction.Encode; public CUEAction _action = CUEAction.Encode;
public CUEStyle _CUEStyle = CUEStyle.SingleFileWithCUE; public CUEStyle _CUEStyle = CUEStyle.SingleFileWithCUE;
public int _writeOffset = 0; public int _writeOffset = 0;
public bool _useFreeDb = true, _useMusicBrainz = true, _useAccurateRip = true; public bool _useFreeDb = true, _useMusicBrainz = true, _useAccurateRip = true, _useCUEToolsDB = true;
public string _name; public string _name;
} }
@@ -1533,9 +1571,9 @@ return processor.Go();
{ {
public string path; public string path;
public string contents; public string contents;
public bool isEAC; public object data;
public CUEToolsSourceFile(string _path, StreamReader reader) public CUEToolsSourceFile(string _path, TextReader reader)
{ {
path = _path; path = _path;
contents = reader.ReadToEnd(); contents = reader.ReadToEnd();
@@ -1556,6 +1594,10 @@ return processor.Go();
private int _writeOffset; private int _writeOffset;
private CUEAction _action; private CUEAction _action;
private bool _useAccurateRip = false; private bool _useAccurateRip = false;
private bool _useCUEToolsDB = false;
private bool _useCUEToolsDBFix = false;
private bool _useCUEToolsDBSibmit = false;
private bool _processed = false;
private uint? _minDataTrackLength; private uint? _minDataTrackLength;
private string _accurateRipId; private string _accurateRipId;
private string _eacLog; private string _eacLog;
@@ -1581,10 +1623,12 @@ return processor.Go();
private string _archivePassword; private string _archivePassword;
private CUEToolsProgressEventArgs _progress; private CUEToolsProgressEventArgs _progress;
private AccurateRipVerify _arVerify; private AccurateRipVerify _arVerify;
private CUEToolsDB _CUEToolsDB;
private CDImageLayout _toc; private CDImageLayout _toc;
private string _arLogFileName, _alArtFileName; private string _arLogFileName, _alArtFileName;
private TagLib.IPicture[] _albumArt; private TagLib.IPicture[] _albumArt;
private int _padding = 8192; private int _padding = 8192;
private IWebProxy proxy;
public event EventHandler<CompressionPasswordRequiredEventArgs> PasswordRequired; public event EventHandler<CompressionPasswordRequiredEventArgs> PasswordRequired;
public event EventHandler<CUEToolsProgressEventArgs> CUEToolsProgress; public event EventHandler<CUEToolsProgressEventArgs> CUEToolsProgress;
@@ -1614,6 +1658,7 @@ return processor.Go();
_isArchive = false; _isArchive = false;
_isCD = false; _isCD = false;
_albumArt = null; _albumArt = null;
proxy = _config.useSystemProxySettings ? WebRequest.GetSystemWebProxy() : null;
} }
public void OpenCD(ICDRipper ripper) public void OpenCD(ICDRipper ripper)
@@ -1625,7 +1670,9 @@ return processor.Go();
_trackFilenames.Add(string.Format("{0:00}.wav", iTrack + 1)); _trackFilenames.Add(string.Format("{0:00}.wav", iTrack + 1));
_tracks.Add(new TrackInfo()); _tracks.Add(new TrackInfo());
} }
_arVerify = new AccurateRipVerify(_toc); _arVerify = new AccurateRipVerify(_toc, proxy);
_CUEToolsDB = new CUEToolsDB(_toc, proxy);
_CUEToolsDB.UploadHelper.onProgress += new EventHandler<Krystalware.UploadHelper.UploadProgressEventArgs>(UploadProgress);
_isCD = true; _isCD = true;
SourceInfo cdInfo; SourceInfo cdInfo;
cdInfo.Path = _ripper.ARName; cdInfo.Path = _ripper.ARName;
@@ -1653,6 +1700,14 @@ return processor.Go();
} }
} }
public CUEToolsDB CTDB
{
get
{
return _CUEToolsDB;
}
}
public ICDRipper CDRipper public ICDRipper CDRipper
{ {
get get
@@ -2533,7 +2588,9 @@ return processor.Go();
} }
} }
_arVerify = new AccurateRipVerify(_toc); _arVerify = new AccurateRipVerify(_toc, proxy);
_CUEToolsDB = new CUEToolsDB(_toc, proxy);
_CUEToolsDB.UploadHelper.onProgress += new EventHandler<Krystalware.UploadHelper.UploadProgressEventArgs>(UploadProgress);
if (_eacLog != null) if (_eacLog != null)
{ {
@@ -2578,6 +2635,16 @@ return processor.Go();
_padding += _eacLog.Length; _padding += _eacLog.Length;
} }
public void UseCUEToolsDB()
{
ShowProgress((string)"Contacting CUETools database...", 0, 0, null, null);
_CUEToolsDB.ContactDB(_accurateRipId ?? AccurateRipVerify.CalculateAccurateRipId(_toc));
ShowProgress("", 0.0, 0.0, null, null);
_useCUEToolsDB = true;
}
public void UseAccurateRip() public void UseAccurateRip()
{ {
ShowProgress((string)"Contacting AccurateRip database...", 0, 0, null, null); ShowProgress((string)"Contacting AccurateRip database...", 0, 0, null, null);
@@ -2685,6 +2752,18 @@ return processor.Go();
this.CUEToolsProgress(this, _progress); this.CUEToolsProgress(this, _progress);
} }
private void UploadProgress(object sender, Krystalware.UploadHelper.UploadProgressEventArgs e)
{
CheckStop();
if (this.CUEToolsProgress == null)
return;
_progress.percentDisk = 1.0;
_progress.percentTrck = e.percent;
_progress.offset = 0;
_progress.status = e.uri;
this.CUEToolsProgress(this, _progress);
}
private void CDReadProgress(object sender, ReadProgressArgs e) private void CDReadProgress(object sender, ReadProgressArgs e)
{ {
CheckStop(); CheckStop();
@@ -3016,7 +3095,8 @@ return processor.Go();
if (Path.GetExtension(path) == ".dummy" || Path.GetExtension(path) == ".bin") if (Path.GetExtension(path) == ".dummy" || Path.GetExtension(path) == ".bin")
{ {
fileInfo = null; fileInfo = null;
} else }
else
{ {
TagLib.UserDefined.AdditionalFileTypes.Config = _config; TagLib.UserDefined.AdditionalFileTypes.Config = _config;
TagLib.File.IFileAbstraction file = _isArchive TagLib.File.IFileAbstraction file = _isArchive
@@ -3026,15 +3106,18 @@ return processor.Go();
} }
IAudioSource audioSource = AudioReadWrite.GetAudioSource(path, _isArchive ? OpenArchive(path, true) : null, _config); IAudioSource audioSource = AudioReadWrite.GetAudioSource(path, _isArchive ? OpenArchive(path, true) : null, _config);
try
{
if (!audioSource.PCM.IsRedBook || if (!audioSource.PCM.IsRedBook ||
audioSource.Length <= 0 || audioSource.Length <= 0 ||
audioSource.Length >= Int32.MaxValue) audioSource.Length >= Int32.MaxValue)
throw new Exception("Audio format is invalid.");
return (int)audioSource.Length;
}
finally
{ {
audioSource.Close(); audioSource.Close();
throw new Exception("Audio format is invalid.");
} }
audioSource.Close();
return (int)audioSource.Length;
} }
public static void WriteText(string path, string text, Encoding encoding) public static void WriteText(string path, string text, Encoding encoding)
@@ -3122,6 +3205,48 @@ return processor.Go();
logWriter.WriteLine(); logWriter.WriteLine();
logWriter.WriteLine(" Pre-gap length 0:{0}.{1:00}", CDImageLayout.TimeToString("{0:00}:{1:00}", _toc[track + _toc.FirstAudio].Pregap + (track + _toc.FirstAudio == 1 ? 150U : 0U)), (_toc[track + _toc.FirstAudio].Pregap % 75) * 100 / 75); logWriter.WriteLine(" Pre-gap length 0:{0}.{1:00}", CDImageLayout.TimeToString("{0:00}:{1:00}", _toc[track + _toc.FirstAudio].Pregap + (track + _toc.FirstAudio == 1 ? 150U : 0U)), (_toc[track + _toc.FirstAudio].Pregap % 75) * 100 / 75);
} }
int errCount = 0;
uint tr_start = _toc[track + _toc.FirstAudio].Start;
uint tr_end = (_toc[track + _toc.FirstAudio].Length + 74) / 75;
for (uint iSecond = 0; iSecond < tr_end; iSecond ++)
{
uint sec_start = tr_start + iSecond * 75;
uint sec_end = Math.Min(sec_start + 74, _toc[track + _toc.FirstAudio].End);
bool fError = false;
for (uint iSector = sec_start; iSector <= sec_end; iSector++)
if (_ripper.Errors[(int)iSector])
fError = true;
if (fError)
{
uint end = iSecond;
for (uint jSecond = iSecond + 1; jSecond < tr_end; jSecond++)
{
uint jsec_start = tr_start + jSecond * 75;
uint jsec_end = Math.Min(jsec_start + 74, _toc[track + _toc.FirstAudio].End);
bool jfError = false;
for (uint jSector = jsec_start; jSector <= jsec_end; jSector++)
if (_ripper.Errors[(int)jSector])
jfError = true;
if (jfError)
end = jSecond;
}
if (errCount == 0)
logWriter.WriteLine();
if (errCount++ > 20)
break;
//"Suspicious position 0:02:20"
//" Suspicious position 0:02:23 - 0:02:24"
string s1 = CDImageLayout.TimeToString("0:{0:00}:{1:00}", iSecond * 75);
string s2 = CDImageLayout.TimeToString("0:{0:00}:{1:00}", end * 75);
if (iSecond == end)
logWriter.WriteLine(" Suspicious position {0}", s1);
else
logWriter.WriteLine(" Suspicious position {0} - {1}", s1, s2);
iSecond = end;
}
}
logWriter.WriteLine(); logWriter.WriteLine();
logWriter.WriteLine(" Peak level {0:F1} %", (Tracks[track].PeakLevel * 1000 / 32768) * 0.1); logWriter.WriteLine(" Peak level {0:F1} %", (Tracks[track].PeakLevel * 1000 / 32768) * 0.1);
logWriter.WriteLine(" Track quality 100.0 %"); logWriter.WriteLine(" Track quality 100.0 %");
@@ -3391,6 +3516,8 @@ return processor.Go();
public void GenerateAccurateRipLog(TextWriter sw) public void GenerateAccurateRipLog(TextWriter sw)
{ {
if (!_processed)
throw new Exception("not processed");
sw.WriteLine("[Verification date: {0}]", DateTime.Now); sw.WriteLine("[Verification date: {0}]", DateTime.Now);
sw.WriteLine("[Disc ID: {0}]", _accurateRipId ?? AccurateRipVerify.CalculateAccurateRipId(_toc)); sw.WriteLine("[Disc ID: {0}]", _accurateRipId ?? AccurateRipVerify.CalculateAccurateRipId(_toc));
if (PreGapLength != 0) if (PreGapLength != 0)
@@ -3414,6 +3541,10 @@ return processor.Go();
sw.WriteLine("HDCD: {0:f}", hdcdDecoder); sw.WriteLine("HDCD: {0:f}", hdcdDecoder);
if (0 != _writeOffset) if (0 != _writeOffset)
sw.WriteLine("Offset applied: {0}", _writeOffset); sw.WriteLine("Offset applied: {0}", _writeOffset);
if (_useCUEToolsDBFix)// && _CUEToolsDB.SelectedEntry != null)
sw.WriteLine("CUETools DB: corrected {0} errors.", _CUEToolsDB.SelectedEntry.repair.CorrectableErrors);
else if (_useCUEToolsDB)
sw.WriteLine("CUETools DB: {0}.", _CUEToolsDB.Status);
_arVerify.GenerateFullLog(sw, _config.arLogVerbose); _arVerify.GenerateFullLog(sw, _config.arLogVerbose);
} }
@@ -3550,6 +3681,14 @@ return processor.Go();
if (_audioEncoderType != AudioEncoderType.NoAudio || _action == CUEAction.Verify) if (_audioEncoderType != AudioEncoderType.NoAudio || _action == CUEAction.Verify)
WriteAudioFilesPass(OutputDir, OutputStyle, destLengths, htoaToFile, _action == CUEAction.Verify); WriteAudioFilesPass(OutputDir, OutputStyle, destLengths, htoaToFile, _action == CUEAction.Verify);
if (_useCUEToolsDB && CTDB.AccResult == HttpStatusCode.OK)
{
if (!_useCUEToolsDBFix)
CTDB.DoVerify();
}
_processed = true;
CreateRipperLOG(); CreateRipperLOG();
if (_action == CUEAction.Encode) if (_action == CUEAction.Encode)
@@ -4097,6 +4236,8 @@ return processor.Go();
if (_useAccurateRip) if (_useAccurateRip)
_arVerify.Init(); _arVerify.Init();
if (_useCUEToolsDB && !_useCUEToolsDBFix)
_CUEToolsDB.Init(_useCUEToolsDBSibmit);
ShowProgress(String.Format("{2} track {0:00} ({1:00}%)...", 0, 0, noOutput ? "Verifying" : "Writing"), 0, 0.0, null, null); ShowProgress(String.Format("{2} track {0:00} ({1:00}%)...", 0, 0, noOutput ? "Verifying" : "Writing"), 0, 0.0, null, null);
@@ -4179,6 +4320,13 @@ return processor.Go();
} }
copyCount = audioSource.Read(sampleBuffer, copyCount); copyCount = audioSource.Read(sampleBuffer, copyCount);
if (_useCUEToolsDB)
{
if (_useCUEToolsDBFix)
_CUEToolsDB.SelectedEntry.repair.Write(sampleBuffer);
else
_CUEToolsDB.Verify.Write(sampleBuffer);
}
if (!discardOutput) if (!discardOutput)
{ {
if (!_config.detectHDCD || !_config.decodeHDCD) if (!_config.detectHDCD || !_config.decodeHDCD)
@@ -4208,7 +4356,7 @@ return processor.Go();
{ {
_arVerify.Write(sampleBuffer); _arVerify.Write(sampleBuffer);
if (iTrack > 0 || iIndex > 0) if (iTrack > 0 || iIndex > 0)
Tracks[iTrack + (iIndex == 0 ? -1 : 0)].MeasurePeakLevel(sampleBuffer.Samples, copyCount); Tracks[iTrack + (iIndex == 0 ? -1 : 0)].MeasurePeakLevel(sampleBuffer, copyCount);
} }
currentOffset += copyCount; currentOffset += copyCount;
@@ -4550,7 +4698,9 @@ return processor.Go();
if (sourceInfo.Offset != 0) if (sourceInfo.Offset != 0)
audioSource.Position = sourceInfo.Offset; audioSource.Position = sourceInfo.Offset;
//audioSource = new AudioPipe(audioSource, 0x10000); //if (!(audioSource is AudioPipe) && !(audioSource is UserDefinedReader) && _config.separateDecodingThread)
if (!(audioSource is AudioPipe) && _config.separateDecodingThread)
audioSource = new AudioPipe(audioSource, 0x10000);
return audioSource; return audioSource;
} }
@@ -4902,6 +5052,14 @@ return processor.Go();
} }
} }
public bool Processed
{
get
{
return _processed;
}
}
public bool IsCD public bool IsCD
{ {
get get
@@ -5039,6 +5197,56 @@ return processor.Go();
return Go(); return Go();
case "only if found": case "only if found":
return ArVerify.AccResult != HttpStatusCode.OK ? WriteReport() : Go(); return ArVerify.AccResult != HttpStatusCode.OK ? WriteReport() : Go();
case "submit":
{
if (!_useCUEToolsDB)
return "CUETools DB not enabled";
if (ArVerify.ARStatus != null)
return "AccurateRip: " + ArVerify.ARStatus;
if (ArVerify.WorstTotal() < 3)
return "AccurateRip: confidence too low";
//if (CTDB.AccResult == HttpStatusCode.OK)
//return "CUEToolsDB: disc already present in database";
if (CTDB.AccResult != HttpStatusCode.NotFound && CTDB.AccResult != HttpStatusCode.OK)
return "CUEToolsDB: " + CTDB.DBStatus;
_useCUEToolsDBSibmit = true;
string status = Go();
if (CTDB.AccResult == HttpStatusCode.OK)
foreach (DBEntry entry in CTDB.Entries)
if (!entry.hasErrors)
return "CUEToolsDB: " + CTDB.Status;
if (ArVerify.WorstConfidence() < 3)
return status + ": confidence too low";
return CTDB.Submit((int)ArVerify.WorstConfidence(), (int)ArVerify.WorstTotal());
}
case "repair":
{
UseCUEToolsDB();
Action = CUEAction.Verify;
if (CTDB.DBStatus != null)
return CTDB.DBStatus;
bool useAR = _useAccurateRip;
_useAccurateRip = false;
Go();
_useAccurateRip = useAR;
List<CUEToolsSourceFile> choices = new List<CUEToolsSourceFile>();
foreach (DBEntry entry in CTDB.Entries)
if (!entry.hasErrors || entry.canRecover)
{
CUEToolsSourceFile choice = new CUEToolsSourceFile(entry.Status, new StringReader(""));
choice.data = entry;
choices.Add(choice);
}
CUEToolsSourceFile selectedEntry = ChooseFile(choices, null, true);
if (selectedEntry == null)
return CTDB.Status;
CTDB.SelectedEntry = (DBEntry)selectedEntry.data;
if (!CTDB.SelectedEntry.hasErrors)
return CTDB.Status;
_useCUEToolsDBFix = true;
Action = CUEAction.Encode;
return Go();
}
case "fix offset": case "fix offset":
{ {
if (ArVerify.AccResult != HttpStatusCode.OK) if (ArVerify.AccResult != HttpStatusCode.OK)
@@ -5276,12 +5484,15 @@ return processor.Go();
_peakLevel = 0; _peakLevel = 0;
} }
public unsafe void MeasurePeakLevel(int[,] samplesBuffer, int sampleCount) public unsafe void MeasurePeakLevel(AudioBuffer buff, int sampleCount)
{ {
fixed (int* s = samplesBuffer) if (!buff.PCM.IsRedBook)
throw new Exception();
fixed (byte* bb = buff.Bytes)
{ {
short* ss = (short*)bb;
for (int i = 0; i < sampleCount * 2; i++) for (int i = 0; i < sampleCount * 2; i++)
_peakLevel = Math.Max(_peakLevel, Math.Abs(s[i])); _peakLevel = Math.Max(_peakLevel, Math.Abs((int)ss[i]));
} }
//for (uint i = 0; i < sampleCount; i++) //for (uint i = 0; i < sampleCount; i++)
// for (uint j = 0; j < 2; j++) // for (uint j = 0; j < 2; j++)

View File

@@ -21,6 +21,7 @@
using System; using System;
using System.IO; using System.IO;
using System.Net;
using System.Text; using System.Text;
using System.Collections.Generic; using System.Collections.Generic;
using CUETools.Ripper; using CUETools.Ripper;
@@ -173,7 +174,7 @@ namespace CUETools.ConsoleRipper
return; return;
} }
AccurateRipVerify arVerify = new AccurateRipVerify(audioSource.TOC); AccurateRipVerify arVerify = new AccurateRipVerify(audioSource.TOC, WebRequest.GetSystemWebProxy());
AudioBuffer buff = new AudioBuffer(audioSource, 0x10000); AudioBuffer buff = new AudioBuffer(audioSource, 0x10000);
string CDDBId = AccurateRipVerify.CalculateCDDBId(audioSource.TOC); string CDDBId = AccurateRipVerify.CalculateCDDBId(audioSource.TOC);
string ArId = AccurateRipVerify.CalculateAccurateRipId(audioSource.TOC); string ArId = AccurateRipVerify.CalculateAccurateRipId(audioSource.TOC);

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8CF07381-BEA2-4AFC-B3DD-9B2F21C65A3A}</ProjectGuid> <ProjectGuid>{8CF07381-BEA2-4AFC-B3DD-9B2F21C65A3A}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
@@ -39,9 +39,6 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Galois.cs" />
<Compile Include="RsDecode.cs" />
<Compile Include="RsEncode.cs" />
<Compile Include="SCSIDrive.cs" /> <Compile Include="SCSIDrive.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>

View File

@@ -46,7 +46,6 @@ namespace CUETools.Ripper.SCSI
int _correctionQuality = 1; int _correctionQuality = 1;
int _currentStart = -1, _currentEnd = -1, _currentErrorsCount = 0; int _currentStart = -1, _currentEnd = -1, _currentErrorsCount = 0;
const int CB_AUDIO = 4 * 588 + 2 + 294 + 16; const int CB_AUDIO = 4 * 588 + 2 + 294 + 16;
const int MAXSCANS = 20;
const int NSECTORS = 16; const int NSECTORS = 16;
//const int MSECTORS = 5*1024*1024 / (4 * 588); //const int MSECTORS = 5*1024*1024 / (4 * 588);
const int MSECTORS = 2400; const int MSECTORS = 2400;
@@ -58,11 +57,10 @@ namespace CUETools.Ripper.SCSI
int m_max_sectors; int m_max_sectors;
int _timeout = 10; int _timeout = 10;
Crc16Ccitt _crc; Crc16Ccitt _crc;
int _currentScan; public long[,] UserData;
public byte[,,] UserData; public long[,] C2Data;
public byte[,,] C2Data; public byte[,] QData;
public byte[,,] QData; public long[] byte2long;
public long[] Quality;
BitArray _errors; BitArray _errors;
int _errorsCount; int _errorsCount;
int _crcErrorsCount = 0; int _crcErrorsCount = 0;
@@ -185,10 +183,17 @@ namespace CUETools.Ripper.SCSI
{ {
m_logger = new Logger(); m_logger = new Logger();
_crc = new Crc16Ccitt(InitialCrcValue.Zeros); _crc = new Crc16Ccitt(InitialCrcValue.Zeros);
UserData = new byte[MAXSCANS, MSECTORS, 4 * 588]; UserData = new long[MSECTORS, 4 * 588];
C2Data = new byte[MAXSCANS, MSECTORS, 294]; C2Data = new long[MSECTORS, 588 / 2];
QData = new byte[MAXSCANS, MSECTORS, 16]; QData = new byte[MSECTORS, 16];
Quality = new long[MAXSCANS]; byte2long = new long[256];
for (long i = 0; i < 256; i++)
{
long bl = 0;
for (int b = 0; b < 8; b++)
bl += ((i >> b) & 1) << (b << 3);
byte2long[i] = bl;
}
} }
public bool Open(char Drive) public bool Open(char Drive)
@@ -303,13 +308,13 @@ namespace CUETools.Ripper.SCSI
for (int iSector = 0; iSector < Sectors2Read; iSector++) for (int iSector = 0; iSector < Sectors2Read; iSector++)
{ {
int q_pos = (sector - _currentStart + iSector); int q_pos = (sector - _currentStart + iSector);
int ctl = QData[_currentScan, q_pos, 0] >> 4; int ctl = QData[q_pos, 0] >> 4;
int adr = QData[_currentScan, q_pos, 0] & 7; int adr = QData[q_pos, 0] & 7;
bool preemph = (ctl & 1) == 1; bool preemph = (ctl & 1) == 1;
bool dcp = (ctl & 2) == 2; bool dcp = (ctl & 2) == 2;
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
_subchannelBuffer[i] = QData[_currentScan, q_pos, i]; _subchannelBuffer[i] = QData[ q_pos, i];
if (!_qChannelInBCD && adr == 1) if (!_qChannelInBCD && adr == 1)
{ {
_subchannelBuffer[3] = toBCD(_subchannelBuffer[3]); _subchannelBuffer[3] = toBCD(_subchannelBuffer[3]);
@@ -321,8 +326,8 @@ namespace CUETools.Ripper.SCSI
} }
ushort crc = _crc.ComputeChecksum(_subchannelBuffer, 0, 10); ushort crc = _crc.ComputeChecksum(_subchannelBuffer, 0, 10);
crc ^= 0xffff; crc ^= 0xffff;
if ((QData[_currentScan, q_pos, 10] != 0 || QData[_currentScan, q_pos, 11] != 0) && if ((QData[q_pos, 10] != 0 || QData[q_pos, 11] != 0) &&
((byte)(crc & 0xff) != QData[_currentScan, q_pos, 11] || (byte)(crc >> 8) != QData[_currentScan, q_pos, 10]) ((byte)(crc & 0xff) != QData[q_pos, 11] || (byte)(crc >> 8) != QData[q_pos, 10])
) )
{ {
if (!updateMap) if (!updateMap)
@@ -332,7 +337,7 @@ namespace CUETools.Ripper.SCSI
{ {
StringBuilder st = new StringBuilder(); StringBuilder st = new StringBuilder();
for (int i = 0; i < 12; i++) for (int i = 0; i < 12; i++)
st.AppendFormat(",0x{0:X2}", QData[_currentScan, q_pos, i]); st.AppendFormat(",0x{0:X2}", QData[q_pos, i]);
System.Console.WriteLine("\rCRC error@{0}{1};", CDImageLayout.TimeToString((uint)(sector + iSector)), st.ToString()); System.Console.WriteLine("\rCRC error@{0}{1};", CDImageLayout.TimeToString((uint)(sector + iSector)), st.ToString());
} }
continue; continue;
@@ -341,11 +346,11 @@ namespace CUETools.Ripper.SCSI
{ {
case 1: // current position case 1: // current position
{ {
int iTrack = fromBCD(QData[_currentScan, q_pos, 1]); int iTrack = fromBCD(QData[q_pos, 1]);
int iIndex = fromBCD(QData[_currentScan, q_pos, 2]); int iIndex = fromBCD(QData[q_pos, 2]);
int mm = _qChannelInBCD ? fromBCD(QData[_currentScan, q_pos, 7]) : QData[_currentScan, q_pos, 7]; int mm = _qChannelInBCD ? fromBCD(QData[q_pos, 7]) : QData[q_pos, 7];
int ss = _qChannelInBCD ? fromBCD(QData[_currentScan, q_pos, 8]) : QData[_currentScan, q_pos, 8]; int ss = _qChannelInBCD ? fromBCD(QData[q_pos, 8]) : QData[q_pos, 8];
int ff = _qChannelInBCD ? fromBCD(QData[_currentScan, q_pos, 9]) : QData[_currentScan, q_pos, 9]; int ff = _qChannelInBCD ? fromBCD(QData[q_pos, 9]) : QData[q_pos, 9];
//if (sec != sector + iSector) //if (sec != sector + iSector)
// System.Console.WriteLine("\rLost sync: {0} vs {1} ({2:X} vs {3:X})", CDImageLayout.TimeToString((uint)(sector + iSector)), CDImageLayout.TimeToString((uint)sec), sector + iSector, sec); // System.Console.WriteLine("\rLost sync: {0} vs {1} ({2:X} vs {3:X})", CDImageLayout.TimeToString((uint)(sector + iSector)), CDImageLayout.TimeToString((uint)sec), sector + iSector, sec);
if (iTrack == 110) if (iTrack == 110)
@@ -413,7 +418,7 @@ namespace CUETools.Ripper.SCSI
{ {
StringBuilder catalog = new StringBuilder(); StringBuilder catalog = new StringBuilder();
for (int i = 1; i < 8; i++) for (int i = 1; i < 8; i++)
catalog.AppendFormat("{0:x2}", QData[_currentScan, q_pos, i]); catalog.AppendFormat("{0:x2}", QData[q_pos, i]);
_toc.Catalog = catalog.ToString(0, 13); _toc.Catalog = catalog.ToString(0, 13);
} }
break; break;
@@ -421,16 +426,16 @@ namespace CUETools.Ripper.SCSI
if (updateMap && _toc[_currentTrack].ISRC == null) if (updateMap && _toc[_currentTrack].ISRC == null)
{ {
StringBuilder isrc = new StringBuilder(); StringBuilder isrc = new StringBuilder();
isrc.Append(from6bit(QData[_currentScan, q_pos, 1] >> 2)); isrc.Append(from6bit(QData[q_pos, 1] >> 2));
isrc.Append(from6bit(((QData[_currentScan, q_pos, 1] & 0x3) << 4) + (0x0f & (QData[_currentScan, q_pos, 2] >> 4)))); isrc.Append(from6bit(((QData[q_pos, 1] & 0x3) << 4) + (0x0f & (QData[q_pos, 2] >> 4))));
isrc.Append(from6bit(((QData[_currentScan, q_pos, 2] & 0xf) << 2) + (0x03 & (QData[_currentScan, q_pos, 3] >> 6)))); isrc.Append(from6bit(((QData[q_pos, 2] & 0xf) << 2) + (0x03 & (QData[q_pos, 3] >> 6))));
isrc.Append(from6bit((QData[_currentScan, q_pos, 3] & 0x3f))); isrc.Append(from6bit((QData[q_pos, 3] & 0x3f)));
isrc.Append(from6bit(QData[_currentScan, q_pos, 4] >> 2)); isrc.Append(from6bit(QData[q_pos, 4] >> 2));
isrc.Append(from6bit(((QData[_currentScan, q_pos, 4] & 0x3) << 4) + (0x0f & (QData[_currentScan, q_pos, 5] >> 4)))); isrc.Append(from6bit(((QData[q_pos, 4] & 0x3) << 4) + (0x0f & (QData[q_pos, 5] >> 4))));
isrc.AppendFormat("{0:x}", QData[_currentScan, q_pos, 5] & 0xf); isrc.AppendFormat("{0:x}", QData[q_pos, 5] & 0xf);
isrc.AppendFormat("{0:x2}", QData[_currentScan, q_pos, 6]); isrc.AppendFormat("{0:x2}", QData[q_pos, 6]);
isrc.AppendFormat("{0:x2}", QData[_currentScan, q_pos, 7]); isrc.AppendFormat("{0:x2}", QData[q_pos, 7]);
isrc.AppendFormat("{0:x}", QData[_currentScan, q_pos, 8] >> 4); isrc.AppendFormat("{0:x}", QData[q_pos, 8] >> 4);
if (!isrc.ToString().Contains("#") && isrc.ToString() != "0000000000") if (!isrc.ToString().Contains("#") && isrc.ToString() != "0000000000")
_toc[_currentTrack].ISRC = isrc.ToString(); _toc[_currentTrack].ISRC = isrc.ToString();
} }
@@ -449,7 +454,6 @@ namespace CUETools.Ripper.SCSI
Device.MainChannelSelection[] mainmode = { Device.MainChannelSelection.UserData, Device.MainChannelSelection.F8h }; Device.MainChannelSelection[] mainmode = { Device.MainChannelSelection.UserData, Device.MainChannelSelection.F8h };
bool found = false; bool found = false;
_currentStart = 0; _currentStart = 0;
_currentScan = 0;
_currentTrack = -1; _currentTrack = -1;
_currentIndex = -1; _currentIndex = -1;
m_max_sectors = Math.Min(NSECTORS, m_device.MaximumTransferLength / CB_AUDIO - 1); m_max_sectors = Math.Min(NSECTORS, m_device.MaximumTransferLength / CB_AUDIO - 1);
@@ -511,23 +515,30 @@ namespace CUETools.Ripper.SCSI
{ {
int c2Size = _c2ErrorMode == Device.C2ErrorMode.None ? 0 : _c2ErrorMode == Device.C2ErrorMode.Mode294 ? 294 : 296; int c2Size = _c2ErrorMode == Device.C2ErrorMode.None ? 0 : _c2ErrorMode == Device.C2ErrorMode.Mode294 ? 294 : 296;
int oldSize = 4 * 588 + c2Size + (_subChannelMode == Device.SubChannelMode.None ? 0 : 16); int oldSize = 4 * 588 + c2Size + (_subChannelMode == Device.SubChannelMode.None ? 0 : 16);
fixed (byte* readBuf = _readBuffer, qBuf = _subchannelBuffer, userData = UserData, c2Data = C2Data, qData = QData) fixed (byte* readBuf = _readBuffer, qBuf = _subchannelBuffer, qData = QData)
fixed (long* userData = UserData, c2Data = C2Data)
{ {
for (int iSector = 0; iSector < Sectors2Read; iSector++) for (int iSector = 0; iSector < Sectors2Read; iSector++)
{ {
byte* sectorPtr = readBuf + iSector * oldSize; byte* sectorPtr = readBuf + iSector * oldSize;
byte* userDataPtr = userData + (_currentScan * MSECTORS + sector - _currentStart + iSector) * 4 * 588; long* userDataPtr = userData + (sector - _currentStart + iSector) * 4 * 588;
byte* c2DataPtr = c2Data + (_currentScan * MSECTORS + sector - _currentStart + iSector) * 294; long* c2DataPtr = c2Data + (sector - _currentStart + iSector) * 294;
byte* qDataPtr = qData + (_currentScan * MSECTORS + sector - _currentStart + iSector) * 16; byte* qDataPtr = qData + (sector - _currentStart + iSector) * 16;
for (int sample = 0; sample < 4 * 588; sample++) for (int sample = 0; sample < 4 * 588; sample++)
userDataPtr[sample] = sectorPtr[sample]; userDataPtr[sample] += byte2long[sectorPtr[sample]] * 3;
if (_c2ErrorMode != Device.C2ErrorMode.None) if (_c2ErrorMode != Device.C2ErrorMode.None)
{
for (int c2 = 0; c2 < 294; c2++) for (int c2 = 0; c2 < 294; c2++)
c2DataPtr[c2] = sectorPtr[4 * 588 + c2Size - 294 + c2]; {
else byte c2val = sectorPtr[4 * 588 + c2Size - 294 + c2];
for (int c2 = 0; c2 < 294; c2++) c2DataPtr[c2] += byte2long[c2val];
c2DataPtr[c2] = 0; // 0xff?? if (c2val != 0)
for (int b = 0; b < 8; b++)
if (((c2val >> b) & 1) != 0)
userDataPtr[c2 * 8 + b] += 0x0101010101010101 - byte2long[sectorPtr[c2 * 8 + b]] * 2;
}
}
if (_subChannelMode != Device.SubChannelMode.None) if (_subChannelMode != Device.SubChannelMode.None)
for (int qi = 0; qi < 16; qi++) for (int qi = 0; qi < 16; qi++)
qDataPtr[qi] = sectorPtr[4 * 588 + c2Size + qi]; qDataPtr[qi] = sectorPtr[4 * 588 + c2Size + qi];
@@ -538,6 +549,15 @@ namespace CUETools.Ripper.SCSI
} }
} }
private unsafe void ClearSectors(int sector, int Sectors2Read)
{
fixed (long* userData = &UserData[sector - _currentStart, 0], c2Data = &C2Data[sector - _currentStart, 0])
{
ZeroMemory((byte*)userData, 8 * 4 * 588 * Sectors2Read);
ZeroMemory((byte*)c2Data, 4 * 588 * Sectors2Read);
}
}
private unsafe Device.CommandStatus FetchSectors(int sector, int Sectors2Read, bool abort, bool subchannel) private unsafe Device.CommandStatus FetchSectors(int sector, int Sectors2Read, bool abort, bool subchannel)
{ {
Device.CommandStatus st; Device.CommandStatus st;
@@ -579,11 +599,11 @@ namespace CUETools.Ripper.SCSI
{ {
iErrors ++; iErrors ++;
for (int i = 0; i < 4 * 588; i++) for (int i = 0; i < 4 * 588; i++)
UserData[_currentScan, sector + iSector - _currentStart, i] = 0; UserData[sector + iSector - _currentStart, i] += 0x0101010101010101;
for (int i = 0; i < 294; i++) for (int i = 0; i < 294; i++)
C2Data[_currentScan, sector + iSector - _currentStart, i] = 0xff; C2Data[sector + iSector - _currentStart, i] += 0x0101010101010101;
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
QData[_currentScan, sector + iSector - _currentStart, i] = 0; QData[ sector + iSector - _currentStart, i] = 0;
if (_debugMessages) if (_debugMessages)
System.Console.WriteLine("\nSector lost"); System.Console.WriteLine("\nSector lost");
} }
@@ -666,23 +686,24 @@ namespace CUETools.Ripper.SCSI
private void PrintErrors(int pass, int sector, int Sectors2Read, byte[] realData) private void PrintErrors(int pass, int sector, int Sectors2Read, byte[] realData)
{ {
for (int iSector = 0; iSector < Sectors2Read; iSector++) //for (int iSector = 0; iSector < Sectors2Read; iSector++)
{ //{
int pos = sector - _currentStart + iSector; // int pos = sector - _currentStart + iSector;
if (_debugMessages) // if (_debugMessages)
{ // {
StringBuilder st = new StringBuilder(); // StringBuilder st = new StringBuilder();
for (int i = 0; i < 294; i++) // for (int i = 0; i < 294; i++)
if (C2Data[_currentScan, pos, i] != 0) // if (C2Data[pos, i] != 0)
{ // {
for (int j = i; j < i + 23; j++) // for (int j = i; j < i + 23; j++)
if (j < 294) // if (j < 294)
st.AppendFormat("{0:X2}", C2Data[_currentScan, pos, j]); // st.AppendFormat("{0:X2}", C2Data[_currentScan, pos, j]);
else // else
st.Append(" "); // st.Append(" ");
System.Console.WriteLine("\rC2 error @{0}[{1:000}]{2};", CDImageLayout.TimeToString((uint)(sector + iSector)), i, st.ToString()); // System.Console.WriteLine("\rC2 error @{0}[{1:000}]{2};", CDImageLayout.TimeToString((uint)(sector + iSector)), i, st.ToString());
return; // return;
} // }
//for (int i = 0; i < 4 * 588; i++) //for (int i = 0; i < 4 * 588; i++)
// if (_currentData[pos * 4 * 588 + i] != realData[pos * 4 * 588 + i]) // if (_currentData[pos * 4 * 588 + i] != realData[pos * 4 * 588 + i])
// { // {
@@ -714,100 +735,50 @@ namespace CUETools.Ripper.SCSI
// // st.Append(' '); // // st.Append(' ');
// //System.Console.WriteLine("\rReal error @{0}[{1:000}]{2};", CDImageLayout.TimeToString((uint)(sector + iSector)), i, st.ToString()); // //System.Console.WriteLine("\rReal error @{0}[{1:000}]{2};", CDImageLayout.TimeToString((uint)(sector + iSector)), i, st.ToString());
// } // }
}
} // }
//}
} }
private unsafe void CorrectSectors0(int sector, int Sectors2Read) private unsafe void CorrectSectors(int pass, int sector, int Sectors2Read, bool markErrors)
{ {
for (int iSector = 0; iSector < Sectors2Read; iSector++) for (int iSector = 0; iSector < Sectors2Read; iSector++)
{ {
int pos = sector - _currentStart + iSector; int pos = sector - _currentStart + iSector;
int avg = (pass + 1) * 3 / 2;
int er_limit = 2 + pass / 2; // allow 25% minority
// avg - pass + 1
// p a l o
// 0 1 1 2
// 2 4 3 3
// 4 7 2 4
// 6 10 5
//16 25 10
bool fError = false;
for (int iPar = 0; iPar < 4 * 588; iPar++) for (int iPar = 0; iPar < 4 * 588; iPar++)
{ {
byte bestValue = UserData[0, pos, iPar]; long val = UserData[pos, iPar];
_currentErrorsCount += (C2Data[0, pos, iPar >> 3] >> (iPar & 7)) & 1; byte c2 = (byte)(C2Data[pos, iPar >> 3] >> ((iPar & 7) * 8));
_currentData[pos * 4 * 588 + iPar] = bestValue; int bestValue = 0;
for (int i = 0; i < 8; i++)
{
int sum = avg - ((int)(val & 0xff));
int sig = sum >> 31; // bit value
fError |= (sum ^ sig) < er_limit;
bestValue += sig & (1 << i);
val >>= 8;
} }
_currentData[pos * 4 * 588 + iPar] = (byte)bestValue;
} }
}
private unsafe void CorrectSectors1(int sector, int Sectors2Read)
{
for (int iSector = 0; iSector < Sectors2Read; iSector++)
{
int pos = sector - _currentStart + iSector;
for (int iPar = 0; iPar < 4 * 588; iPar++)
{
byte val1 = UserData[0, pos, iPar];
byte val2 = UserData[1, pos, iPar];
int err1 = (C2Data[0, pos, iPar >> 3] >> (iPar & 7)) & 1;
int err2 = (C2Data[1, pos, iPar >> 3] >> (iPar & 7)) & 1;
_currentErrorsCount += err1 | err2 | (val1 != val2 ? 1 : 0);
_currentData[pos * 4 * 588 + iPar] = err1 != 0 ? val2 : val1;
//if (_debugMessages && ((C2Data[_currentScan, pos, iPar >> 3] >> (iPar & 7)) & 1) != 0 && _currentErrorsCount < 10)
// System.Console.WriteLine("\rC2 error @{0}, byte {1:0000} ", CDImageLayout.TimeToString((uint)(sector + iSector)), iPar);
}
}
}
private unsafe void CorrectSectors(int pass, int sector, int Sectors2Read, bool findWorst, bool markErrors)
{
if (pass == 0)
{
CorrectSectors0(sector, Sectors2Read);
return;
}
if (pass == 1)
{
CorrectSectors1(sector, Sectors2Read);
return;
}
short c2Score = 10;
fixed (short* valueScore = _valueScore)
{
fixed (byte* userData = UserData, c2Data = C2Data, qData = QData)
{
for (int iSector = 0; iSector < Sectors2Read; iSector++)
{
int pos = sector - _currentStart + iSector;
for (int iPar = 0; iPar < 4 * 588; iPar++)
{
int c2Bit = 0x80 >> (iPar % 8);
ZeroMemory(valueScore, 256);
byte bestValue = 0;
short totalScore = 0;
for (int result = 0; result <= pass; result++)
{
int offs = (result * MSECTORS + pos) * 4 * 588 + iPar;
byte value = userData[offs];
short score = (short)(1 + (((c2Data[offs >> 3] & c2Bit) == 0) ? c2Score : (short)0));
valueScore[value] += score;
totalScore += score;
if (valueScore[value] > valueScore[bestValue])
bestValue = value;
}
// if (_debugMessages && ((C2Data[_currentScan, pos, iPar >> 3] >> (iPar & 7)) & 1) != 0 && _currentErrorsCount < 10)
// System.Console.WriteLine("\rC2 error @{0}, byte {1:0000} ", CDImageLayout.TimeToString((uint)(sector + iSector)), iPar);
bool fError = valueScore[bestValue] <= _correctionQuality + c2Score + totalScore / 2;
if (fError) if (fError)
_currentErrorsCount++; _currentErrorsCount++;
_currentData[(sector - _currentStart + iSector) * 4 * 588 + iPar] = bestValue;
if (findWorst)
{
for (int result = 0; result <= pass; result++)
Quality[result] += Math.Min(0, valueScore[userData[(result * MSECTORS + pos) * 4 * 588 + iPar]] - c2Score - 2);
}
if (markErrors) if (markErrors)
{ {
_errors[sector + iSector] |= fError; _errors[sector + iSector] |= fError;
_errorsCount += fError ? 1 : 0; _errorsCount += fError ? 1 : 0;
} }
} }
}
}
}
} }
//private unsafe int CorrectSectorsTest(int start, int end, int c2Score, byte[] realData, int worstScan) //private unsafe int CorrectSectorsTest(int start, int end, int c2Score, byte[] realData, int worstScan)
@@ -866,8 +837,6 @@ namespace CUETools.Ripper.SCSI
public unsafe void PrefetchSector(int iSector) public unsafe void PrefetchSector(int iSector)
{ {
int nExtraPasses = MAXSCANS / 2 + _correctionQuality;
if (_currentStart == MSECTORS * (iSector / MSECTORS)) if (_currentStart == MSECTORS * (iSector / MSECTORS))
return; return;
@@ -884,26 +853,10 @@ namespace CUETools.Ripper.SCSI
// throw new Exception("read"); // throw new Exception("read");
//correctFile.Close(); //correctFile.Close();
fixed (byte* userData = UserData, c2Data = C2Data, qData = QData) int max_scans = 64;
{ for (int pass = 0; pass <= max_scans; pass++)
for (int pass = 0; pass < MAXSCANS + nExtraPasses; pass++)
{ {
DateTime PassTime = DateTime.Now, LastFetch = DateTime.Now; DateTime PassTime = DateTime.Now, LastFetch = DateTime.Now;
if (pass < MAXSCANS)
_currentScan = pass;
else
{
_currentScan = 0;
for (int result = 1; result < MAXSCANS; result++)
if (Quality[result] < Quality[_currentScan])
_currentScan = result;
//if (worstPass < 0)
// System.Console.WriteLine("bad scan");
//else
// System.Console.WriteLine("{0}->{1}, {2}->{3}", _scanResults[worstPass].Quality, _currentScan.Quality, CorrectSectorsTest(_currentStart, _currentEnd, 10, realData, -1), CorrectSectorsTest(_currentStart, _currentEnd, 10, realData, worstPass));
}
for (int result = 0; result < MAXSCANS; result++)
Quality[result] = 0;
_currentErrorsCount = 0; _currentErrorsCount = 0;
for (int sector = _currentStart; sector < _currentEnd; sector += m_max_sectors) for (int sector = _currentStart; sector < _currentEnd; sector += m_max_sectors)
@@ -913,14 +866,20 @@ namespace CUETools.Ripper.SCSI
int msToSleep = 1000 * Sectors2Read / speed - (int)((DateTime.Now - LastFetch).TotalMilliseconds); int msToSleep = 1000 * Sectors2Read / speed - (int)((DateTime.Now - LastFetch).TotalMilliseconds);
//if (msToSleep > 0) Thread.Sleep(msToSleep); //if (msToSleep > 0) Thread.Sleep(msToSleep);
LastFetch = DateTime.Now; LastFetch = DateTime.Now;
if (pass == 0)
ClearSectors(sector, Sectors2Read);
FetchSectors(sector, Sectors2Read, true, pass == 0); FetchSectors(sector, Sectors2Read, true, pass == 0);
//TimeSpan delay1 = DateTime.Now - LastFetch; //TimeSpan delay1 = DateTime.Now - LastFetch;
if (pass == 0) if (pass == 0)
ProcessSubchannel(sector, Sectors2Read, true); ProcessSubchannel(sector, Sectors2Read, true);
//DateTime LastFetched = DateTime.Now; //DateTime LastFetched = DateTime.Now;
CorrectSectors(Math.Min(pass, MAXSCANS - 1), sector, Sectors2Read, pass >= MAXSCANS - 1, pass == MAXSCANS - 1 + nExtraPasses); if ((pass & 1) == 0)
PrintErrors(Math.Min(pass, MAXSCANS - 1), sector, Sectors2Read, /*realData*/null); {
CorrectSectors(pass, sector, Sectors2Read, pass >= max_scans);
PrintErrors(pass, sector, Sectors2Read, /*realData*/null);
}
//TimeSpan delay2 = DateTime.Now - LastFetched; //TimeSpan delay2 = DateTime.Now - LastFetched;
//if (sector == _currentStart) //if (sector == _currentStart)
//System.Console.WriteLine("\n{0},{1}", delay1.TotalMilliseconds, delay2.TotalMilliseconds); //System.Console.WriteLine("\n{0},{1}", delay1.TotalMilliseconds, delay2.TotalMilliseconds);
@@ -930,34 +889,8 @@ namespace CUETools.Ripper.SCSI
//System.Console.WriteLine(); //System.Console.WriteLine();
//if (CorrectSectorsTest(start, _currentEnd, 10, realData) == 0) //if (CorrectSectorsTest(start, _currentEnd, 10, realData) == 0)
// break; // break;
//if (pass == MAXSCANS - 1 + nExtraPasses) if ((pass & 1) == 0 && pass >= _correctionQuality && _currentErrorsCount == 0)
// break;
if (_currentErrorsCount == 0 && pass >= _correctionQuality)
break; break;
//if (_currentErrorsCount == 0 && pass >= _correctionQuality)
//{
// bool syncOk = true;
// //if (pass == 0)
// //{
// // ScanResults saved = _currentScan;
// // _currentScan = new ScanResults(_currentEnd - _currentStart, CB_AUDIO);
// // for (int sector = _currentStart; sector < _currentEnd && syncOk; sector += 7)
// // {
// // FetchSectors(sector, 2);
// // for (int i = 0; i < 2 * CB_AUDIO; i++)
// // if (_currentScan.Data[(sector - _currentStart) * CB_AUDIO + i] != saved.Data[(sector - _currentStart) * CB_AUDIO + i])
// // {
// // System.Console.WriteLine("Lost Sync");
// // syncOk = false;
// // break;
// // }
// // }
// // _currentScan = saved;
// //}
// if (syncOk)
// break;
//}
}
} }
} }

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D2700165-3E77-4B28-928D-551F5FC11954}</ProjectGuid> <ProjectGuid>{D2700165-3E77-4B28-928D-551F5FC11954}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
@@ -19,7 +19,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>

View File

@@ -67,12 +67,12 @@ namespace CUETools.TestCodecs
toc.AddTrack(new CDTrack(2, 68, 31, true, false)); toc.AddTrack(new CDTrack(2, 68, 31, true, false));
toc.AddTrack(new CDTrack(3, 99, 37, true, false)); toc.AddTrack(new CDTrack(3, 99, 37, true, false));
toc[1][0].Start = 0; toc[1][0].Start = 0;
ar = new AccurateRipVerify(toc); ar = new AccurateRipVerify(toc, null);
toc2 = new CDImageLayout(); toc2 = new CDImageLayout();
toc2.AddTrack(new CDTrack(1, 0, toc.AudioLength, true, false)); toc2.AddTrack(new CDTrack(1, 0, toc.AudioLength, true, false));
toc2.AddTrack(new CDTrack(2, toc.AudioLength, 750, true, false)); toc2.AddTrack(new CDTrack(2, toc.AudioLength, 750, true, false));
ar2 = new AccurateRipVerify(toc2); ar2 = new AccurateRipVerify(toc2, null);
Random rnd = new Random(2314); Random rnd = new Random(2314);
for (int sector = 0; sector < toc2.AudioLength; sector++) for (int sector = 0; sector < toc2.AudioLength; sector++)

View File

@@ -23,6 +23,7 @@ namespace CUETools.TestParity
static byte[] wav2 = new byte[finalSampleCount * 4]; static byte[] wav2 = new byte[finalSampleCount * 4];
static byte[] wav3 = new byte[finalSampleCount * 4]; static byte[] wav3 = new byte[finalSampleCount * 4];
static byte[] parity; static byte[] parity;
static uint crc;
const int offset = 48; const int offset = 48;
//const int offset = 5 * 588 - 5; //const int offset = 5 * 588 - 5;
//const int offset = 2000; //const int offset = 2000;
@@ -60,11 +61,12 @@ namespace CUETools.TestParity
wav2[(int)(rnd.NextDouble() * (wav2.Length - 1))] = (byte)(rnd.NextDouble() * 255); wav2[(int)(rnd.NextDouble() * (wav2.Length - 1))] = (byte)(rnd.NextDouble() * 255);
AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0); AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0);
CDRepairEncode encode = new CDRepairEncode(finalSampleCount, stride, npar, false); CDRepairEncode encode = new CDRepairEncode(finalSampleCount, stride, npar, false, true);
buff.Prepare(wav, finalSampleCount); buff.Prepare(wav, finalSampleCount);
encode.Write(buff); encode.Write(buff);
encode.Close(); encode.Close();
parity = encode.Parity; parity = encode.Parity;
crc = encode.CRC;
} }
// //
//Use ClassCleanup to run code after all tests in a class have run //Use ClassCleanup to run code after all tests in a class have run
@@ -95,13 +97,15 @@ namespace CUETools.TestParity
public void CDRepairDecodeOriginalTest() public void CDRepairDecodeOriginalTest()
{ {
AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0); AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0);
CDRepairEncode decode = new CDRepairEncode(finalSampleCount, stride, npar, true); CDRepairEncode decode = new CDRepairEncode(finalSampleCount, stride, npar, true, false);
buff.Prepare(wav, finalSampleCount); buff.Prepare(wav, finalSampleCount);
decode.Write(buff); decode.Write(buff);
decode.Close(); decode.Close();
decode.VerifyParity(parity); int actualOffset;
Assert.IsFalse(decode.HasErrors); bool hasErrors;
Assert.AreEqual(0, decode.ActualOffset, "wrong offset"); Assert.IsTrue(decode.FindOffset(npar, parity, 0, crc, out actualOffset, out hasErrors));
Assert.IsFalse(hasErrors, "has errors");
Assert.AreEqual(0, actualOffset, "wrong offset");
} }
/// <summary> /// <summary>
@@ -111,14 +115,18 @@ namespace CUETools.TestParity
public void CDRepairDecodeModifiedTest() public void CDRepairDecodeModifiedTest()
{ {
AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0); AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0);
CDRepairEncode decode = new CDRepairEncode(finalSampleCount, stride, npar, true); CDRepairEncode decode = new CDRepairEncode(finalSampleCount, stride, npar, true, false);
buff.Prepare(wav2, finalSampleCount); buff.Prepare(wav2, finalSampleCount);
decode.Write(buff); decode.Write(buff);
decode.Close(); decode.Close();
decode.VerifyParity(parity); int actualOffset;
Assert.IsTrue(decode.HasErrors, "doesn't have errors"); bool hasErrors;
Assert.IsTrue(decode.CanRecover, "cannot recover"); Assert.IsTrue(decode.FindOffset(npar, parity, 0, crc, out actualOffset, out hasErrors));
Assert.AreEqual(0, decode.ActualOffset, "wrong offset"); Assert.IsTrue(hasErrors, "doesn't have errors");
Assert.AreEqual(0, actualOffset, "wrong offset");
CDRepairFix fix = decode.VerifyParity(parity, actualOffset);
Assert.IsTrue(fix.HasErrors, "doesn't have errors");
Assert.IsTrue(fix.CanRecover, "cannot recover");
} }
/// <summary> /// <summary>
@@ -128,14 +136,16 @@ namespace CUETools.TestParity
public void CDRepairDecodePositiveOffsetTest() public void CDRepairDecodePositiveOffsetTest()
{ {
AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0); AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0);
CDRepairEncode decode = new CDRepairEncode(finalSampleCount, stride, npar, true); CDRepairEncode decode = new CDRepairEncode(finalSampleCount, stride, npar, true, false);
Array.Copy(wav, offset * 4, wav3, 0, (finalSampleCount - offset) * 4); Array.Copy(wav, offset * 4, wav3, 0, (finalSampleCount - offset) * 4);
buff.Prepare(wav3, finalSampleCount); buff.Prepare(wav3, finalSampleCount);
decode.Write(buff); decode.Write(buff);
decode.Close(); decode.Close();
decode.VerifyParity(parity); int actualOffset;
Assert.IsFalse(decode.HasErrors, "has errors"); bool hasErrors;
Assert.AreEqual(offset, decode.ActualOffset, "wrong offset"); Assert.IsTrue(decode.FindOffset(npar, parity, 0, crc, out actualOffset, out hasErrors));
Assert.IsFalse(hasErrors, "has errors");
Assert.AreEqual(offset, actualOffset, "wrong offset");
} }
/// <summary> /// <summary>
@@ -145,15 +155,17 @@ namespace CUETools.TestParity
public void CDRepairDecodeNegativeOffsetTest() public void CDRepairDecodeNegativeOffsetTest()
{ {
AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0); AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0);
CDRepairEncode decode = new CDRepairEncode(finalSampleCount, stride, npar, true); CDRepairEncode decode = new CDRepairEncode(finalSampleCount, stride, npar, true, false);
buff.Prepare(new byte[offset * 4], offset); buff.Prepare(new byte[offset * 4], offset);
decode.Write(buff); decode.Write(buff);
buff.Prepare(wav, finalSampleCount - offset); buff.Prepare(wav, finalSampleCount - offset);
decode.Write(buff); decode.Write(buff);
decode.Close(); decode.Close();
decode.VerifyParity(parity); int actualOffset;
Assert.IsFalse(decode.HasErrors, "has errors"); bool hasErrors;
Assert.AreEqual(-offset, decode.ActualOffset, "wrong offset"); Assert.IsTrue(decode.FindOffset(npar, parity, 0, crc, out actualOffset, out hasErrors));
Assert.IsFalse(hasErrors, "has errors");
Assert.AreEqual(-offset, actualOffset, "wrong offset");
} }
/// <summary> /// <summary>
@@ -163,15 +175,19 @@ namespace CUETools.TestParity
public void CDRepairDecodePositiveOffsetErrorsTest() public void CDRepairDecodePositiveOffsetErrorsTest()
{ {
AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0); AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0);
CDRepairEncode decode = new CDRepairEncode(finalSampleCount, stride, npar, true); CDRepairEncode decode = new CDRepairEncode(finalSampleCount, stride, npar, true, false);
Array.Copy(wav2, offset * 4, wav3, 0, (finalSampleCount - offset) * 4); Array.Copy(wav2, offset * 4, wav3, 0, (finalSampleCount - offset) * 4);
buff.Prepare(wav3, finalSampleCount); buff.Prepare(wav3, finalSampleCount);
decode.Write(buff); decode.Write(buff);
decode.Close(); decode.Close();
decode.VerifyParity(parity); int actualOffset;
Assert.IsTrue(decode.HasErrors, "doesn't have errors"); bool hasErrors;
Assert.IsTrue(decode.CanRecover, "cannot recover"); Assert.IsTrue(decode.FindOffset(npar, parity, 0, crc, out actualOffset, out hasErrors));
Assert.AreEqual(offset, decode.ActualOffset, "wrong offset"); Assert.IsTrue(hasErrors, "doesn't have errors");
Assert.AreEqual(offset, actualOffset, "wrong offset");
CDRepairFix fix = decode.VerifyParity(parity, actualOffset);
Assert.IsTrue(fix.HasErrors, "doesn't have errors");
Assert.IsTrue(fix.CanRecover, "cannot recover");
} }
/// <summary> /// <summary>
@@ -181,16 +197,20 @@ namespace CUETools.TestParity
public void CDRepairDecodeNegativeOffsetErrorsTest() public void CDRepairDecodeNegativeOffsetErrorsTest()
{ {
AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0); AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0);
CDRepairEncode decode = new CDRepairEncode(finalSampleCount, stride, npar, true); CDRepairEncode decode = new CDRepairEncode(finalSampleCount, stride, npar, true, false);
buff.Prepare(new byte[offset * 4], offset); buff.Prepare(new byte[offset * 4], offset);
decode.Write(buff); decode.Write(buff);
buff.Prepare(wav2, finalSampleCount - offset); buff.Prepare(wav2, finalSampleCount - offset);
decode.Write(buff); decode.Write(buff);
decode.Close(); decode.Close();
decode.VerifyParity(parity); int actualOffset;
Assert.IsTrue(decode.HasErrors, "doesn't have errors"); bool hasErrors;
Assert.IsTrue(decode.CanRecover, "cannot recover"); Assert.IsTrue(decode.FindOffset(npar, parity, 0, crc, out actualOffset, out hasErrors));
Assert.AreEqual(-offset, decode.ActualOffset, "wrong offset"); Assert.IsTrue(hasErrors, "doesn't have errors");
Assert.AreEqual(-offset, actualOffset, "wrong offset");
CDRepairFix fix = decode.VerifyParity(parity, actualOffset);
Assert.IsTrue(fix.HasErrors, "doesn't have errors");
Assert.IsTrue(fix.CanRecover, "cannot recover");
} }
} }
} }

View File

@@ -90,7 +90,7 @@ namespace CUETools.TestParity
public void CDRepairEncodeWriteTest() public void CDRepairEncodeWriteTest()
{ {
AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0); AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0);
CDRepairEncode encode = new CDRepairEncode(finalSampleCount, stride, npar, false); CDRepairEncode encode = new CDRepairEncode(finalSampleCount, stride, npar, false, true);
buff.Prepare(wav, finalSampleCount); buff.Prepare(wav, finalSampleCount);
encode.Write(buff); encode.Write(buff);
encode.Close(); encode.Close();

View File

@@ -27,6 +27,8 @@ namespace CUETools.TestParity
static uint crc; static uint crc;
static CDRepairEncode decode; static CDRepairEncode decode;
static CDRepairEncode decode2; static CDRepairEncode decode2;
static CDRepairFix fix;
static CDRepairFix fix2;
const int offset = 48; const int offset = 48;
/// <summary> /// <summary>
@@ -60,26 +62,31 @@ namespace CUETools.TestParity
wav2[(int)(rnd.NextDouble() * (wav2.Length - 1))] = (byte)(rnd.NextDouble() * 255); wav2[(int)(rnd.NextDouble() * (wav2.Length - 1))] = (byte)(rnd.NextDouble() * 255);
AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0); AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0);
CDRepairEncode encode = new CDRepairEncode(finalSampleCount, stride, npar, false); CDRepairEncode encode = new CDRepairEncode(finalSampleCount, stride, npar, false, true);
buff.Prepare(wav, finalSampleCount); buff.Prepare(wav, finalSampleCount);
encode.Write(buff); encode.Write(buff);
encode.Close(); encode.Close();
parity = encode.Parity; parity = encode.Parity;
crc = encode.CRC; crc = encode.CRC;
decode = new CDRepairEncode(finalSampleCount, stride, npar, true); decode = new CDRepairEncode(finalSampleCount, stride, npar, true, false);
buff.Prepare(wav2, finalSampleCount); buff.Prepare(wav2, finalSampleCount);
decode.Write(buff); decode.Write(buff);
decode.Close(); decode.Close();
decode.VerifyParity(parity);
decode2 = new CDRepairEncode(finalSampleCount, stride, npar, true); int actualOffset;
bool hasErrors;
decode.FindOffset(npar, parity, 0, crc, out actualOffset, out hasErrors);
fix = decode.VerifyParity(parity, actualOffset);
decode2 = new CDRepairEncode(finalSampleCount, stride, npar, true, false);
buff.Prepare(new byte[offset * 4], offset); buff.Prepare(new byte[offset * 4], offset);
decode2.Write(buff); decode2.Write(buff);
buff.Prepare(wav2, finalSampleCount - offset); buff.Prepare(wav2, finalSampleCount - offset);
decode2.Write(buff); decode2.Write(buff);
decode2.Close(); decode2.Close();
decode2.VerifyParity(parity); decode2.FindOffset(npar, parity, 0, crc, out actualOffset, out hasErrors);
fix2 = decode2.VerifyParity(parity, actualOffset);
} }
//Use ClassCleanup to run code after all tests in a class have run //Use ClassCleanup to run code after all tests in a class have run
@@ -108,12 +115,11 @@ namespace CUETools.TestParity
[TestMethod()] [TestMethod()]
public void CDRepairFixTest() public void CDRepairFixTest()
{ {
Assert.IsTrue(decode.HasErrors); Assert.IsTrue(fix.HasErrors);
Assert.IsTrue(decode.CanRecover); Assert.IsTrue(fix.CanRecover);
Assert.AreEqual(0, decode.ActualOffset, "wrong offset"); Assert.AreEqual(0, fix.ActualOffset, "wrong offset");
AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0); AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0);
CDRepairFix fix = new CDRepairFix(decode);
buff.Prepare(wav2, finalSampleCount); buff.Prepare(wav2, finalSampleCount);
fix.Write(buff); fix.Write(buff);
fix.Close(); fix.Close();
@@ -127,19 +133,18 @@ namespace CUETools.TestParity
[TestMethod()] [TestMethod()]
public void CDRepairFixWithOffsetTest() public void CDRepairFixWithOffsetTest()
{ {
Assert.IsTrue(decode2.HasErrors); Assert.IsTrue(fix2.HasErrors);
Assert.IsTrue(decode2.CanRecover); Assert.IsTrue(fix2.CanRecover);
Assert.AreEqual(-offset, decode2.ActualOffset, "wrong offset"); Assert.AreEqual(-offset, fix2.ActualOffset, "wrong offset");
AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0); AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0);
CDRepairFix fix = new CDRepairFix(decode2);
buff.Prepare(new byte[offset * 4], offset); buff.Prepare(new byte[offset * 4], offset);
fix.Write(buff); fix2.Write(buff);
buff.Prepare(wav2, finalSampleCount - offset); buff.Prepare(wav2, finalSampleCount - offset);
fix.Write(buff); fix2.Write(buff);
fix.Close(); fix2.Close();
Assert.AreEqual<uint>(crc, fix.CRC); Assert.AreEqual<uint>(crc, fix2.CRC);
} }
} }
} }

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{EF351583-A9CD-4530-92C3-20AC02136BC2}</ProjectGuid> <ProjectGuid>{EF351583-A9CD-4530-92C3-20AC02136BC2}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
@@ -15,6 +15,12 @@
<GenerateManifests>false</GenerateManifests> <GenerateManifests>false</GenerateManifests>
<SignManifests>true</SignManifests> <SignManifests>true</SignManifests>
<IsWebBootstrapper>true</IsWebBootstrapper> <IsWebBootstrapper>true</IsWebBootstrapper>
<TargetZone>LocalIntranet</TargetZone>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<PublishUrl>ftp://cuetools.net/cuetools.net/install/cuetools/</PublishUrl> <PublishUrl>ftp://cuetools.net/cuetools.net/install/cuetools/</PublishUrl>
<Install>true</Install> <Install>true</Install>
<InstallFrom>Web</InstallFrom> <InstallFrom>Web</InstallFrom>
@@ -31,21 +37,16 @@
<PublisherName>CUETools</PublisherName> <PublisherName>CUETools</PublisherName>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish> <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage> <WebPage>publish.htm</WebPage>
<ApplicationVersion>2.0.3.%2a</ApplicationVersion>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetZone>LocalIntranet</TargetZone>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<ApplicationRevision>7</ApplicationRevision> <ApplicationRevision>7</ApplicationRevision>
<UpgradeBackupLocation> <ApplicationVersion>2.0.3.%2a</ApplicationVersion>
</UpgradeBackupLocation> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@@ -227,6 +228,10 @@
<Project>{14EE067E-C218-4625-9540-2361AB27C4A6}</Project> <Project>{14EE067E-C218-4625-9540-2361AB27C4A6}</Project>
<Name>CUETools.Compression</Name> <Name>CUETools.Compression</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\CUETools.CTDB\CUETools.CTDB.csproj">
<Project>{AA2A9A7E-45FB-4632-AD85-85B0E556F818}</Project>
<Name>CUETools.CTDB</Name>
</ProjectReference>
<ProjectReference Include="..\CUETools.Processor\CUETools.Processor.csproj"> <ProjectReference Include="..\CUETools.Processor\CUETools.Processor.csproj">
<Project>{4911BD82-49EF-4858-8B51-5394F86739A4}</Project> <Project>{4911BD82-49EF-4858-8B51-5394F86739A4}</Project>
<Name>CUETools.Processor</Name> <Name>CUETools.Processor</Name>
@@ -264,6 +269,8 @@
<None Include="Resources\link_go.png" /> <None Include="Resources\link_go.png" />
<None Include="Resources\basket.png" /> <None Include="Resources\basket.png" />
<None Include="Resources\delete.png" /> <None Include="Resources\delete.png" />
<None Include="Resources\cdrepair.ico" />
<None Include="Resources\cdrepair.png" />
<Content Include="unrar.dll"> <Content Include="unrar.dll">
</Content> </Content>
<Content Include="Resources\accuraterip_16.bmp" /> <Content Include="Resources\accuraterip_16.bmp" />
@@ -301,11 +308,31 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0"> <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible> <Visible>False</Visible>
<ProductName>.NET Framework 2.0</ProductName> <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install> <Install>true</Install>
</BootstrapperPackage> </BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Visual.C++.8.0.x86"> <BootstrapperPackage Include="Microsoft.Visual.C++.8.0.x86">
<Visible>False</Visible> <Visible>False</Visible>
<ProductName>Visual C++ Runtime Libraries %28x86%29</ProductName> <ProductName>Visual C++ Runtime Libraries %28x86%29</ProductName>
@@ -320,6 +347,7 @@
<TargetPath> <TargetPath>
</TargetPath> </TargetPath>
<PublishState>Include</PublishState> <PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Satellite</FileType> <FileType>Satellite</FileType>
</PublishFile> </PublishFile>
<PublishFile Include="ru-RU\CUETools.resources"> <PublishFile Include="ru-RU\CUETools.resources">
@@ -329,6 +357,7 @@
<TargetPath> <TargetPath>
</TargetPath> </TargetPath>
<PublishState>Include</PublishState> <PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Satellite</FileType> <FileType>Satellite</FileType>
</PublishFile> </PublishFile>
</ItemGroup> </ItemGroup>

View File

@@ -143,6 +143,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUETools.Compression.Zip",
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUETools.Ripper", "..\CUETools.Ripper\CUETools.Ripper.csproj", "{D2700165-3E77-4B28-928D-551F5FC11954}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUETools.Ripper", "..\CUETools.Ripper\CUETools.Ripper.csproj", "{D2700165-3E77-4B28-928D-551F5FC11954}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRipper", "TestRipper\TestRipper.csproj", "{5C8B61C0-BC3D-4316-B8A7-419D55BB5796}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUETools.Parity", "..\CUETools.Parity\CUETools.Parity.csproj", "{ECEB839C-171B-4535-958F-9899310A0342}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUETools.TestParity", "CUETools.TestParity\CUETools.TestParity.csproj", "{6C74652F-1EF4-459E-84F4-99D93D3D17DA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUETools.CDRepair", "..\CUETools.CDRepair\CUETools.CDRepair.csproj", "{C4869B37-EBB1-47BB-9406-B1209BEAB84B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUETools.CTDB", "..\CUETools.CTDB\CUETools.CTDB.csproj", "{AA2A9A7E-45FB-4632-AD85-85B0E556F818}"
EndProject
Global Global
GlobalSection(TestCaseManagementSettings) = postSolution GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = CUETools1.vsmdi CategoryFile = CUETools1.vsmdi
@@ -510,6 +520,46 @@ Global
{D2700165-3E77-4B28-928D-551F5FC11954}.Release|Any CPU.Build.0 = Release|Any CPU {D2700165-3E77-4B28-928D-551F5FC11954}.Release|Any CPU.Build.0 = Release|Any CPU
{D2700165-3E77-4B28-928D-551F5FC11954}.Release|Win32.ActiveCfg = Release|Any CPU {D2700165-3E77-4B28-928D-551F5FC11954}.Release|Win32.ActiveCfg = Release|Any CPU
{D2700165-3E77-4B28-928D-551F5FC11954}.Release|x64.ActiveCfg = Release|Any CPU {D2700165-3E77-4B28-928D-551F5FC11954}.Release|x64.ActiveCfg = Release|Any CPU
{5C8B61C0-BC3D-4316-B8A7-419D55BB5796}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C8B61C0-BC3D-4316-B8A7-419D55BB5796}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C8B61C0-BC3D-4316-B8A7-419D55BB5796}.Debug|Win32.ActiveCfg = Debug|Any CPU
{5C8B61C0-BC3D-4316-B8A7-419D55BB5796}.Debug|x64.ActiveCfg = Debug|Any CPU
{5C8B61C0-BC3D-4316-B8A7-419D55BB5796}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C8B61C0-BC3D-4316-B8A7-419D55BB5796}.Release|Any CPU.Build.0 = Release|Any CPU
{5C8B61C0-BC3D-4316-B8A7-419D55BB5796}.Release|Win32.ActiveCfg = Release|Any CPU
{5C8B61C0-BC3D-4316-B8A7-419D55BB5796}.Release|x64.ActiveCfg = Release|Any CPU
{ECEB839C-171B-4535-958F-9899310A0342}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ECEB839C-171B-4535-958F-9899310A0342}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ECEB839C-171B-4535-958F-9899310A0342}.Debug|Win32.ActiveCfg = Debug|Any CPU
{ECEB839C-171B-4535-958F-9899310A0342}.Debug|x64.ActiveCfg = Debug|Any CPU
{ECEB839C-171B-4535-958F-9899310A0342}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ECEB839C-171B-4535-958F-9899310A0342}.Release|Any CPU.Build.0 = Release|Any CPU
{ECEB839C-171B-4535-958F-9899310A0342}.Release|Win32.ActiveCfg = Release|Any CPU
{ECEB839C-171B-4535-958F-9899310A0342}.Release|x64.ActiveCfg = Release|Any CPU
{6C74652F-1EF4-459E-84F4-99D93D3D17DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C74652F-1EF4-459E-84F4-99D93D3D17DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C74652F-1EF4-459E-84F4-99D93D3D17DA}.Debug|Win32.ActiveCfg = Debug|Any CPU
{6C74652F-1EF4-459E-84F4-99D93D3D17DA}.Debug|x64.ActiveCfg = Debug|Any CPU
{6C74652F-1EF4-459E-84F4-99D93D3D17DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C74652F-1EF4-459E-84F4-99D93D3D17DA}.Release|Any CPU.Build.0 = Release|Any CPU
{6C74652F-1EF4-459E-84F4-99D93D3D17DA}.Release|Win32.ActiveCfg = Release|Any CPU
{6C74652F-1EF4-459E-84F4-99D93D3D17DA}.Release|x64.ActiveCfg = Release|Any CPU
{C4869B37-EBB1-47BB-9406-B1209BEAB84B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C4869B37-EBB1-47BB-9406-B1209BEAB84B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C4869B37-EBB1-47BB-9406-B1209BEAB84B}.Debug|Win32.ActiveCfg = Debug|Any CPU
{C4869B37-EBB1-47BB-9406-B1209BEAB84B}.Debug|x64.ActiveCfg = Debug|Any CPU
{C4869B37-EBB1-47BB-9406-B1209BEAB84B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4869B37-EBB1-47BB-9406-B1209BEAB84B}.Release|Any CPU.Build.0 = Release|Any CPU
{C4869B37-EBB1-47BB-9406-B1209BEAB84B}.Release|Win32.ActiveCfg = Release|Any CPU
{C4869B37-EBB1-47BB-9406-B1209BEAB84B}.Release|x64.ActiveCfg = Release|Any CPU
{AA2A9A7E-45FB-4632-AD85-85B0E556F818}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA2A9A7E-45FB-4632-AD85-85B0E556F818}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA2A9A7E-45FB-4632-AD85-85B0E556F818}.Debug|Win32.ActiveCfg = Debug|Any CPU
{AA2A9A7E-45FB-4632-AD85-85B0E556F818}.Debug|x64.ActiveCfg = Debug|Any CPU
{AA2A9A7E-45FB-4632-AD85-85B0E556F818}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA2A9A7E-45FB-4632-AD85-85B0E556F818}.Release|Any CPU.Build.0 = Release|Any CPU
{AA2A9A7E-45FB-4632-AD85-85B0E556F818}.Release|Win32.ActiveCfg = Release|Any CPU
{AA2A9A7E-45FB-4632-AD85-85B0E556F818}.Release|x64.ActiveCfg = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@@ -546,6 +596,8 @@ Global
{DDE1EA77-637C-4D5F-96F3-1328BC45CE80} = {93B7AE1D-DEF6-4A04-A222-5CDE09DF262D} {DDE1EA77-637C-4D5F-96F3-1328BC45CE80} = {93B7AE1D-DEF6-4A04-A222-5CDE09DF262D}
{04945FB2-8410-4F14-8262-2ED18DCDACD6} = {D9D97BB6-002F-4858-8EF2-49B4C4C4DDB4} {04945FB2-8410-4F14-8262-2ED18DCDACD6} = {D9D97BB6-002F-4858-8EF2-49B4C4C4DDB4}
{A430AD28-B76A-4ED0-AF7D-D13B8969297F} = {D9D97BB6-002F-4858-8EF2-49B4C4C4DDB4} {A430AD28-B76A-4ED0-AF7D-D13B8969297F} = {D9D97BB6-002F-4858-8EF2-49B4C4C4DDB4}
{5C8B61C0-BC3D-4316-B8A7-419D55BB5796} = {D9D97BB6-002F-4858-8EF2-49B4C4C4DDB4}
{6C74652F-1EF4-459E-84F4-99D93D3D17DA} = {D9D97BB6-002F-4858-8EF2-49B4C4C4DDB4}
{B75FA7AD-968E-4990-B342-1B4B17C850DF} = {B36BE134-D85A-437E-AB61-2DA1CCDE06C1} {B75FA7AD-968E-4990-B342-1B4B17C850DF} = {B36BE134-D85A-437E-AB61-2DA1CCDE06C1}
{F2DFEB00-BB35-4665-85EA-CB8C7729A6B7} = {B36BE134-D85A-437E-AB61-2DA1CCDE06C1} {F2DFEB00-BB35-4665-85EA-CB8C7729A6B7} = {B36BE134-D85A-437E-AB61-2DA1CCDE06C1}
{A05B6AA6-0EC3-495D-BCC4-ECE1210071A8} = {B36BE134-D85A-437E-AB61-2DA1CCDE06C1} {A05B6AA6-0EC3-495D-BCC4-ECE1210071A8} = {B36BE134-D85A-437E-AB61-2DA1CCDE06C1}

View File

@@ -88,6 +88,20 @@ namespace JDP.Properties {
} }
} }
internal static System.Drawing.Icon cdrepair {
get {
object obj = ResourceManager.GetObject("cdrepair", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
internal static System.Drawing.Bitmap cdrepair1 {
get {
object obj = ResourceManager.GetObject("cdrepair1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap cog { internal static System.Drawing.Bitmap cog {
get { get {
object obj = ResourceManager.GetObject("cog", resourceCulture); object obj = ResourceManager.GetObject("cog", resourceCulture);

View File

@@ -238,4 +238,10 @@
<data name="delete" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="cdrepair" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cdrepair.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="cdrepair1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cdrepair.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

View File

@@ -0,0 +1,152 @@
using System;
using System.Text;
using System.Collections.Generic;
using CUETools.Codecs;
using CUETools.Ripper;
using CUETools.Ripper.SCSI;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace TestRipper
{
/// <summary>
///This is a test class for CDDriveReaderTest and is intended
///to contain all CDDriveReaderTest Unit Tests
///</summary>
[TestClass()]
public class CDDriveReaderTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
const int pass = 16;
const int Sectors2Read = 10000;
const int bit_weight = 3;
const int c2_weight = 1;
bool markErrors = true;
int _currentStart = 0, _realErrors = 0;
byte[] _currentData = new byte[Sectors2Read * 4 * 588];
static long[,] UserData = new long[Sectors2Read, 4 * 588];
static long[,] C2Data = new long[Sectors2Read, 4 * 588 / 8];
static byte[] _realData = new byte[Sectors2Read * 4 * 588];
static long[] byte2long = new long[256];
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
[ClassInitialize()]
public static void MyClassInitialize(TestContext testContext)
{
for (long i = 0; i < 256; i++)
{
long bl = 0;
for (int b = 0; b < 8; b++)
bl += ((i >> b) & 1) << (b << 3);
byte2long[i] = bl;
}
Random rnd = new Random(2314);
rnd.NextBytes(_realData);
for (int p = 0; p <= pass; p++)
for (int iSector = 0; iSector < Sectors2Read; iSector++)
for (int iPar = 0; iPar < 4 * 588; iPar++)
{
bool error = rnd.NextDouble() < 0.2;
byte val = error ? (byte)rnd.Next(255) : _realData[iSector * 4 * 588 + iPar];
UserData[iSector, iPar] += byte2long[val] * bit_weight;
if (error && rnd.NextDouble() < 0.5)
{
C2Data[iSector, iPar >> 3] += (iPar & 7) * 8;
UserData[iSector, iPar] += 0x0101010101010101 * (bit_weight / 2) + byte2long[val] * (c2_weight - bit_weight);
}
}
}
//
//Use ClassCleanup to run code after all tests in a class have run
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
[TestInitialize()]
public void MyTestInitialize()
{
}
//
//Use TestCleanup to run code after each test has run
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for CorrectSectors
///</summary>
[TestMethod()]
[DeploymentItem("CUETools.Ripper.SCSI.dll")]
public void CorrectSectorsTest()
{
int _currentErrorsCount = 0;
int sector = 0;
for (int iSector = 0; iSector < Sectors2Read; iSector++)
{
int pos = sector - _currentStart + iSector;
int avg = (pass + 1) * bit_weight / 2;
int c2_limit = pass / 3; //
int er_limit = avg - pass; // allow 33% minority
for (int iPar = 0; iPar < 4 * 588; iPar++)
{
long val = UserData[pos, iPar];
byte c2 = (byte)(C2Data[pos, iPar >> 3] >> ((iPar & 7) * 8));
int bestValue = 0;
for (int i = 0; i < 8; i++)
{
int sum = avg - ((int)(val & 0xff));
int sig = sum >> 31; // bit value
if ((sum ^ sig) < er_limit) _currentErrorsCount++;
bestValue += sig & (1 << i);
val >>= 8;
}
//if (c2 > c2_limit)
//_currentErrorsCount++;
_currentData[pos * 4 * 588 + iPar] = (byte)bestValue;
}
}
for (int p = 0; p <= pass; p++)
for (int iSector = 0; iSector < Sectors2Read; iSector++)
for (int iPar = 0; iPar < 4 * 588; iPar++)
if (_realData[iSector * 4 * 588 + iPar] != _currentData[iSector * 4 * 588 + iPar])
_realErrors++;
Assert.AreEqual<int>(0, _realErrors, "0 != _realErrors; _currentErrorsCount == " + _currentErrorsCount.ToString());
//CollectionAssert.AreEqual(_realData, _currentData, "_realData != _currentData");
Assert.AreEqual<int>(0, _currentErrorsCount, "_currentErrorsCount != 0");
}
}
}

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TestRipper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("TestRipper")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM componenets. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("18afe9af-ef9e-48f4-87cf-76b1ba9f295d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,85 @@
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{5C8B61C0-BC3D-4316-B8A7-419D55BB5796}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TestRipper</RootNamespace>
<AssemblyName>TestRipper</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkSubset>
</TargetFrameworkSubset>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CDDriveReaderTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Bwg.Logging\Bwg.Logging.csproj">
<Project>{F2DFEB00-BB35-4665-85EA-CB8C7729A6B7}</Project>
<Name>Bwg.Logging</Name>
</ProjectReference>
<ProjectReference Include="..\..\Bwg.Scsi\Bwg.Scsi.csproj">
<Project>{A05B6AA6-0EC3-495D-BCC4-ECE1210071A8}</Project>
<Name>Bwg.Scsi</Name>
</ProjectReference>
<ProjectReference Include="..\..\CUETools.CDImage\CUETools.CDImage.csproj">
<Project>{1DD41038-D885-46C5-8DDE-E0B82F066584}</Project>
<Name>CUETools.CDImage</Name>
</ProjectReference>
<ProjectReference Include="..\..\CUETools.Codecs\CUETools.Codecs.csproj">
<Project>{6458A13A-30EF-45A9-9D58-E5031B17BEE2}</Project>
<Name>CUETools.Codecs</Name>
</ProjectReference>
<ProjectReference Include="..\..\CUETools.Ripper.SCSI\CUETools.Ripper.SCSI.csproj">
<Project>{8CF07381-BEA2-4AFC-B3DD-9B2F21C65A3A}</Project>
<Name>CUETools.Ripper.SCSI</Name>
</ProjectReference>
<ProjectReference Include="..\..\CUETools.Ripper\CUETools.Ripper.csproj">
<Project>{D2700165-3E77-4B28-928D-551F5FC11954}</Project>
<Name>CUETools.Ripper</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Test References\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>

View File

@@ -28,8 +28,9 @@ namespace JDP {
this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabelAR = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabelProcessed = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabelProcessed = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabelCTDB = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabelAR = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar(); this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar();
this.toolStripProgressBar2 = new System.Windows.Forms.ToolStripProgressBar(); this.toolStripProgressBar2 = new System.Windows.Forms.ToolStripProgressBar();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
@@ -51,6 +52,8 @@ namespace JDP {
this.toolStripMenuItemCorrectorModeLocateFiles = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemCorrectorModeLocateFiles = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemCorrectorModeChangeExtension = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemCorrectorModeChangeExtension = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripDropDownButtonCorrectorFormat = new System.Windows.Forms.ToolStripDropDownButton(); this.toolStripDropDownButtonCorrectorFormat = new System.Windows.Forms.ToolStripDropDownButton();
this.tableLayoutPanelVerifyMode = new System.Windows.Forms.TableLayoutPanel();
this.checkBoxVerifyUseCDRepair = new System.Windows.Forms.CheckBox();
this.grpAudioOutput = new System.Windows.Forms.GroupBox(); this.grpAudioOutput = new System.Windows.Forms.GroupBox();
this.labelEncoderMaxMode = new System.Windows.Forms.Label(); this.labelEncoderMaxMode = new System.Windows.Forms.Label();
this.labelEncoderMinMode = new System.Windows.Forms.Label(); this.labelEncoderMinMode = new System.Windows.Forms.Label();
@@ -130,6 +133,7 @@ namespace JDP {
this.groupBoxMode.SuspendLayout(); this.groupBoxMode.SuspendLayout();
this.tableLayoutPanelCUEStyle.SuspendLayout(); this.tableLayoutPanelCUEStyle.SuspendLayout();
this.toolStripCorrectorFormat.SuspendLayout(); this.toolStripCorrectorFormat.SuspendLayout();
this.tableLayoutPanelVerifyMode.SuspendLayout();
this.grpAudioOutput.SuspendLayout(); this.grpAudioOutput.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarEncoderMode)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBarEncoderMode)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxMotd)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxMotd)).BeginInit();
@@ -177,8 +181,9 @@ namespace JDP {
resources.ApplyResources(this.statusStrip1, "statusStrip1"); resources.ApplyResources(this.statusStrip1, "statusStrip1");
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1, this.toolStripStatusLabel1,
this.toolStripStatusLabelAR,
this.toolStripStatusLabelProcessed, this.toolStripStatusLabelProcessed,
this.toolStripStatusLabelCTDB,
this.toolStripStatusLabelAR,
this.toolStripProgressBar1, this.toolStripProgressBar1,
this.toolStripProgressBar2}); this.toolStripProgressBar2});
this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Name = "statusStrip1";
@@ -190,13 +195,6 @@ namespace JDP {
resources.ApplyResources(this.toolStripStatusLabel1, "toolStripStatusLabel1"); resources.ApplyResources(this.toolStripStatusLabel1, "toolStripStatusLabel1");
this.toolStripStatusLabel1.Spring = true; this.toolStripStatusLabel1.Spring = true;
// //
// toolStripStatusLabelAR
//
resources.ApplyResources(this.toolStripStatusLabelAR, "toolStripStatusLabelAR");
this.toolStripStatusLabelAR.Image = global::JDP.Properties.Resources.AR;
this.toolStripStatusLabelAR.Name = "toolStripStatusLabelAR";
this.toolStripStatusLabelAR.Padding = new System.Windows.Forms.Padding(0, 0, 5, 0);
//
// toolStripStatusLabelProcessed // toolStripStatusLabelProcessed
// //
this.toolStripStatusLabelProcessed.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top) this.toolStripStatusLabelProcessed.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top)
@@ -206,6 +204,27 @@ namespace JDP {
this.toolStripStatusLabelProcessed.Name = "toolStripStatusLabelProcessed"; this.toolStripStatusLabelProcessed.Name = "toolStripStatusLabelProcessed";
resources.ApplyResources(this.toolStripStatusLabelProcessed, "toolStripStatusLabelProcessed"); resources.ApplyResources(this.toolStripStatusLabelProcessed, "toolStripStatusLabelProcessed");
// //
// toolStripStatusLabelCTDB
//
this.toolStripStatusLabelCTDB.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top)
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
this.toolStripStatusLabelCTDB.BorderStyle = System.Windows.Forms.Border3DStyle.SunkenOuter;
resources.ApplyResources(this.toolStripStatusLabelCTDB, "toolStripStatusLabelCTDB");
this.toolStripStatusLabelCTDB.Image = global::JDP.Properties.Resources.cdrepair1;
this.toolStripStatusLabelCTDB.Name = "toolStripStatusLabelCTDB";
//
// toolStripStatusLabelAR
//
this.toolStripStatusLabelAR.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top)
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
this.toolStripStatusLabelAR.BorderStyle = System.Windows.Forms.Border3DStyle.SunkenOuter;
resources.ApplyResources(this.toolStripStatusLabelAR, "toolStripStatusLabelAR");
this.toolStripStatusLabelAR.Image = global::JDP.Properties.Resources.AR;
this.toolStripStatusLabelAR.Name = "toolStripStatusLabelAR";
this.toolStripStatusLabelAR.Padding = new System.Windows.Forms.Padding(0, 0, 5, 0);
//
// toolStripProgressBar1 // toolStripProgressBar1
// //
this.toolStripProgressBar1.AutoToolTip = true; this.toolStripProgressBar1.AutoToolTip = true;
@@ -287,6 +306,7 @@ namespace JDP {
// //
this.groupBoxMode.Controls.Add(this.tableLayoutPanelCUEStyle); this.groupBoxMode.Controls.Add(this.tableLayoutPanelCUEStyle);
this.groupBoxMode.Controls.Add(this.toolStripCorrectorFormat); this.groupBoxMode.Controls.Add(this.toolStripCorrectorFormat);
this.groupBoxMode.Controls.Add(this.tableLayoutPanelVerifyMode);
resources.ApplyResources(this.groupBoxMode, "groupBoxMode"); resources.ApplyResources(this.groupBoxMode, "groupBoxMode");
this.groupBoxMode.Name = "groupBoxMode"; this.groupBoxMode.Name = "groupBoxMode";
this.groupBoxMode.TabStop = false; this.groupBoxMode.TabStop = false;
@@ -409,6 +429,20 @@ namespace JDP {
this.toolStripDropDownButtonCorrectorFormat.Name = "toolStripDropDownButtonCorrectorFormat"; this.toolStripDropDownButtonCorrectorFormat.Name = "toolStripDropDownButtonCorrectorFormat";
this.toolStripDropDownButtonCorrectorFormat.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStripDropDownButtonCorrectorFormat_DropDownItemClicked); this.toolStripDropDownButtonCorrectorFormat.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStripDropDownButtonCorrectorFormat_DropDownItemClicked);
// //
// tableLayoutPanelVerifyMode
//
resources.ApplyResources(this.tableLayoutPanelVerifyMode, "tableLayoutPanelVerifyMode");
this.tableLayoutPanelVerifyMode.Controls.Add(this.checkBoxVerifyUseCDRepair, 0, 0);
this.tableLayoutPanelVerifyMode.Name = "tableLayoutPanelVerifyMode";
this.toolTip1.SetToolTip(this.tableLayoutPanelVerifyMode, resources.GetString("tableLayoutPanelVerifyMode.ToolTip"));
//
// checkBoxVerifyUseCDRepair
//
resources.ApplyResources(this.checkBoxVerifyUseCDRepair, "checkBoxVerifyUseCDRepair");
this.checkBoxVerifyUseCDRepair.Image = global::JDP.Properties.Resources.cdrepair1;
this.checkBoxVerifyUseCDRepair.Name = "checkBoxVerifyUseCDRepair";
this.checkBoxVerifyUseCDRepair.UseVisualStyleBackColor = true;
//
// grpAudioOutput // grpAudioOutput
// //
this.grpAudioOutput.Controls.Add(this.labelEncoderMaxMode); this.grpAudioOutput.Controls.Add(this.labelEncoderMaxMode);
@@ -997,6 +1031,8 @@ namespace JDP {
this.tableLayoutPanelCUEStyle.PerformLayout(); this.tableLayoutPanelCUEStyle.PerformLayout();
this.toolStripCorrectorFormat.ResumeLayout(false); this.toolStripCorrectorFormat.ResumeLayout(false);
this.toolStripCorrectorFormat.PerformLayout(); this.toolStripCorrectorFormat.PerformLayout();
this.tableLayoutPanelVerifyMode.ResumeLayout(false);
this.tableLayoutPanelVerifyMode.PerformLayout();
this.grpAudioOutput.ResumeLayout(false); this.grpAudioOutput.ResumeLayout(false);
this.grpAudioOutput.PerformLayout(); this.grpAudioOutput.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarEncoderMode)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBarEncoderMode)).EndInit();
@@ -1118,6 +1154,9 @@ namespace JDP {
private System.Windows.Forms.CheckBox checkBoxUseMusicBrainz; private System.Windows.Forms.CheckBox checkBoxUseMusicBrainz;
private System.Windows.Forms.CheckBox checkBoxUseAccurateRip; private System.Windows.Forms.CheckBox checkBoxUseAccurateRip;
private System.Windows.Forms.CheckBox checkBoxUseFreeDb; private System.Windows.Forms.CheckBox checkBoxUseFreeDb;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelVerifyMode;
private System.Windows.Forms.CheckBox checkBoxVerifyUseCDRepair;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelCTDB;
} }
} }

View File

@@ -479,6 +479,7 @@ namespace JDP {
string status = null; string status = null;
bool outputAudio = action == CUEAction.Encode && audioEncoderType != AudioEncoderType.NoAudio; bool outputAudio = action == CUEAction.Encode && audioEncoderType != AudioEncoderType.NoAudio;
bool useAR = action == CUEAction.Verify || (outputAudio && checkBoxUseAccurateRip.Checked); bool useAR = action == CUEAction.Verify || (outputAudio && checkBoxUseAccurateRip.Checked);
bool useCUEToolsDB = action == CUEAction.Verify && checkBoxVerifyUseCDRepair.Checked;
try try
{ {
@@ -704,7 +705,7 @@ namespace JDP {
} }
else else
{ {
if (Directory.Exists(pathIn)) if (Directory.Exists(pathIn) && !IsCDROM(pathIn))
{ {
if (_batchPaths.Count == 0) if (_batchPaths.Count == 0)
throw new Exception("is a directory"); throw new Exception("is a directory");
@@ -742,6 +743,10 @@ namespace JDP {
cueSheet.DataTrackLengthMSF = txtDataTrackLength.Text; cueSheet.DataTrackLengthMSF = txtDataTrackLength.Text;
cueSheet.UseAccurateRip(); cueSheet.UseAccurateRip();
} }
if (useCUEToolsDB)
{
cueSheet.UseCUEToolsDB();
}
if (_batchPaths.Count == 0 && action == CUEAction.Encode) if (_batchPaths.Count == 0 && action == CUEAction.Encode)
{ {
@@ -751,9 +756,16 @@ namespace JDP {
this.Invoke((MethodInvoker)delegate() this.Invoke((MethodInvoker)delegate()
{ {
toolStripStatusLabelAR.Visible = useAR;// && cueSheet.ArVerify.ARStatus == null; toolStripStatusLabelAR.Enabled = cueSheet.ArVerify.ARStatus == null;
toolStripStatusLabelAR.Text = cueSheet.ArVerify.ARStatus == null ? cueSheet.ArVerify.WorstTotal().ToString() : "?"; toolStripStatusLabelAR.Visible = useAR;
toolStripStatusLabelAR.Text = cueSheet.ArVerify.ARStatus == null ? cueSheet.ArVerify.WorstTotal().ToString() : "";
toolStripStatusLabelAR.ToolTipText = "AccurateRip: " + (cueSheet.ArVerify.ARStatus ?? "found") + "."; toolStripStatusLabelAR.ToolTipText = "AccurateRip: " + (cueSheet.ArVerify.ARStatus ?? "found") + ".";
toolStripStatusLabelCTDB.Enabled = cueSheet.CTDB.DBStatus == null;
toolStripStatusLabelCTDB.Visible = useCUEToolsDB;
toolStripStatusLabelCTDB.Text = cueSheet.CTDB.DBStatus == null ? cueSheet.CTDB.Total.ToString() : "";
toolStripStatusLabelCTDB.ToolTipText = "CUETools DB: " + (cueSheet.CTDB.DBStatus ?? "found") + ".";
if (releases != null) if (releases != null)
{ {
frmChoice dlg = new frmChoice(); frmChoice dlg = new frmChoice();
@@ -808,7 +820,34 @@ namespace JDP {
else else
status = cueSheet.ExecuteScript(script); status = cueSheet.ExecuteScript(script);
//if (_batchPaths.Count > 0) //if (useCUEToolsDB)
//{
// if (cueSheet.CTDB.AccResult == HttpStatusCode.NotFound &&
// cueSheet.ArVerify.ARStatus == null &&
// cueSheet.ArVerify.WorstConfidence() > 2
// )
// {
// this.Invoke((MethodInvoker)delegate()
// {
// dlgRes = MessageBox.Show(this, "Disc is not present in CUETools Database, " +
// "do you want to submit it?", "Overwrite?", (_batchPaths.Count == 0) ?
// MessageBoxButtons.YesNo : MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
// if (dlgRes == DialogResult.Cancel)
// SetupControls(false);
// });
// if (dlgRes == DialogResult.Cancel)
// {
// cueSheet.Close();
// return;
// }
// if (dlgRes == DialogResult.Yes)
// {
// cueSheet.CTDB.Submit((int)cueSheet.ArVerify.WorstConfidence(), (int)cueSheet.ArVerify.WorstTotal());
// }
// }
//}
if (_batchPaths.Count > 0)
{ {
_batchProcessed++; _batchProcessed++;
BatchLog("{0}.", pathIn, status); BatchLog("{0}.", pathIn, status);
@@ -836,7 +875,7 @@ namespace JDP {
//reportForm.Message = _batchReport.ToString(); //reportForm.Message = _batchReport.ToString();
//reportForm.ShowDialog(this); //reportForm.ShowDialog(this);
} }
else if (useAR) else if (useAR && cueSheet.Processed)
{ {
using (StringWriter sw = new StringWriter()) using (StringWriter sw = new StringWriter())
{ {
@@ -856,7 +895,7 @@ namespace JDP {
//reportForm.ShowDialog(this); //reportForm.ShowDialog(this);
} }
else else
ShowFinishedMessage(cueSheet.PaddedToFrame); ShowFinishedMessage(cueSheet.PaddedToFrame, status);
SetupControls(false); SetupControls(false);
} }
}); });
@@ -963,6 +1002,7 @@ namespace JDP {
groupBoxMode.Enabled = !running; groupBoxMode.Enabled = !running;
toolStripCorrectorFormat.Visible = SelectedAction == CUEAction.CorrectFilenames; toolStripCorrectorFormat.Visible = SelectedAction == CUEAction.CorrectFilenames;
tableLayoutPanelCUEStyle.Visible = converting; tableLayoutPanelCUEStyle.Visible = converting;
tableLayoutPanelVerifyMode.Visible = SelectedAction == CUEAction.Verify;
grpOutputPathGeneration.Enabled = !running; grpOutputPathGeneration.Enabled = !running;
grpAudioOutput.Enabled = !running && converting; grpAudioOutput.Enabled = !running && converting;
grpAction.Enabled = !running; grpAction.Enabled = !running;
@@ -980,6 +1020,7 @@ namespace JDP {
toolStripProgressBar1.Value = 0; toolStripProgressBar1.Value = 0;
toolStripProgressBar2.Value = 0; toolStripProgressBar2.Value = 0;
toolStripStatusLabelAR.Visible = false; toolStripStatusLabelAR.Visible = false;
toolStripStatusLabelCTDB.Visible = false;
if (ReportState) if (ReportState)
{ {
if (_batchReport != null) if (_batchReport != null)
@@ -1018,7 +1059,7 @@ namespace JDP {
return (dlgRes == DialogResult.OK); return (dlgRes == DialogResult.OK);
} }
private void ShowFinishedMessage(bool warnAboutPadding) { private void ShowFinishedMessage(bool warnAboutPadding, string status) {
if (_batchPaths.Count != 0) { if (_batchPaths.Count != 0) {
return; return;
} }
@@ -1028,7 +1069,7 @@ namespace JDP {
"files are from a CD source, this may indicate a problem with your files.", "files are from a CD source, this may indicate a problem with your files.",
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
} }
MessageBox.Show(this, "Conversion was successful!", "Done", MessageBoxButtons.OK, MessageBox.Show(this, status, "Done", MessageBoxButtons.OK,
MessageBoxIcon.Information); MessageBoxIcon.Information);
} }
@@ -1063,6 +1104,7 @@ namespace JDP {
checkBoxUseFreeDb.Checked = _profile._useFreeDb; checkBoxUseFreeDb.Checked = _profile._useFreeDb;
checkBoxUseMusicBrainz.Checked = _profile._useMusicBrainz; checkBoxUseMusicBrainz.Checked = _profile._useMusicBrainz;
checkBoxUseAccurateRip.Checked = _profile._useAccurateRip; checkBoxUseAccurateRip.Checked = _profile._useAccurateRip;
checkBoxVerifyUseCDRepair.Checked = _profile._useCUEToolsDB;
} }
private void ActivateProfile(string profileName) private void ActivateProfile(string profileName)
@@ -1106,6 +1148,7 @@ namespace JDP {
_profile._useFreeDb = checkBoxUseFreeDb.Checked; _profile._useFreeDb = checkBoxUseFreeDb.Checked;
_profile._useMusicBrainz = checkBoxUseMusicBrainz.Checked; _profile._useMusicBrainz = checkBoxUseMusicBrainz.Checked;
_profile._useAccurateRip = checkBoxUseAccurateRip.Checked; _profile._useAccurateRip = checkBoxUseAccurateRip.Checked;
_profile._useCUEToolsDB = checkBoxVerifyUseCDRepair.Checked;
if (_profile != _defaultProfile) if (_profile != _defaultProfile)
{ {

View File

@@ -126,26 +126,11 @@
</data> </data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="toolStripStatusLabel1.Size" type="System.Drawing.Size, System.Drawing"> <data name="toolStripStatusLabel1.Size" type="System.Drawing.Size, System.Drawing">
<value>404, 21</value> <value>381, 21</value>
</data> </data>
<data name="toolStripStatusLabel1.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing"> <data name="toolStripStatusLabel1.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value> <value>MiddleLeft</value>
</data> </data>
<data name="toolStripStatusLabelAR.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 8.25pt</value>
</data>
<data name="toolStripStatusLabelAR.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>White</value>
</data>
<data name="toolStripStatusLabelAR.Size" type="System.Drawing.Size, System.Drawing">
<value>21, 21</value>
</data>
<data name="toolStripStatusLabelAR.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>Overlay</value>
</data>
<data name="toolStripStatusLabelAR.ToolTipText" xml:space="preserve">
<value>Album found in AccurateRip database.</value>
</data>
<data name="toolStripStatusLabelProcessed.Size" type="System.Drawing.Size, System.Drawing"> <data name="toolStripStatusLabelProcessed.Size" type="System.Drawing.Size, System.Drawing">
<value>32, 21</value> <value>32, 21</value>
</data> </data>
@@ -156,6 +141,33 @@
<data name="toolStripStatusLabelProcessed.Visible" type="System.Boolean, mscorlib"> <data name="toolStripStatusLabelProcessed.Visible" type="System.Boolean, mscorlib">
<value>False</value> <value>False</value>
</data> </data>
<data name="toolStripStatusLabelCTDB.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
<data name="toolStripStatusLabelCTDB.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 21</value>
</data>
<data name="toolStripStatusLabelCTDB.Text" xml:space="preserve">
<value>77</value>
</data>
<data name="toolStripStatusLabelCTDB.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="toolStripStatusLabelAR.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
<data name="toolStripStatusLabelAR.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>White</value>
</data>
<data name="toolStripStatusLabelAR.Size" type="System.Drawing.Size, System.Drawing">
<value>44, 21</value>
</data>
<data name="toolStripStatusLabelAR.Text" xml:space="preserve">
<value>55</value>
</data>
<data name="toolStripStatusLabelAR.ToolTipText" xml:space="preserve">
<value>Album found in AccurateRip database.</value>
</data>
<data name="toolStripProgressBar1.Size" type="System.Drawing.Size, System.Drawing"> <data name="toolStripProgressBar1.Size" type="System.Drawing.Size, System.Drawing">
<value>120, 20</value> <value>120, 20</value>
</data> </data>
@@ -265,7 +277,7 @@
<value>fileSystemTreeView1</value> <value>fileSystemTreeView1</value>
</data> </data>
<data name="&gt;&gt;fileSystemTreeView1.Type" xml:space="preserve"> <data name="&gt;&gt;fileSystemTreeView1.Type" xml:space="preserve">
<value>CUEControls.FileSystemTreeView, CUEControls, Version=1.0.3510.22143, Culture=neutral, PublicKeyToken=null</value> <value>CUEControls.FileSystemTreeView, CUEControls, Version=2.0.5.0, Culture=neutral, PublicKeyToken=null</value>
</data> </data>
<data name="&gt;&gt;fileSystemTreeView1.Parent" xml:space="preserve"> <data name="&gt;&gt;fileSystemTreeView1.Parent" xml:space="preserve">
<value>grpInput</value> <value>grpInput</value>
@@ -319,13 +331,13 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="checkBoxUseAccurateRip.Location" type="System.Drawing.Point, System.Drawing"> <data name="checkBoxUseAccurateRip.Location" type="System.Drawing.Point, System.Drawing">
<value>95, 80</value> <value>95, 84</value>
</data> </data>
<data name="checkBoxUseAccurateRip.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms"> <data name="checkBoxUseAccurateRip.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 0</value> <value>0, 0, 0, 0</value>
</data> </data>
<data name="checkBoxUseAccurateRip.Size" type="System.Drawing.Size, System.Drawing"> <data name="checkBoxUseAccurateRip.Size" type="System.Drawing.Size, System.Drawing">
<value>49, 30</value> <value>49, 26</value>
</data> </data>
<data name="checkBoxUseAccurateRip.TabIndex" type="System.Int32, mscorlib"> <data name="checkBoxUseAccurateRip.TabIndex" type="System.Int32, mscorlib">
<value>5</value> <value>5</value>
@@ -358,13 +370,13 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="checkBoxUseFreeDb.Location" type="System.Drawing.Point, System.Drawing"> <data name="checkBoxUseFreeDb.Location" type="System.Drawing.Point, System.Drawing">
<value>47, 80</value> <value>47, 84</value>
</data> </data>
<data name="checkBoxUseFreeDb.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms"> <data name="checkBoxUseFreeDb.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 0</value> <value>0, 0, 0, 0</value>
</data> </data>
<data name="checkBoxUseFreeDb.Size" type="System.Drawing.Size, System.Drawing"> <data name="checkBoxUseFreeDb.Size" type="System.Drawing.Size, System.Drawing">
<value>48, 30</value> <value>48, 26</value>
</data> </data>
<data name="checkBoxUseFreeDb.TabIndex" type="System.Int32, mscorlib"> <data name="checkBoxUseFreeDb.TabIndex" type="System.Int32, mscorlib">
<value>4</value> <value>4</value>
@@ -394,13 +406,13 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="rbTracks.Location" type="System.Drawing.Point, System.Drawing"> <data name="rbTracks.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 36</value> <value>3, 40</value>
</data> </data>
<data name="rbTracks.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms"> <data name="rbTracks.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 0, 3, 0</value> <value>3, 0, 3, 0</value>
</data> </data>
<data name="rbTracks.Size" type="System.Drawing.Size, System.Drawing"> <data name="rbTracks.Size" type="System.Drawing.Size, System.Drawing">
<value>138, 18</value> <value>138, 20</value>
</data> </data>
<data name="rbTracks.TabIndex" type="System.Int32, mscorlib"> <data name="rbTracks.TabIndex" type="System.Int32, mscorlib">
<value>2</value> <value>2</value>
@@ -439,7 +451,7 @@
<value>3, 0, 3, 0</value> <value>3, 0, 3, 0</value>
</data> </data>
<data name="rbEmbedCUE.Size" type="System.Drawing.Size, System.Drawing"> <data name="rbEmbedCUE.Size" type="System.Drawing.Size, System.Drawing">
<value>138, 18</value> <value>138, 20</value>
</data> </data>
<data name="rbEmbedCUE.TabIndex" type="System.Int32, mscorlib"> <data name="rbEmbedCUE.TabIndex" type="System.Int32, mscorlib">
<value>0</value> <value>0</value>
@@ -472,13 +484,13 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="rbSingleFile.Location" type="System.Drawing.Point, System.Drawing"> <data name="rbSingleFile.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 18</value> <value>3, 20</value>
</data> </data>
<data name="rbSingleFile.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms"> <data name="rbSingleFile.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 0, 3, 0</value> <value>3, 0, 3, 0</value>
</data> </data>
<data name="rbSingleFile.Size" type="System.Drawing.Size, System.Drawing"> <data name="rbSingleFile.Size" type="System.Drawing.Size, System.Drawing">
<value>138, 18</value> <value>138, 20</value>
</data> </data>
<data name="rbSingleFile.TabIndex" type="System.Int32, mscorlib"> <data name="rbSingleFile.TabIndex" type="System.Int32, mscorlib">
<value>1</value> <value>1</value>
@@ -507,14 +519,17 @@
<data name="checkBoxUseMusicBrainz.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms"> <data name="checkBoxUseMusicBrainz.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value> <value>Fill</value>
</data> </data>
<data name="checkBoxUseMusicBrainz.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="checkBoxUseMusicBrainz.Location" type="System.Drawing.Point, System.Drawing"> <data name="checkBoxUseMusicBrainz.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 80</value> <value>0, 84</value>
</data> </data>
<data name="checkBoxUseMusicBrainz.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms"> <data name="checkBoxUseMusicBrainz.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 0</value> <value>0, 0, 0, 0</value>
</data> </data>
<data name="checkBoxUseMusicBrainz.Size" type="System.Drawing.Size, System.Drawing"> <data name="checkBoxUseMusicBrainz.Size" type="System.Drawing.Size, System.Drawing">
<value>47, 30</value> <value>47, 26</value>
</data> </data>
<data name="checkBoxUseMusicBrainz.TabIndex" type="System.Int32, mscorlib"> <data name="checkBoxUseMusicBrainz.TabIndex" type="System.Int32, mscorlib">
<value>3</value> <value>3</value>
@@ -565,7 +580,7 @@
<value>0</value> <value>0</value>
</data> </data>
<data name="tableLayoutPanelCUEStyle.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms"> <data name="tableLayoutPanelCUEStyle.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="checkBoxUseAccurateRip" Row="4" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="checkBoxUseFreeDb" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="rbTracks" Row="2" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="rbEmbedCUE" Row="0" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="rbSingleFile" Row="1" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="checkBoxUseMusicBrainz" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,33,33333,Percent,33,33334,Percent,33,33334" /&gt;&lt;Rows Styles="Percent,16,41941,Percent,16,41942,Percent,16,42196,Percent,24,54545,Percent,26,36364" /&gt;&lt;/TableLayoutSettings&gt;</value> <value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="checkBoxUseAccurateRip" Row="4" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="checkBoxUseFreeDb" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="rbTracks" Row="2" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="rbEmbedCUE" Row="0" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="rbSingleFile" Row="1" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="checkBoxUseMusicBrainz" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,33,33332,Percent,33,33334,Percent,33,33334" /&gt;&lt;Rows Styles="Percent,18,18229,Percent,18,18229,Percent,18,18229,Percent,22,72658,Percent,22,72658" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data> </data>
<metadata name="toolStripCorrectorFormat.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolStripCorrectorFormat.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>3, 17</value> <value>3, 17</value>
@@ -645,6 +660,69 @@
<data name="&gt;&gt;toolStripCorrectorFormat.ZOrder" xml:space="preserve"> <data name="&gt;&gt;toolStripCorrectorFormat.ZOrder" xml:space="preserve">
<value>1</value> <value>1</value>
</data> </data>
<data name="tableLayoutPanelVerifyMode.ColumnCount" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="checkBoxVerifyUseCDRepair.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="checkBoxVerifyUseCDRepair.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="checkBoxVerifyUseCDRepair.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 3</value>
</data>
<data name="checkBoxVerifyUseCDRepair.Size" type="System.Drawing.Size, System.Drawing">
<value>45, 29</value>
</data>
<data name="checkBoxVerifyUseCDRepair.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;checkBoxVerifyUseCDRepair.Name" xml:space="preserve">
<value>checkBoxVerifyUseCDRepair</value>
</data>
<data name="&gt;&gt;checkBoxVerifyUseCDRepair.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;checkBoxVerifyUseCDRepair.Parent" xml:space="preserve">
<value>tableLayoutPanelVerifyMode</value>
</data>
<data name="&gt;&gt;checkBoxVerifyUseCDRepair.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="tableLayoutPanelVerifyMode.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="tableLayoutPanelVerifyMode.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 17</value>
</data>
<data name="tableLayoutPanelVerifyMode.RowCount" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="tableLayoutPanelVerifyMode.Size" type="System.Drawing.Size, System.Drawing">
<value>144, 110</value>
</data>
<data name="tableLayoutPanelVerifyMode.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="tableLayoutPanelVerifyMode.ToolTip" xml:space="preserve">
<value>Use CUETools database</value>
</data>
<data name="&gt;&gt;tableLayoutPanelVerifyMode.Name" xml:space="preserve">
<value>tableLayoutPanelVerifyMode</value>
</data>
<data name="&gt;&gt;tableLayoutPanelVerifyMode.Type" xml:space="preserve">
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tableLayoutPanelVerifyMode.Parent" xml:space="preserve">
<value>groupBoxMode</value>
</data>
<data name="&gt;&gt;tableLayoutPanelVerifyMode.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="tableLayoutPanelVerifyMode.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="checkBoxVerifyUseCDRepair" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,36,11111,Percent,63,88889" /&gt;&lt;Rows Styles="Percent,32,72727,Percent,67,27273" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="groupBoxMode.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms"> <data name="groupBoxMode.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value> <value>Fill</value>
</data> </data>
@@ -2729,7 +2807,7 @@
<value>700, 538</value> <value>700, 538</value>
</data> </data>
<data name="$this.Text" xml:space="preserve"> <data name="$this.Text" xml:space="preserve">
<value>CUETools 2.0.4a</value> <value>CUETools 2.0.5</value>
</data> </data>
<data name="&gt;&gt;toolStripStatusLabel1.Name" xml:space="preserve"> <data name="&gt;&gt;toolStripStatusLabel1.Name" xml:space="preserve">
<value>toolStripStatusLabel1</value> <value>toolStripStatusLabel1</value>
@@ -2737,18 +2815,24 @@
<data name="&gt;&gt;toolStripStatusLabel1.Type" xml:space="preserve"> <data name="&gt;&gt;toolStripStatusLabel1.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="&gt;&gt;toolStripStatusLabelAR.Name" xml:space="preserve">
<value>toolStripStatusLabelAR</value>
</data>
<data name="&gt;&gt;toolStripStatusLabelAR.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripStatusLabelProcessed.Name" xml:space="preserve"> <data name="&gt;&gt;toolStripStatusLabelProcessed.Name" xml:space="preserve">
<value>toolStripStatusLabelProcessed</value> <value>toolStripStatusLabelProcessed</value>
</data> </data>
<data name="&gt;&gt;toolStripStatusLabelProcessed.Type" xml:space="preserve"> <data name="&gt;&gt;toolStripStatusLabelProcessed.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="&gt;&gt;toolStripStatusLabelCTDB.Name" xml:space="preserve">
<value>toolStripStatusLabelCTDB</value>
</data>
<data name="&gt;&gt;toolStripStatusLabelCTDB.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripStatusLabelAR.Name" xml:space="preserve">
<value>toolStripStatusLabelAR</value>
</data>
<data name="&gt;&gt;toolStripStatusLabelAR.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripProgressBar1.Name" xml:space="preserve"> <data name="&gt;&gt;toolStripProgressBar1.Name" xml:space="preserve">
<value>toolStripProgressBar1</value> <value>toolStripProgressBar1</value>
</data> </data>

View File

@@ -27,6 +27,7 @@ namespace JDP {
System.Windows.Forms.Button btnCancel; System.Windows.Forms.Button btnCancel;
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSettings)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSettings));
this.grpGeneral = new System.Windows.Forms.GroupBox(); this.grpGeneral = new System.Windows.Forms.GroupBox();
this.checkBoxSeparateDecodingThread = new System.Windows.Forms.CheckBox();
this.checkBoxCheckForUpdates = new System.Windows.Forms.CheckBox(); this.checkBoxCheckForUpdates = new System.Windows.Forms.CheckBox();
this.chkAllowMultipleInstances = new System.Windows.Forms.CheckBox(); this.chkAllowMultipleInstances = new System.Windows.Forms.CheckBox();
this.chkReducePriority = new System.Windows.Forms.CheckBox(); this.chkReducePriority = new System.Windows.Forms.CheckBox();
@@ -127,6 +128,7 @@ namespace JDP {
this.columnHeader1 = new System.Windows.Forms.ColumnHeader(); this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.tabPage10 = new System.Windows.Forms.TabPage(); this.tabPage10 = new System.Windows.Forms.TabPage();
this.groupBoxFlaCudaOptions = new System.Windows.Forms.GroupBox(); this.groupBoxFlaCudaOptions = new System.Windows.Forms.GroupBox();
this.checkBoxFlaCudaMultithread = new System.Windows.Forms.CheckBox();
this.checkBoxFlaCudaGPUOnly = new System.Windows.Forms.CheckBox(); this.checkBoxFlaCudaGPUOnly = new System.Windows.Forms.CheckBox();
this.checkBoxFlaCudaVerify = new System.Windows.Forms.CheckBox(); this.checkBoxFlaCudaVerify = new System.Windows.Forms.CheckBox();
this.groupBoxExternalEncoder = new System.Windows.Forms.GroupBox(); this.groupBoxExternalEncoder = new System.Windows.Forms.GroupBox();
@@ -174,7 +176,7 @@ namespace JDP {
this.labelFormatEncoder = new System.Windows.Forms.Label(); this.labelFormatEncoder = new System.Windows.Forms.Label();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader(); this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.checkBox1 = new System.Windows.Forms.CheckBox(); this.checkBox1 = new System.Windows.Forms.CheckBox();
this.checkBoxFlaCudaMultithread = new System.Windows.Forms.CheckBox(); this.checkBoxUseSystemProxy = new System.Windows.Forms.CheckBox();
btnCancel = new System.Windows.Forms.Button(); btnCancel = new System.Windows.Forms.Button();
this.grpGeneral.SuspendLayout(); this.grpGeneral.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
@@ -227,6 +229,8 @@ namespace JDP {
// //
// grpGeneral // grpGeneral
// //
this.grpGeneral.Controls.Add(this.checkBoxUseSystemProxy);
this.grpGeneral.Controls.Add(this.checkBoxSeparateDecodingThread);
this.grpGeneral.Controls.Add(this.checkBoxCheckForUpdates); this.grpGeneral.Controls.Add(this.checkBoxCheckForUpdates);
this.grpGeneral.Controls.Add(this.chkAllowMultipleInstances); this.grpGeneral.Controls.Add(this.chkAllowMultipleInstances);
this.grpGeneral.Controls.Add(this.chkReducePriority); this.grpGeneral.Controls.Add(this.chkReducePriority);
@@ -238,6 +242,13 @@ namespace JDP {
this.grpGeneral.Name = "grpGeneral"; this.grpGeneral.Name = "grpGeneral";
this.grpGeneral.TabStop = false; this.grpGeneral.TabStop = false;
// //
// checkBoxSeparateDecodingThread
//
resources.ApplyResources(this.checkBoxSeparateDecodingThread, "checkBoxSeparateDecodingThread");
this.checkBoxSeparateDecodingThread.Name = "checkBoxSeparateDecodingThread";
this.toolTip1.SetToolTip(this.checkBoxSeparateDecodingThread, resources.GetString("checkBoxSeparateDecodingThread.ToolTip"));
this.checkBoxSeparateDecodingThread.UseVisualStyleBackColor = true;
//
// checkBoxCheckForUpdates // checkBoxCheckForUpdates
// //
resources.ApplyResources(this.checkBoxCheckForUpdates, "checkBoxCheckForUpdates"); resources.ApplyResources(this.checkBoxCheckForUpdates, "checkBoxCheckForUpdates");
@@ -1078,6 +1089,13 @@ namespace JDP {
this.groupBoxFlaCudaOptions.Name = "groupBoxFlaCudaOptions"; this.groupBoxFlaCudaOptions.Name = "groupBoxFlaCudaOptions";
this.groupBoxFlaCudaOptions.TabStop = false; this.groupBoxFlaCudaOptions.TabStop = false;
// //
// checkBoxFlaCudaMultithread
//
resources.ApplyResources(this.checkBoxFlaCudaMultithread, "checkBoxFlaCudaMultithread");
this.checkBoxFlaCudaMultithread.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.cUEConfigBindingSource, "FlaCudaThreads", true));
this.checkBoxFlaCudaMultithread.Name = "checkBoxFlaCudaMultithread";
this.checkBoxFlaCudaMultithread.UseVisualStyleBackColor = true;
//
// checkBoxFlaCudaGPUOnly // checkBoxFlaCudaGPUOnly
// //
resources.ApplyResources(this.checkBoxFlaCudaGPUOnly, "checkBoxFlaCudaGPUOnly"); resources.ApplyResources(this.checkBoxFlaCudaGPUOnly, "checkBoxFlaCudaGPUOnly");
@@ -1455,12 +1473,11 @@ namespace JDP {
this.checkBox1.Name = "checkBox1"; this.checkBox1.Name = "checkBox1";
this.checkBox1.UseVisualStyleBackColor = true; this.checkBox1.UseVisualStyleBackColor = true;
// //
// checkBoxFlaCudaMultithread // checkBoxUseSystemProxy
// //
resources.ApplyResources(this.checkBoxFlaCudaMultithread, "checkBoxFlaCudaMultithread"); resources.ApplyResources(this.checkBoxUseSystemProxy, "checkBoxUseSystemProxy");
this.checkBoxFlaCudaMultithread.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.cUEConfigBindingSource, "FlaCudaThreads", true)); this.checkBoxUseSystemProxy.Name = "checkBoxUseSystemProxy";
this.checkBoxFlaCudaMultithread.Name = "checkBoxFlaCudaMultithread"; this.checkBoxUseSystemProxy.UseVisualStyleBackColor = true;
this.checkBoxFlaCudaMultithread.UseVisualStyleBackColor = true;
// //
// frmSettings // frmSettings
// //
@@ -1695,6 +1712,8 @@ namespace JDP {
private System.Windows.Forms.CheckBox checkBoxFlaCudaVerify; private System.Windows.Forms.CheckBox checkBoxFlaCudaVerify;
private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.CheckBox checkBoxFlaCudaMultithread; private System.Windows.Forms.CheckBox checkBoxFlaCudaMultithread;
private System.Windows.Forms.CheckBox checkBoxSeparateDecodingThread;
private System.Windows.Forms.CheckBox checkBoxUseSystemProxy;
} }
} }

View File

@@ -84,6 +84,8 @@ namespace JDP {
checkBoxFixToNearest.Checked = _config.fixOffsetToNearest; checkBoxFixToNearest.Checked = _config.fixOffsetToNearest;
//textBoxARLogExtension.Text = _config.arLogFilenameFormat; //textBoxARLogExtension.Text = _config.arLogFilenameFormat;
numericUpDownMaxResolution.Value = _config.maxAlbumArtSize; numericUpDownMaxResolution.Value = _config.maxAlbumArtSize;
checkBoxSeparateDecodingThread.Checked = _config.separateDecodingThread;
checkBoxUseSystemProxy.Checked = _config.useSystemProxySettings;
switch (_config.gapsHandling) switch (_config.gapsHandling)
{ {
@@ -246,6 +248,8 @@ namespace JDP {
_config.fixOffsetToNearest = checkBoxFixToNearest.Checked; _config.fixOffsetToNearest = checkBoxFixToNearest.Checked;
//_config.arLogFilenameFormat = textBoxARLogExtension.Text; //_config.arLogFilenameFormat = textBoxARLogExtension.Text;
_config.maxAlbumArtSize = (int) numericUpDownMaxResolution.Value; _config.maxAlbumArtSize = (int) numericUpDownMaxResolution.Value;
_config.separateDecodingThread = checkBoxSeparateDecodingThread.Checked;
_config.useSystemProxySettings = checkBoxUseSystemProxy.Checked;
_config.language = ((CultureInfo)comboLanguage.SelectedItem).Name; _config.language = ((CultureInfo)comboLanguage.SelectedItem).Name;
} }

View File

@@ -126,7 +126,7 @@
</data> </data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing"> <data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
<value>273, 290</value> <value>268, 320</value>
</data> </data>
<data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing"> <data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
<value>73, 23</value> <value>73, 23</value>
@@ -150,6 +150,66 @@
<data name="&gt;&gt;btnCancel.ZOrder" xml:space="preserve"> <data name="&gt;&gt;btnCancel.ZOrder" xml:space="preserve">
<value>1</value> <value>1</value>
</data> </data>
<data name="checkBoxUseSystemProxy.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="checkBoxUseSystemProxy.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 157</value>
</data>
<data name="checkBoxUseSystemProxy.Size" type="System.Drawing.Size, System.Drawing">
<value>153, 17</value>
</data>
<data name="checkBoxUseSystemProxy.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="checkBoxUseSystemProxy.Text" xml:space="preserve">
<value>Use system proxy settings</value>
</data>
<data name="&gt;&gt;checkBoxUseSystemProxy.Name" xml:space="preserve">
<value>checkBoxUseSystemProxy</value>
</data>
<data name="&gt;&gt;checkBoxUseSystemProxy.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;checkBoxUseSystemProxy.Parent" xml:space="preserve">
<value>grpGeneral</value>
</data>
<data name="&gt;&gt;checkBoxUseSystemProxy.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="checkBoxSeparateDecodingThread.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="checkBoxSeparateDecodingThread.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 140</value>
</data>
<data name="checkBoxSeparateDecodingThread.Size" type="System.Drawing.Size, System.Drawing">
<value>168, 17</value>
</data>
<data name="checkBoxSeparateDecodingThread.TabIndex" type="System.Int32, mscorlib">
<value>9</value>
</data>
<data name="checkBoxSeparateDecodingThread.Text" xml:space="preserve">
<value>Separate thread for decoding</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="checkBoxSeparateDecodingThread.ToolTip" xml:space="preserve">
<value>Improves speed on multicore processors</value>
</data>
<data name="&gt;&gt;checkBoxSeparateDecodingThread.Name" xml:space="preserve">
<value>checkBoxSeparateDecodingThread</value>
</data>
<data name="&gt;&gt;checkBoxSeparateDecodingThread.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;checkBoxSeparateDecodingThread.Parent" xml:space="preserve">
<value>grpGeneral</value>
</data>
<data name="&gt;&gt;checkBoxSeparateDecodingThread.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="checkBoxCheckForUpdates.AutoSize" type="System.Boolean, mscorlib"> <data name="checkBoxCheckForUpdates.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
</data> </data>
@@ -168,9 +228,6 @@
<data name="checkBoxCheckForUpdates.Text" xml:space="preserve"> <data name="checkBoxCheckForUpdates.Text" xml:space="preserve">
<value>Check for updates</value> <value>Check for updates</value>
</data> </data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="checkBoxCheckForUpdates.ToolTip" xml:space="preserve"> <data name="checkBoxCheckForUpdates.ToolTip" xml:space="preserve">
<value>Check for updates</value> <value>Check for updates</value>
</data> </data>
@@ -184,7 +241,7 @@
<value>grpGeneral</value> <value>grpGeneral</value>
</data> </data>
<data name="&gt;&gt;checkBoxCheckForUpdates.ZOrder" xml:space="preserve"> <data name="&gt;&gt;checkBoxCheckForUpdates.ZOrder" xml:space="preserve">
<value>0</value> <value>2</value>
</data> </data>
<data name="chkAllowMultipleInstances.AutoSize" type="System.Boolean, mscorlib"> <data name="chkAllowMultipleInstances.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@@ -217,7 +274,7 @@
<value>grpGeneral</value> <value>grpGeneral</value>
</data> </data>
<data name="&gt;&gt;chkAllowMultipleInstances.ZOrder" xml:space="preserve"> <data name="&gt;&gt;chkAllowMultipleInstances.ZOrder" xml:space="preserve">
<value>1</value> <value>3</value>
</data> </data>
<data name="chkReducePriority.AutoSize" type="System.Boolean, mscorlib"> <data name="chkReducePriority.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@@ -250,7 +307,7 @@
<value>grpGeneral</value> <value>grpGeneral</value>
</data> </data>
<data name="&gt;&gt;chkReducePriority.ZOrder" xml:space="preserve"> <data name="&gt;&gt;chkReducePriority.ZOrder" xml:space="preserve">
<value>2</value> <value>4</value>
</data> </data>
<data name="chkTruncateExtra4206Samples.AutoSize" type="System.Boolean, mscorlib"> <data name="chkTruncateExtra4206Samples.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@@ -283,7 +340,7 @@
<value>grpGeneral</value> <value>grpGeneral</value>
</data> </data>
<data name="&gt;&gt;chkTruncateExtra4206Samples.ZOrder" xml:space="preserve"> <data name="&gt;&gt;chkTruncateExtra4206Samples.ZOrder" xml:space="preserve">
<value>3</value> <value>5</value>
</data> </data>
<data name="chkCreateCUEFileWhenEmbedded.AutoSize" type="System.Boolean, mscorlib"> <data name="chkCreateCUEFileWhenEmbedded.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@@ -316,7 +373,7 @@
<value>grpGeneral</value> <value>grpGeneral</value>
</data> </data>
<data name="&gt;&gt;chkCreateCUEFileWhenEmbedded.ZOrder" xml:space="preserve"> <data name="&gt;&gt;chkCreateCUEFileWhenEmbedded.ZOrder" xml:space="preserve">
<value>4</value> <value>6</value>
</data> </data>
<data name="chkCreateM3U.AutoSize" type="System.Boolean, mscorlib"> <data name="chkCreateM3U.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@@ -349,7 +406,7 @@
<value>grpGeneral</value> <value>grpGeneral</value>
</data> </data>
<data name="&gt;&gt;chkCreateM3U.ZOrder" xml:space="preserve"> <data name="&gt;&gt;chkCreateM3U.ZOrder" xml:space="preserve">
<value>5</value> <value>7</value>
</data> </data>
<data name="chkAutoCorrectFilenames.AutoSize" type="System.Boolean, mscorlib"> <data name="chkAutoCorrectFilenames.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@@ -382,13 +439,13 @@
<value>grpGeneral</value> <value>grpGeneral</value>
</data> </data>
<data name="&gt;&gt;chkAutoCorrectFilenames.ZOrder" xml:space="preserve"> <data name="&gt;&gt;chkAutoCorrectFilenames.ZOrder" xml:space="preserve">
<value>6</value> <value>8</value>
</data> </data>
<data name="grpGeneral.Location" type="System.Drawing.Point, System.Drawing"> <data name="grpGeneral.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 6</value> <value>6, 6</value>
</data> </data>
<data name="grpGeneral.Size" type="System.Drawing.Size, System.Drawing"> <data name="grpGeneral.Size" type="System.Drawing.Size, System.Drawing">
<value>252, 144</value> <value>252, 182</value>
</data> </data>
<data name="grpGeneral.TabIndex" type="System.Int32, mscorlib"> <data name="grpGeneral.TabIndex" type="System.Int32, mscorlib">
<value>0</value> <value>0</value>
@@ -466,7 +523,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="btnOK.Location" type="System.Drawing.Point, System.Drawing"> <data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
<value>194, 290</value> <value>189, 320</value>
</data> </data>
<data name="btnOK.Size" type="System.Drawing.Size, System.Drawing"> <data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
<value>73, 23</value> <value>73, 23</value>
@@ -1612,10 +1669,10 @@
<value>Top, Left, Right</value> <value>Top, Left, Right</value>
</data> </data>
<data name="groupBoxGaps.Location" type="System.Drawing.Point, System.Drawing"> <data name="groupBoxGaps.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 156</value> <value>6, 193</value>
</data> </data>
<data name="groupBoxGaps.Size" type="System.Drawing.Size, System.Drawing"> <data name="groupBoxGaps.Size" type="System.Drawing.Size, System.Drawing">
<value>250, 99</value> <value>250, 98</value>
</data> </data>
<data name="groupBoxGaps.TabIndex" type="System.Int32, mscorlib"> <data name="groupBoxGaps.TabIndex" type="System.Int32, mscorlib">
<value>16</value> <value>16</value>
@@ -1642,7 +1699,7 @@
<value>3, 3, 3, 3</value> <value>3, 3, 3, 3</value>
</data> </data>
<data name="tabPage1.Size" type="System.Drawing.Size, System.Drawing"> <data name="tabPage1.Size" type="System.Drawing.Size, System.Drawing">
<value>535, 261</value> <value>535, 291</value>
</data> </data>
<data name="tabPage1.TabIndex" type="System.Int32, mscorlib"> <data name="tabPage1.TabIndex" type="System.Int32, mscorlib">
<value>0</value> <value>0</value>
@@ -1891,7 +1948,7 @@
<value>242, 3</value> <value>242, 3</value>
</data> </data>
<data name="groupBoxAlbumArt.Size" type="System.Drawing.Size, System.Drawing"> <data name="groupBoxAlbumArt.Size" type="System.Drawing.Size, System.Drawing">
<value>284, 255</value> <value>284, 275</value>
</data> </data>
<data name="groupBoxAlbumArt.TabIndex" type="System.Int32, mscorlib"> <data name="groupBoxAlbumArt.TabIndex" type="System.Int32, mscorlib">
<value>1</value> <value>1</value>
@@ -2095,7 +2152,7 @@
<value>8, 3</value> <value>8, 3</value>
</data> </data>
<data name="groupBoxTagging.Size" type="System.Drawing.Size, System.Drawing"> <data name="groupBoxTagging.Size" type="System.Drawing.Size, System.Drawing">
<value>226, 255</value> <value>226, 275</value>
</data> </data>
<data name="groupBoxTagging.TabIndex" type="System.Int32, mscorlib"> <data name="groupBoxTagging.TabIndex" type="System.Int32, mscorlib">
<value>0</value> <value>0</value>
@@ -2116,7 +2173,7 @@
<value>4, 22</value> <value>4, 22</value>
</data> </data>
<data name="tabPage6.Size" type="System.Drawing.Size, System.Drawing"> <data name="tabPage6.Size" type="System.Drawing.Size, System.Drawing">
<value>535, 261</value> <value>535, 291</value>
</data> </data>
<data name="tabPage6.TabIndex" type="System.Int32, mscorlib"> <data name="tabPage6.TabIndex" type="System.Int32, mscorlib">
<value>9</value> <value>9</value>
@@ -2506,7 +2563,7 @@
<value>3, 3, 3, 3</value> <value>3, 3, 3, 3</value>
</data> </data>
<data name="tabPage2.Size" type="System.Drawing.Size, System.Drawing"> <data name="tabPage2.Size" type="System.Drawing.Size, System.Drawing">
<value>535, 261</value> <value>535, 291</value>
</data> </data>
<data name="tabPage2.TabIndex" type="System.Int32, mscorlib"> <data name="tabPage2.TabIndex" type="System.Int32, mscorlib">
<value>1</value> <value>1</value>
@@ -2854,7 +2911,7 @@
<value>136, 6</value> <value>136, 6</value>
</data> </data>
<data name="groupBoxFormat.Size" type="System.Drawing.Size, System.Drawing"> <data name="groupBoxFormat.Size" type="System.Drawing.Size, System.Drawing">
<value>390, 249</value> <value>390, 269</value>
</data> </data>
<data name="groupBoxFormat.TabIndex" type="System.Int32, mscorlib"> <data name="groupBoxFormat.TabIndex" type="System.Int32, mscorlib">
<value>17</value> <value>17</value>
@@ -2881,7 +2938,7 @@
<value>6, 6</value> <value>6, 6</value>
</data> </data>
<data name="listViewFormats.Size" type="System.Drawing.Size, System.Drawing"> <data name="listViewFormats.Size" type="System.Drawing.Size, System.Drawing">
<value>124, 249</value> <value>124, 269</value>
</data> </data>
<data name="listViewFormats.TabIndex" type="System.Int32, mscorlib"> <data name="listViewFormats.TabIndex" type="System.Int32, mscorlib">
<value>0</value> <value>0</value>
@@ -2905,7 +2962,7 @@
<value>3, 3, 3, 3</value> <value>3, 3, 3, 3</value>
</data> </data>
<data name="tabPage3.Size" type="System.Drawing.Size, System.Drawing"> <data name="tabPage3.Size" type="System.Drawing.Size, System.Drawing">
<value>535, 261</value> <value>535, 291</value>
</data> </data>
<data name="tabPage3.TabIndex" type="System.Int32, mscorlib"> <data name="tabPage3.TabIndex" type="System.Int32, mscorlib">
<value>2</value> <value>2</value>
@@ -3213,7 +3270,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="buttonEncoderDelete.Location" type="System.Drawing.Point, System.Drawing"> <data name="buttonEncoderDelete.Location" type="System.Drawing.Point, System.Drawing">
<value>37, 232</value> <value>37, 262</value>
</data> </data>
<data name="buttonEncoderDelete.Size" type="System.Drawing.Size, System.Drawing"> <data name="buttonEncoderDelete.Size" type="System.Drawing.Size, System.Drawing">
<value>25, 23</value> <value>25, 23</value>
@@ -3251,7 +3308,7 @@
</value> </value>
</data> </data>
<data name="buttonEncoderAdd.Location" type="System.Drawing.Point, System.Drawing"> <data name="buttonEncoderAdd.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 232</value> <value>6, 262</value>
</data> </data>
<data name="buttonEncoderAdd.Size" type="System.Drawing.Size, System.Drawing"> <data name="buttonEncoderAdd.Size" type="System.Drawing.Size, System.Drawing">
<value>25, 23</value> <value>25, 23</value>
@@ -3275,7 +3332,7 @@
<value>6, 7</value> <value>6, 7</value>
</data> </data>
<data name="listBoxEncoders.Size" type="System.Drawing.Size, System.Drawing"> <data name="listBoxEncoders.Size" type="System.Drawing.Size, System.Drawing">
<value>124, 221</value> <value>124, 247</value>
</data> </data>
<data name="listBoxEncoders.TabIndex" type="System.Int32, mscorlib"> <data name="listBoxEncoders.TabIndex" type="System.Int32, mscorlib">
<value>27</value> <value>27</value>
@@ -3554,7 +3611,7 @@
<value>3, 3, 3, 3</value> <value>3, 3, 3, 3</value>
</data> </data>
<data name="tabPage10.Size" type="System.Drawing.Size, System.Drawing"> <data name="tabPage10.Size" type="System.Drawing.Size, System.Drawing">
<value>535, 261</value> <value>535, 291</value>
</data> </data>
<data name="tabPage10.TabIndex" type="System.Int32, mscorlib"> <data name="tabPage10.TabIndex" type="System.Int32, mscorlib">
<value>6</value> <value>6</value>
@@ -3734,7 +3791,7 @@
<value>3, 6</value> <value>3, 6</value>
</data> </data>
<data name="listViewDecoders.Size" type="System.Drawing.Size, System.Drawing"> <data name="listViewDecoders.Size" type="System.Drawing.Size, System.Drawing">
<value>124, 249</value> <value>124, 279</value>
</data> </data>
<data name="listViewDecoders.TabIndex" type="System.Int32, mscorlib"> <data name="listViewDecoders.TabIndex" type="System.Int32, mscorlib">
<value>26</value> <value>26</value>
@@ -3794,7 +3851,7 @@
<value>3, 3, 3, 3</value> <value>3, 3, 3, 3</value>
</data> </data>
<data name="tabPage11.Size" type="System.Drawing.Size, System.Drawing"> <data name="tabPage11.Size" type="System.Drawing.Size, System.Drawing">
<value>535, 261</value> <value>535, 291</value>
</data> </data>
<data name="tabPage11.TabIndex" type="System.Int32, mscorlib"> <data name="tabPage11.TabIndex" type="System.Int32, mscorlib">
<value>7</value> <value>7</value>
@@ -3953,7 +4010,7 @@
<value>3, 3, 3, 3</value> <value>3, 3, 3, 3</value>
</data> </data>
<data name="tabPage4.Size" type="System.Drawing.Size, System.Drawing"> <data name="tabPage4.Size" type="System.Drawing.Size, System.Drawing">
<value>535, 261</value> <value>535, 291</value>
</data> </data>
<data name="tabPage4.TabIndex" type="System.Int32, mscorlib"> <data name="tabPage4.TabIndex" type="System.Int32, mscorlib">
<value>3</value> <value>3</value>
@@ -3980,7 +4037,7 @@
<value>144, 110</value> <value>144, 110</value>
</data> </data>
<data name="richTextBoxScript.Size" type="System.Drawing.Size, System.Drawing"> <data name="richTextBoxScript.Size" type="System.Drawing.Size, System.Drawing">
<value>382, 145</value> <value>382, 167</value>
</data> </data>
<data name="richTextBoxScript.TabIndex" type="System.Int32, mscorlib"> <data name="richTextBoxScript.TabIndex" type="System.Int32, mscorlib">
<value>28</value> <value>28</value>
@@ -4094,7 +4151,7 @@
<value>6, 6</value> <value>6, 6</value>
</data> </data>
<data name="listViewScripts.Size" type="System.Drawing.Size, System.Drawing"> <data name="listViewScripts.Size" type="System.Drawing.Size, System.Drawing">
<value>124, 249</value> <value>124, 271</value>
</data> </data>
<data name="listViewScripts.TabIndex" type="System.Int32, mscorlib"> <data name="listViewScripts.TabIndex" type="System.Int32, mscorlib">
<value>1</value> <value>1</value>
@@ -4115,7 +4172,7 @@
<value>4, 22</value> <value>4, 22</value>
</data> </data>
<data name="tabPage5.Size" type="System.Drawing.Size, System.Drawing"> <data name="tabPage5.Size" type="System.Drawing.Size, System.Drawing">
<value>535, 261</value> <value>535, 291</value>
</data> </data>
<data name="tabPage5.TabIndex" type="System.Int32, mscorlib"> <data name="tabPage5.TabIndex" type="System.Int32, mscorlib">
<value>8</value> <value>8</value>
@@ -4142,7 +4199,7 @@
<value>0, 0, 0, 0</value> <value>0, 0, 0, 0</value>
</data> </data>
<data name="tabControl1.Size" type="System.Drawing.Size, System.Drawing"> <data name="tabControl1.Size" type="System.Drawing.Size, System.Drawing">
<value>543, 287</value> <value>543, 317</value>
</data> </data>
<data name="tabControl1.TabIndex" type="System.Int32, mscorlib"> <data name="tabControl1.TabIndex" type="System.Int32, mscorlib">
<value>0</value> <value>0</value>
@@ -4241,7 +4298,7 @@
<value>6, 13</value> <value>6, 13</value>
</data> </data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing"> <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>542, 325</value> <value>542, 355</value>
</data> </data>
<data name="$this.Font" type="System.Drawing.Font, System.Drawing"> <data name="$this.Font" type="System.Drawing.Font, System.Drawing">
<value>Tahoma, 8.25pt</value> <value>Tahoma, 8.25pt</value>

View File

@@ -1,7 +1,7 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup> <PropertyGroup>
<ProjectType>Local</ProjectType> <ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{5ADCFD6D-BFEA-4B10-BB45-9083BBB56AF4}</ProjectGuid> <ProjectGuid>{5ADCFD6D-BFEA-4B10-BB45-9083BBB56AF4}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -29,7 +29,7 @@
<OldToolsVersion>2.0</OldToolsVersion> <OldToolsVersion>2.0</OldToolsVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>..\bin\win32\Debug\</OutputPath> <OutputPath>..\bin\Debug\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks> <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress> <BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<ProjectGuid>{74C2036B-2C9B-4FC8-B7BD-AE81A8DCE533}</ProjectGuid> <ProjectGuid>{74C2036B-2C9B-4FC8-B7BD-AE81A8DCE533}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>MusicBrainz</RootNamespace> <RootNamespace>MusicBrainz</RootNamespace>
@@ -18,7 +18,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>.</OutputPath> <OutputPath>..\bin\Debug\</OutputPath>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AssemblyKeyFile>.</AssemblyKeyFile> <AssemblyKeyFile>.</AssemblyKeyFile>