mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-22 18:02:16 +00:00
Add trm.exit command for exiting remote sessions.
This commit is contained in:
parent
2ce2214d5e
commit
555cc1319a
4 changed files with 35 additions and 1 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -361,6 +361,11 @@ namespace ShiftOS.WinForms.Applications
|
|||
IsInRemoteSystem = true;
|
||||
RemoteGuid = msg.GUID;
|
||||
}
|
||||
else if(msg.Name == "trm_handshake_stop")
|
||||
{
|
||||
IsInRemoteSystem = false;
|
||||
RemoteGuid = "";
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -286,7 +286,7 @@ namespace ShiftOS.Engine
|
|||
}
|
||||
IsForwardingConsoleWrites = false;
|
||||
}
|
||||
else if(msg.Name == "pleasewrite")
|
||||
else if (msg.Name == "pleasewrite")
|
||||
{
|
||||
Console.Write(msg.Contents);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue