private void mnuTestAllQbFiles_Click(object sender, EventArgs e)
{
PakEditor pak = null;
try
{
pak = new PakEditor(_pakFormat);
}
catch (Exception ex)
{
showException("PAK Load Error", ex);
return;
}
string filename = string.Empty;
try
{
int skipped = 0;
foreach (PakHeaderItem phi in pak.Headers.Values)
{
filename = phi.Filename;
//System.Diagnostics.Debug.WriteLine(phi.Filename); //DEBUG FILENAME
if (phi.PakFileType == PakItemType.Qb || phi.PakFileType == PakItemType.Sqb || phi.PakFileType == PakItemType.Midi)
{
//showError("Error", "Only QB files can be tested.");
//return;
QbFile qbf = pak.ReadQbFile(phi.Filename);
QbItemBase qib = qbf.IsValid();
if (qib != null)
throw new ApplicationException(string.Format("{0} at position 0x{1}", QbFile.FormatIsValidErrorMessage(qib, qib.IsValid), qib.Position.ToString("X").PadLeft(8, '0')));
}
else
skipped++;
}
int c = (pak.Headers.Values.Count - skipped);
MessageBox.Show(this, string.Format("PAK and {0} QB file{1} validated succesfully, {2} skipped", c.ToString(), c == 1 ? "" : "s", skipped.ToString()), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
showError("QB Test Error", string.Format("{0} in '{1}'", ex.Message, filename));
return;
}
}