More CHD related fixes

- CHDReturnError was not handled and would cause an exception/crash
- CHD error/filename were swapped in ErrorGrid when scanning
- Use regex when parsing chdman stdout output
This commit is contained in:
Jim Westfall
2014-10-29 20:20:37 -07:00
parent 7f6b01516d
commit 634de3b3d7
2 changed files with 4 additions and 3 deletions

View File

@@ -820,11 +820,12 @@ namespace ROMVault2
tFile.FileStatusSet(FileStatus.SHA1CHDVerified);
return;
case CHD.CHDManCheck.Corrupt:
_bgw.ReportProgress(0, new bgwShowError(error, filename));
_bgw.ReportProgress(0, new bgwShowError(filename, error));
tFile.GotStatus = GotStatus.Corrupt;
return;
case CHD.CHDManCheck.CHDReturnError:
case CHD.CHDManCheck.CHDUnknownError:
_bgw.ReportProgress(0, new bgwShowError(error, filename));
_bgw.ReportProgress(0, new bgwShowError(filename, error));
return;
case CHD.CHDManCheck.ChdmanNotFound:
return;

View File

@@ -334,7 +334,7 @@ namespace ROMVault2.SupportedFiles.CHD
switch (_outputLineCount)
{
case 0:
if (sOut.Length < 53 || sOut.Substring(0, 53) != "chdman - MAME Compressed Hunks of Data (CHD) manager ")
if (!System.Text.RegularExpressions.Regex.IsMatch(sOut, @"^chdman - MAME Compressed Hunks of Data \(CHD\) manager ([0-9\.]+) \(.*\)"))
{
_result = "Incorrect startup of CHDMan :" + sOut;
_resultType = CHDManCheck.CHDReturnError;