debugging info

maybe I should stop pre-released :/
This commit is contained in:
Adam R. Grey 2021-10-31 11:19:14 -04:00
parent 10face4c9e
commit 05b6ce6d8b

View File

@ -48,7 +48,7 @@ namespace creatureBirdDwarf
Console.WriteLine("no oracled.json, can't help but assume contents will be different"); Console.WriteLine("no oracled.json, can't help but assume contents will be different");
} }
if (needUpdate("./oracled.json", "./oracle-now.json")) if (needUpdate("./oracle-now.json", "./oracled.json"))
{ {
Console.WriteLine("looks different, going to have to update."); Console.WriteLine("looks different, going to have to update.");
Console.WriteLine("scryfall requests 50-100 ms between requests. Granted I can't imagine it hasn't been that long."); Console.WriteLine("scryfall requests 50-100 ms between requests. Granted I can't imagine it hasn't been that long.");
@ -81,6 +81,7 @@ namespace creatureBirdDwarf
var rhs = JsonConvert.DeserializeObject<List<Card>>(File.ReadAllText(path2)); var rhs = JsonConvert.DeserializeObject<List<Card>>(File.ReadAllText(path2));
if(lhs == null || rhs == null) if(lhs == null || rhs == null)
{ {
Console.WriteLine($"one list not found.");
return true; return true;
} }
foreach(var lhsCard in lhs) foreach(var lhsCard in lhs)
@ -88,19 +89,31 @@ namespace creatureBirdDwarf
var rhsCard = rhs.FirstOrDefault(c => c.oracle_id == lhsCard.oracle_id); var rhsCard = rhs.FirstOrDefault(c => c.oracle_id == lhsCard.oracle_id);
if(rhsCard == null || lhsCard.oracle_text != rhsCard.oracle_text) if(rhsCard == null || lhsCard.oracle_text != rhsCard.oracle_text)
{ {
Console.WriteLine($"{lhsCard.name} looks updated.");
if(rhsCard == null)
{
Console.WriteLine($"no rhs card. added or removed.");
}
else
{
Console.WriteLine("oracle text different:");
Console.WriteLine(lhsCard.oracle_text);
Console.WriteLine(rhsCard.oracle_text);
}
return true; return true;
} }
rhs.Remove(rhsCard); rhs.Remove(rhsCard);
} }
if(rhs.Count() > 0) if(rhs.Count() > 0)
{ {
Console.WriteLine($"at least 1 card added or removed: {rhs.First().name}");
return true; return true;
} }
return false; return false;
} }
else else
{ {
Console.WriteLine("1 path not found.");
return true; return true;
} }
} }