protected sealed override void HandleOption() { if (TelnetOption.IsDesired(option)) { TelnetOption.Number(option).Enabled = true; } }
/// <summary>Return a <see cref="TelnetOption"/> instance of the type specified by <paramref name="optionNumber"/></summary> /// <remarks>If the referenced option number is not desired, return null. /// Each <see cref="TelnetOption"/> should have at most one instance. This method enforces that singleton behavior. /// If an option type requires special handling, create a subclass of <see cref="TelnetOption"/> and instantiate it in this method.</remarks> public static TelnetOption Number(int optionNumber) { TelnetOption theOption = null; if (OptionRegistry.ContainsKey(optionNumber)) { OptionRegistry.TryGetValue(optionNumber, out theOption); } return(theOption); }
private string commandAndOptionDescription() { return(commandTypeDescription() + " " + TelnetOption.NameOfOptionNumber(option) + " "); }
protected sealed override string humanReadableForm() { if (this.isIncoming()) { return(commandAndOptionDescription() + NameOfCommandTypeNumber(sendCommand)); } else { return(commandAndOptionDescription() + NameOfCommandTypeNumber((int)CommandType.IS) + " " + TelnetOption.Number(option).proposedValue); } }
/// <summary>Enable the option handled by this command. Assumes the subnegotiation has happened successfully.</summary> protected sealed override void HandleOption() => TelnetOption.Number(option).Active = true;