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);
|
tFile.FileStatusSet(FileStatus.SHA1CHDVerified);
|
||||||
return;
|
return;
|
||||||
case CHD.CHDManCheck.Corrupt:
|
case CHD.CHDManCheck.Corrupt:
|
||||||
_bgw.ReportProgress(0, new bgwShowError(error, filename));
|
_bgw.ReportProgress(0, new bgwShowError(filename, error));
|
||||||
tFile.GotStatus = GotStatus.Corrupt;
|
tFile.GotStatus = GotStatus.Corrupt;
|
||||||
return;
|
return;
|
||||||
|
case CHD.CHDManCheck.CHDReturnError:
|
||||||
case CHD.CHDManCheck.CHDUnknownError:
|
case CHD.CHDManCheck.CHDUnknownError:
|
||||||
_bgw.ReportProgress(0, new bgwShowError(error, filename));
|
_bgw.ReportProgress(0, new bgwShowError(filename, error));
|
||||||
return;
|
return;
|
||||||
case CHD.CHDManCheck.ChdmanNotFound:
|
case CHD.CHDManCheck.ChdmanNotFound:
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -245,10 +245,14 @@ namespace ROMVault2.SupportedFiles.CHD
|
|||||||
_result = "";
|
_result = "";
|
||||||
_resultType = CHDManCheck.Unset;
|
_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))
|
if (!File.Exists(chdPath))
|
||||||
{
|
{
|
||||||
result = "chdman not found";
|
result = chdExe + " Not Found.";
|
||||||
return CHDManCheck.ChdmanNotFound;
|
return CHDManCheck.ChdmanNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,7 +334,7 @@ namespace ROMVault2.SupportedFiles.CHD
|
|||||||
switch (_outputLineCount)
|
switch (_outputLineCount)
|
||||||
{
|
{
|
||||||
case 0:
|
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;
|
_result = "Incorrect startup of CHDMan :" + sOut;
|
||||||
_resultType = CHDManCheck.CHDReturnError;
|
_resultType = CHDManCheck.CHDReturnError;
|
||||||
@@ -367,70 +371,61 @@ namespace ROMVault2.SupportedFiles.CHD
|
|||||||
// Collect the process command output.
|
// Collect the process command output.
|
||||||
if (String.IsNullOrEmpty(outLine.Data)) return;
|
if (String.IsNullOrEmpty(outLine.Data)) return;
|
||||||
|
|
||||||
string sOut = outLine.Data;
|
// We can get fed multiple lines worth of data because of \r line feeds
|
||||||
ReportError.LogOut("CHDError: " + sOut);
|
string[] sLines = outLine.Data.Split(new string[] { "\r" }, StringSplitOptions.None);
|
||||||
|
|
||||||
_bgw.ReportProgress(0, new bgwText3(sOut));
|
foreach (string sLine in sLines) {
|
||||||
|
|
||||||
if (_resultType != CHDManCheck.Unset)
|
if (string.IsNullOrEmpty(sLine)) continue;
|
||||||
{
|
|
||||||
if(_errorLines>0)
|
ReportError.LogOut("CHDError: " + sLine);
|
||||||
|
_bgw.ReportProgress(0, new bgwText3(sLine));
|
||||||
|
|
||||||
|
if (_resultType != CHDManCheck.Unset)
|
||||||
{
|
{
|
||||||
_errorLines -= 1;
|
if (_errorLines>0)
|
||||||
_result += "\r\n" + sOut;
|
{
|
||||||
|
_errorLines -= 1;
|
||||||
|
_result += "\r\n" + sLine;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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\.\.\."))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ReportError.SendErrorMessage("CHDErrorHandler returned =" + sLine);
|
||||||
|
_result = "Unknown message : " + sLine;
|
||||||
|
_resultType = CHDManCheck.CHDUnknownError;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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")
|
|
||||||
{
|
|
||||||
_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;
|
|
||||||
_resultType = CHDManCheck.CHDUnknownError;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user