PreLaunchOperation Method
PreLaunchOperation()
Validate all settings and choices here.
C#
protected override void PreLaunchOperation()
Overrides
Yubico.YubiKey.Otp.Operations.OperationBase<Yubico.YubiKey.Otp.Operations.ConfigureHotp>.PreLaunchOperation()
Remarks
All possible validation should be done here. The point of this method is to simplify the ExecuteOperation() method that each operation must implement.
Conflicting choices that could not be checked by the OtpSettings<T> methods should be checked here.
Many of the operation classes use nullable fields (langword_csharp_bool?) for choices. This allows the PreLaunchOperation() implementation to verify that a choice has been made. In the ExecuteOperation() method, the field has already been validated, and an exception thrown if it was not set, so null-forgiving operators are used when accessing those fields in ExecuteOperation().