From 8fff93eb7da1b01d101e146ca7fe5d90ca01fcde Mon Sep 17 00:00:00 2001 From: FloppyDiskDrive Date: Thu, 23 Nov 2017 11:20:53 -0600 Subject: extremely rough savesystem --- ShiftOS.Main/Terminal/Commands/Help.cs | 4 ++-- ShiftOS.Main/Terminal/Commands/clear.cs | 24 ++++++++++++++++++++++++ ShiftOS.Main/Terminal/Commands/tcpip.cs | 12 +++++++++--- 3 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 ShiftOS.Main/Terminal/Commands/clear.cs (limited to 'ShiftOS.Main/Terminal/Commands') diff --git a/ShiftOS.Main/Terminal/Commands/Help.cs b/ShiftOS.Main/Terminal/Commands/Help.cs index c851baf..9067551 100644 --- a/ShiftOS.Main/Terminal/Commands/Help.cs +++ b/ShiftOS.Main/Terminal/Commands/Help.cs @@ -25,13 +25,13 @@ namespace ShiftOS.Main.Terminal.Commands if (t.Name == args[0]) { solved = true; - WriteLine($"{t.Name}: {t.Summary} \nusage: {t.Usage}"); + WriteLine($"{t.Name}: {t.Summary} \n usage: {t.Usage}"); break; } } if (!solved) { - WriteLine("The command \"" + args[0] + "\" could not be found."); + WriteLine($"sbash: invalid token: {args[0]}"); } } } diff --git a/ShiftOS.Main/Terminal/Commands/clear.cs b/ShiftOS.Main/Terminal/Commands/clear.cs new file mode 100644 index 0000000..cbabf88 --- /dev/null +++ b/ShiftOS.Main/Terminal/Commands/clear.cs @@ -0,0 +1,24 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShiftOS.Main.Terminal.Commands +{ + public class clear : TerminalCommand + { + public override string Name { get; } = "clear"; + public override string Summary { get; } = "Clears all text from the terminal."; + public override string Usage { get; } = "clear"; + public override bool Unlocked { get; set; } = false; + public static List trm = TerminalBackend.trm; + public override void Run(params string[] parameters) + { + ShiftOS.Apps.Terminal trm = Array.Find(TerminalBackend.trm.ToArray(), w => w.TerminalID == TermID); + + trm.Clear(); + } + } +} diff --git a/ShiftOS.Main/Terminal/Commands/tcpip.cs b/ShiftOS.Main/Terminal/Commands/tcpip.cs index 5e0e232..815c010 100644 --- a/ShiftOS.Main/Terminal/Commands/tcpip.cs +++ b/ShiftOS.Main/Terminal/Commands/tcpip.cs @@ -10,8 +10,8 @@ namespace ShiftOS.Main.Terminal.Commands public class tcpip : TerminalCommand { public override string Name { get; } = "tcpip"; - public override string Summary { get; } = "Shows a list of incoming or outgoing commands."; - public override string Usage { get; } = "tcpip "; + public override string Summary { get; } = "Shows a list of incoming or outgoing connections."; + public override string Usage { get; } = "tcpip "; public override bool Unlocked { get; set; } = false; public override void Run(params string[] args) @@ -29,10 +29,16 @@ namespace ShiftOS.Main.Terminal.Commands WriteLine("tcpip: syntax error"); break; case "incoming": - WriteLine($"Incoming connections from localhost:"); + WriteLine("Incoming connections from localhost:"); WriteLine($"IP ADDRESS v4 COMPUTER NAME"); WriteLine($"{r.Next(0, 255)}.{r.Next(0, 255)}.{r.Next(0, 255)}.{r.Next(255)} {gen}"); break; + case "outgoing": + WriteLine("Outgoing connections from localhost:"); + WriteLine($"IP ADDRESS v4 COMPUTER NAME"); + WriteLine($"{r.Next(0, 255)}.{r.Next(0, 255)}.{r.Next(0, 255)}.{r.Next(255)} {gen}"); + WriteLine($"[1] outgoing connection(s) is using {r.Next(0, 16)} MiBs of bandwith."); + break; } } public string Generate(int amountToGenerate) -- cgit v1.2.3