private bool Verify()
{
SetStatus("Verifying...");
if (File.Exists(_basePath + @"\Resources\BrawlFileList.txt"))
{
List<Tuple<string, long>> fileList = new List<Tuple<string, long>>();
// Parse BrawlFileList.txt
bool success = true;
foreach (string s in File.ReadLines(_basePath + @"\Resources\BrawlFileList.txt"))
{
// Each line should have 1 space separating the file path from the file size
string[] parts = s.Split(' ');
// Try to convert file size string to long
long size;
if (!long.TryParse(parts[1], out size))
{
DialogResult result = MessageBox.Show("Error parsing BrawlFileList.txt, do you want to continue without verifying extracted files?", "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.No)
buildWorker.CancelAsync();
success = false;
break;
}
// Add to list
fileList.Add(Tuple.Create(parts[0], size));
}
// Verify brawl files
if (success)
{
foreach (Tuple<string, long> file in fileList)
{
if (!File.Exists(@"ssbb.d\" + file.Item1) || new FileInfo(@"ssbb.d\" + file.Item1).Length != file.Item2)
{
DialogResult result = MessageBox.Show("One or more files are either missing or the wrong size in the extracted Brawl image. Do you still wish to continue?", "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.No)
buildWorker.CancelAsync();
break;
}
}
}
}
else
{
DialogResult result = MessageBox.Show("BrawlFileList.txt not found, do you want to continue without verifying extracted files?", "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.No)
buildWorker.CancelAsync();
}
if (buildWorker.CancellationPending)
return false;
return true;
}