Flag unparsed pkms

With every format now supported, can flag GameVersion=0 pkm
This commit is contained in:
Kurt 2017-05-17 21:50:52 -07:00
parent a415ca78df
commit fc676ec648
2 changed files with 8 additions and 7 deletions

View file

@ -40,7 +40,7 @@ namespace PKHeX.Core
if (Error) if (Error)
return new int[4]; return new int[4];
if (_allSuggestedMoves == null) if (_allSuggestedMoves == null)
return _allSuggestedMoves = !pkm.IsOriginValid ? new int[4] : getSuggestedMoves(true, true, true); return _allSuggestedMoves = pkm == null || !pkm.IsOriginValid ? new int[4] : getSuggestedMoves(true, true, true);
return _allSuggestedMoves; return _allSuggestedMoves;
} }
} }
@ -51,7 +51,7 @@ namespace PKHeX.Core
if (Error) if (Error)
return new int[4]; return new int[4];
if (_allSuggestedRelearnMoves == null) if (_allSuggestedRelearnMoves == null)
return _allSuggestedRelearnMoves = !pkm.IsOriginValid ? new int[4] : Legal.getValidRelearn(pkm, -1).ToArray(); return _allSuggestedRelearnMoves = pkm == null || !pkm.IsOriginValid ? new int[4] : Legal.getValidRelearn(pkm, -1).ToArray();
return _allSuggestedRelearnMoves; return _allSuggestedRelearnMoves;
} }
} }
@ -86,8 +86,7 @@ namespace PKHeX.Core
case 7: parsePK7(pk); break; case 7: parsePK7(pk); break;
} }
Valid = Parsed = Parse.Any(); if (Parse.Count > 0)
if (Parsed)
{ {
if (Parse.Any(chk => !chk.Valid)) if (Parse.Any(chk => !chk.Valid))
Valid = false; Valid = false;
@ -95,6 +94,8 @@ namespace PKHeX.Core
Valid = false; Valid = false;
else if (vRelearn.Any(m => m.Valid != true)) else if (vRelearn.Any(m => m.Valid != true))
Valid = false; Valid = false;
else
Valid = true;
if (pkm.FatefulEncounter && vRelearn.Any(chk => !chk.Valid) && EncounterMatch == null) if (pkm.FatefulEncounter && vRelearn.Any(chk => !chk.Valid) && EncounterMatch == null)
AddLine(Severity.Indeterminate, V188, CheckIdentifier.Fateful); AddLine(Severity.Indeterminate, V188, CheckIdentifier.Fateful);
@ -104,10 +105,10 @@ namespace PKHeX.Core
{ {
Console.WriteLine(e.Message); Console.WriteLine(e.Message);
Valid = false; Valid = false;
Parsed = true;
AddLine(Severity.Invalid, V190, CheckIdentifier.Misc); AddLine(Severity.Invalid, V190, CheckIdentifier.Misc);
Error = true; Error = true;
} }
Parsed = true;
} }
private void AddLine(Severity s, string c, CheckIdentifier i) private void AddLine(Severity s, string c, CheckIdentifier i)
@ -321,7 +322,7 @@ namespace PKHeX.Core
} }
private string getLegalityReport() private string getLegalityReport()
{ {
if (!Parsed) if (!Parsed || pkm == null)
return V189; return V189;
var lines = new List<string>(); var lines = new List<string>();