public bool Equals(ExecLap other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(string.Equals(Role, other.Role) && Equals(Command, other.Command)); }
private static Lap ReadExecLap(YamlMappingNode lapSequence) { var lap = new ExecLap(); foreach (var pair in lapSequence.Children) { switch (pair.Key) { case YamlScalarNode s when s.Value == "role": if (pair.Value is YamlScalarNode role) { lap.Role = role.Value; } else { throw new FormatException("Invalid non-scalar value in 'role'."); } break; case YamlScalarNode s when s.Value == "command": if (pair.Value is YamlSequenceNode command) { foreach (var item in command.Children) { if (item is YamlScalarNode arg) { lap.Command.Add(arg.Value); } else { throw new FormatException("Invalid non-scalar value in 'command' item."); } } } else { throw new FormatException("Invalid non-sequence value in 'command'."); } break; } } return(lap); }