private static void SwitchToInteractiveMode( RSA rsa, CancellationTokenSource cancellationTokenSource) { var whitelist = new Whitelist(); whitelist.ReloadWhitelist(); var cqHub = new CQHub( _crypt, whitelist, rsa, OnStatusChanged); #pragma warning disable 4014 var ddnsUpdater = new DynamicDnsUpdater(_crypt, OnStatusChanged); ddnsUpdater.UpdateDynamicDnsAsync(); #pragma warning restore 4014 var interactiveShell = new InteractiveShell( whitelist, cqHub, _crypt, _processId, rsa, OnStatusChanged, cancellationTokenSource); interactiveShell.ProcessCommand("/THUMBPRINT").Wait(); InteractiveShell.PrintInteractiveHelp("HELP"); while (!cancellationTokenSource.IsCancellationRequested) { var command = Console.ReadLine(); if (!string.IsNullOrWhiteSpace(command)) { try { var task = interactiveShell.ProcessCommand(command); task.Wait(); } catch (Exception ex) { ex.Log(); } } } }
public InteractiveShell( Whitelist whitelist, CQHub cqHub, Crypt crypt, int processId, RSA rsa, Action <string> onStatusChange, CancellationTokenSource cancellationTokenSource) { _whitelist = whitelist; _cqHub = cqHub; _crypt = crypt; _processId = processId; _rsa = rsa; _cancellationTokenSource = cancellationTokenSource; _cqHub.NewConnection += Hub_NewConnection; }