aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-01-22 10:01:13 -0500
committerMichael <[email protected]>2017-01-22 10:01:13 -0500
commit555cc1319aae4b6e7cf9421f63dee9ffc547cbd5 (patch)
tree945f4ccd51a97ecc49493c5177193a3dd3ecf0bf
parent2ce2214d5e43fb625c2f9cde22f791ee097643e1 (diff)
downloadshiftos_thereturn-555cc1319aae4b6e7cf9421f63dee9ffc547cbd5.tar.gz
shiftos_thereturn-555cc1319aae4b6e7cf9421f63dee9ffc547cbd5.tar.bz2
shiftos_thereturn-555cc1319aae4b6e7cf9421f63dee9ffc547cbd5.zip
Add trm.exit command for exiting remote sessions.
-rw-r--r--ShiftOS.Server/Program.cs10
-rw-r--r--ShiftOS.WinForms/Applications/Terminal.cs5
-rw-r--r--ShiftOS.WinForms/Commands.cs19
-rw-r--r--ShiftOS_TheReturn/TerminalBackend.cs2
4 files changed, 35 insertions, 1 deletions
diff --git a/ShiftOS.Server/Program.cs b/ShiftOS.Server/Program.cs
index 7204127..e6c3a3f 100644
--- a/ShiftOS.Server/Program.cs
+++ b/ShiftOS.Server/Program.cs
@@ -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)
{
diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs
index 133858c..0a123d6 100644
--- a/ShiftOS.WinForms/Applications/Terminal.cs
+++ b/ShiftOS.WinForms/Applications/Terminal.cs
@@ -361,6 +361,11 @@ namespace ShiftOS.WinForms.Applications
IsInRemoteSystem = true;
RemoteGuid = msg.GUID;
}
+ else if(msg.Name == "trm_handshake_stop")
+ {
+ IsInRemoteSystem = false;
+ RemoteGuid = "";
+ }
};
}
diff --git a/ShiftOS.WinForms/Commands.cs b/ShiftOS.WinForms/Commands.cs
index 2f95fe2..2d297f5 100644
--- a/ShiftOS.WinForms/Commands.cs
+++ b/ShiftOS.WinForms/Commands.cs
@@ -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)
diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs
index 4edc709..7a1ce3e 100644
--- a/ShiftOS_TheReturn/TerminalBackend.cs
+++ b/ShiftOS_TheReturn/TerminalBackend.cs
@@ -286,7 +286,7 @@ namespace ShiftOS.Engine
}
IsForwardingConsoleWrites = false;
}
- else if(msg.Name == "pleasewrite")
+ else if (msg.Name == "pleasewrite")
{
Console.Write(msg.Contents);
}