/// <summary> /// Converts the <see cref="WitnessRule"/> from a JSON object. /// </summary> /// <param name="json">The <see cref="WitnessRule"/> represented by a JSON object.</param> /// <returns>The converted <see cref="WitnessRule"/>.</returns> public static WitnessRule FromJson(JObject json) { return(new() { Action = Enum.Parse <WitnessRuleAction>(json["action"].GetString()), Condition = WitnessCondition.FromJson(json["condition"]) }); }
void ISerializable.Deserialize(ref MemoryReader reader) { Action = (WitnessRuleAction)reader.ReadByte(); if (Action != WitnessRuleAction.Allow && Action != WitnessRuleAction.Deny) { throw new FormatException(); } Condition = WitnessCondition.DeserializeFrom(ref reader, WitnessCondition.MaxNestingDepth); }