private void HandleTelnetWontOption(TelnetSymbol myTelnetSymbol) { if (OnWontOptionReceived != null) { TelnetOptionEventArgs args = new TelnetOptionEventArgs(); args.TelnetSymbol = myTelnetSymbol; OnWontOptionReceived(this, args); // Set the remote option to false and send dont if (_RemoteOptions[(Int32)myTelnetSymbol.Option]) { SendDontOption(myTelnetSymbol.Option); _RemoteOptions[(Int32)myTelnetSymbol.Option] = false; } // The option is already set to false, so do nothing else { } } }
private void HandleTelnetDoOption(TelnetSymbol myTelnetSymbol) { if (OnDoOptionReceived != null) { TelnetOptionEventArgs args = new TelnetOptionEventArgs(); args.TelnetSymbol = myTelnetSymbol; OnDoOptionReceived(this, args); if (args.Accepted) { // only if we did not set this option already if (!_LocalOptions[(Int32)myTelnetSymbol.Option]) { _LocalOptions[(Int32)myTelnetSymbol.Option] = true; SendWillOption(myTelnetSymbol.Option); } } else { _LocalOptions[(Int32)myTelnetSymbol.Option] = false; SendWontOption(myTelnetSymbol.Option); } } }
private void HandleTelnetWillOption(TelnetSymbol myTelnetSymbol) { if (OnWillOptionReceived != null) { TelnetOptionEventArgs args = new TelnetOptionEventArgs(); args.TelnetSymbol = myTelnetSymbol; OnWillOptionReceived(this, args); // If the remote option changed than set this option and send a Do or Dont depending on accepted if (args.Accepted != _RemoteOptions[(Int32)myTelnetSymbol.Option]) { _RemoteOptions[(Int32)myTelnetSymbol.Option] = args.Accepted; if (args.Accepted) SendDoOption(myTelnetSymbol.Option); else SendDontOption(myTelnetSymbol.Option); } } }
private void HandleTelnetDontOption(TelnetSymbol myTelnetSymbol) { if (OnDontOptionReceived != null) { TelnetOptionEventArgs args = new TelnetOptionEventArgs(); args.TelnetSymbol = myTelnetSymbol; OnDontOptionReceived(this, args); // we accepted the dont of this option if (args.Accepted) { _LocalOptions[(Int32)myTelnetSymbol.Option] = false; SendWontOption(myTelnetSymbol.Option); } // if we do not accept the dont we could try to send a SendWillOption else { } } }