Add trm.exit command for exiting remote sessions.

This commit is contained in:
Michael 2017-01-22 10:01:13 -05:00
parent 2ce2214d5e
commit 555cc1319a
4 changed files with 35 additions and 1 deletions

View file

@ -314,6 +314,16 @@ Contents:
}));
}
break;
case "trm_handshake_stop":
if(args["guid"] != null)
{
server.DispatchTo(new Guid(args["guid"] as string), new NetObject("trm_handshake_stop", new ServerMessage
{
Name = "trm_handshake_stop",
GUID = msg.GUID
}));
}
break;
case "write":
if(args["guid"] != null && args["text"] != null)
{

View file

@ -361,6 +361,11 @@ namespace ShiftOS.WinForms.Applications
IsInRemoteSystem = true;
RemoteGuid = msg.GUID;
}
else if(msg.Name == "trm_handshake_stop")
{
IsInRemoteSystem = false;
RemoteGuid = "";
}
};
}

View file

@ -42,6 +42,25 @@ namespace ShiftOS.WinForms
[Namespace("trm")]
public static class TerminalExtensions
{
[Command("exit")]
public static bool StopRemoting()
{
if(TerminalBackend.IsForwardingConsoleWrites == true)
{
ServerManager.SendMessage("trm_handshake_stop", $@"{{
guid: ""{TerminalBackend.ForwardGUID}""
}}");
Console.WriteLine("Goodbye!");
}
else
{
return false;
}
return true;
}
[Command("setpass", true)]
[RequiresArgument("pass")]
public static bool setPass(Dictionary<string, object> args)

View file

@ -286,7 +286,7 @@ namespace ShiftOS.Engine
}
IsForwardingConsoleWrites = false;
}
else if(msg.Name == "pleasewrite")
else if (msg.Name == "pleasewrite")
{
Console.Write(msg.Contents);
}