コード例 #1
0
 protected sealed override void HandleOption()
 {
     if (TelnetOption.IsDesired(option))
     {
         TelnetOption.Number(option).Enabled = true;
     }
 }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
 private string commandAndOptionDescription()
 {
     return(commandTypeDescription() + " " + TelnetOption.NameOfOptionNumber(option) + " ");
 }
コード例 #4
0
 protected sealed override string humanReadableForm()
 {
     if (this.isIncoming())
     {
         return(commandAndOptionDescription() + NameOfCommandTypeNumber(sendCommand));
     }
     else
     {
         return(commandAndOptionDescription() + NameOfCommandTypeNumber((int)CommandType.IS) + " " + TelnetOption.Number(option).proposedValue);
     }
 }
コード例 #5
0
 /// <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;