private JObject JsonPacket(string message, PacketProblems problems) { try { return(JObject.Parse(message)); } catch (JsonException) { problems.SevereError("Invalid JSON format per NewtonSoft JSON library"); } catch (Exception e) { problems.SevereError("Unknown failure. Exception message is: " + e.Message); } return(null); }
public void Validate(JObject jsonPacket, PacketProblems problems) { if (IsMissingValue(jsonPacket[RepublishCountKey])) { return; } int republishCount = (int)jsonPacket[RepublishCountKey]; if (republishCount >= _limit) { problems.SevereError($"Republish count of {republishCount} exceeds limit of {_limit}"); } }