Merge pull request #7 from jwestfall69/mono-chdman
chdman mono/linux fixes and improvements
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -245,10 +245,14 @@ namespace ROMVault2.SupportedFiles.CHD
|
||||
_result = "";
|
||||
_resultType = CHDManCheck.Unset;
|
||||
|
||||
string chdPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "chdman.exe");
|
||||
string chdExe = "chdman.exe";
|
||||
if (Settings.MonoFileIO)
|
||||
chdExe = "chdman";
|
||||
|
||||
string chdPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, chdExe);
|
||||
if (!File.Exists(chdPath))
|
||||
{
|
||||
result = "chdman not found";
|
||||
result = chdExe + " Not Found.";
|
||||
return CHDManCheck.ChdmanNotFound;
|
||||
}
|
||||
|
||||
@@ -330,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;
|
||||
@@ -367,71 +371,62 @@ namespace ROMVault2.SupportedFiles.CHD
|
||||
// Collect the process command output.
|
||||
if (String.IsNullOrEmpty(outLine.Data)) return;
|
||||
|
||||
string sOut = outLine.Data;
|
||||
ReportError.LogOut("CHDError: " + sOut);
|
||||
// We can get fed multiple lines worth of data because of \r line feeds
|
||||
string[] sLines = outLine.Data.Split(new string[] { "\r" }, StringSplitOptions.None);
|
||||
|
||||
_bgw.ReportProgress(0, new bgwText3(sOut));
|
||||
foreach (string sLine in sLines) {
|
||||
|
||||
if (string.IsNullOrEmpty(sLine)) continue;
|
||||
|
||||
ReportError.LogOut("CHDError: " + sLine);
|
||||
_bgw.ReportProgress(0, new bgwText3(sLine));
|
||||
|
||||
if (_resultType != CHDManCheck.Unset)
|
||||
{
|
||||
if(_errorLines>0)
|
||||
if (_errorLines>0)
|
||||
{
|
||||
_errorLines -= 1;
|
||||
_result += "\r\n" + sOut;
|
||||
_result += "\r\n" + sLine;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (System.Text.RegularExpressions.Regex.IsMatch(sLine, @"^No verification to be done; CHD has (uncompressed|no checksum)"))
|
||||
{
|
||||
_result = sLine;
|
||||
_resultType = CHDManCheck.Corrupt;
|
||||
}
|
||||
else if (System.Text.RegularExpressions.Regex.IsMatch(sLine, @"^Error (opening|reading) CHD file.*"))
|
||||
{
|
||||
_result = sLine;
|
||||
_resultType = CHDManCheck.Corrupt;
|
||||
}
|
||||
else if (System.Text.RegularExpressions.Regex.IsMatch(sLine, @"^Error opening parent CHD file .*:"))
|
||||
{
|
||||
_result = sLine;
|
||||
_resultType = CHDManCheck.Corrupt;
|
||||
}
|
||||
else if (System.Text.RegularExpressions.Regex.IsMatch(sLine, @"^Error: (Raw|Overall) SHA1 in header"))
|
||||
{
|
||||
_result = sLine;
|
||||
_resultType = CHDManCheck.Corrupt;
|
||||
}
|
||||
else if (System.Text.RegularExpressions.Regex.IsMatch(sLine, @"^Out of memory"))
|
||||
{
|
||||
_result = sLine;
|
||||
_resultType = CHDManCheck.Corrupt;
|
||||
}
|
||||
// Verifying messages are a non-error
|
||||
else if (System.Text.RegularExpressions.Regex.IsMatch(sLine, @"Verifying, \d+\.\d+\% complete\.\.\."))
|
||||
{
|
||||
|
||||
if (sOut.Length > 44)
|
||||
if (sOut.Substring(0, 23) == "Error reading CHD file " && sOut.Substring(sOut.Length - 21, 21) == ": decompression error")
|
||||
{
|
||||
_result = sOut;
|
||||
_resultType = CHDManCheck.Corrupt;
|
||||
return;
|
||||
}
|
||||
if (sOut.Length > 35)
|
||||
if (sOut.Substring(0, 23) == "Error opening CHD file " && sOut.Substring(sOut.Length - 21, 21) == ": decompression error")
|
||||
else
|
||||
{
|
||||
_result = sOut;
|
||||
_resultType = CHDManCheck.Corrupt;
|
||||
return;
|
||||
}
|
||||
if (sOut.Length > 35)
|
||||
if (sOut.Substring(0, 23) == "Error opening CHD file " && sOut.Substring(sOut.Length - 12, 12) == ": read error")
|
||||
{
|
||||
_result = sOut;
|
||||
_resultType = CHDManCheck.Corrupt;
|
||||
return;
|
||||
}
|
||||
if (sOut.Length > 25)
|
||||
if (sOut.Substring(0, 25) == "Error: Raw SHA1 in header")
|
||||
{
|
||||
_result = sOut;
|
||||
_errorLines = 1;
|
||||
_resultType = CHDManCheck.Corrupt;
|
||||
return;
|
||||
}
|
||||
if (sOut.Length == 13)
|
||||
if (sOut == "Out of memory")
|
||||
{
|
||||
_result = sOut;
|
||||
_resultType = CHDManCheck.Corrupt;
|
||||
return;
|
||||
}
|
||||
|
||||
// check for Verifying message
|
||||
if (sOut.Length >= 24)
|
||||
if (sOut.Substring(0, 11) == "Verifying, " && sOut.Substring(sOut.Length - 13, 13) == " complete... ")
|
||||
{
|
||||
//_resultType = CHDManCheck.Good;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ReportError.SendErrorMessage("CHDErrorHandler returned =" + sOut);
|
||||
_result = "Unknown message : " + sOut;
|
||||
ReportError.SendErrorMessage("CHDErrorHandler returned =" + sLine);
|
||||
_result = "Unknown message : " + sLine;
|
||||
_resultType = CHDManCheck.CHDUnknownError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user