コード例 #1
0
ファイル: Program.cs プロジェクト: vhuarui/myrtille
        /// <summary>
        /// Handle commands from inputs pipe
        /// </summary>
        /// <param name="command"></param>
        /// <param name="data"></param>
        private static void PipeMessaging_OnMessageReceivedEvent(RemoteSessionCommand command, string data = "")
        {
            switch (command)
            {
            case RemoteSessionCommand.RequestFullscreenUpdate:
                WriteOutput(command, data);
                ClearOrExitTerminal(data);
                break;

            case RemoteSessionCommand.SendUserName:
                WriteOutput(command, data);
                UserName = data;
                break;

            case RemoteSessionCommand.SendServerAddress:
                WriteOutput(command, data);
                ServerAddress = data;
                break;

            case RemoteSessionCommand.SendUserPassword:
                WriteOutput(command, "Credentials received");
                Password = data;
                break;

            case RemoteSessionCommand.ConnectClient:
                WriteOutput(command, "Connecting to remote host");
                ConnectSSHClient();
                break;

            case RemoteSessionCommand.CloseClient:
                WriteOutput(command, "Disconnecting from remote host");
                pipeMessaging.ClosePipes();
                break;

            case RemoteSessionCommand.SendKeyUnicode:
                WriteOutput(command, string.IsNullOrEmpty(data) ? "," : data);
                HandleKeyboardInput(string.IsNullOrEmpty(data) ? "," : data);
                break;

            case RemoteSessionCommand.SetStatMode:
            case RemoteSessionCommand.SetDebugMode:
            case RemoteSessionCommand.SetCompatibilityMode:
                WriteOutput(command, "Reloading terminal");
                pipeMessaging.SendUpdatesPipeMessage("reload");
                break;
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: wdstest/myrtille
 /// <summary>
 /// Receive data from SSH client and send to updates pipe for processing by web client
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void ShellStream_DataReceived(object sender, ShellDataEventArgs e)
 {
     try
     {
         pipeMessaging.SendUpdatesPipeMessage("term|" + Encoding.UTF8.GetString(e.Data));
     }
     catch (Exception exc)
     {
         Trace.TraceError("Failed to process terminal updates, remote session {0} ({1})", RemoteSessionID, exc);
         pipeMessaging.ClosePipes();
     }
 }