diff options
| author | AShifter <[email protected]> | 2017-11-18 10:04:42 -0700 |
|---|---|---|
| committer | AShifter <[email protected]> | 2017-11-18 10:04:42 -0700 |
| commit | b4a8a646b1d0c67414a0e1eeedcf9442739fd990 (patch) | |
| tree | 92c92907a420f2bb97719f4fd6c19ac72e283b8d /ShiftOS.Engine/Terminal/TerminalBackend.cs | |
| parent | ebdc09fe679b4b06fd149c8fc6539244100ce896 (diff) | |
| parent | cc734557de877186c5f5eb1e59efdcb785ac37a8 (diff) | |
| download | shiftos-rewind-b4a8a646b1d0c67414a0e1eeedcf9442739fd990.tar.gz shiftos-rewind-b4a8a646b1d0c67414a0e1eeedcf9442739fd990.tar.bz2 shiftos-rewind-b4a8a646b1d0c67414a0e1eeedcf9442739fd990.zip | |
Merge remote-tracking branch 'refs/remotes/ShiftOS-Rewind/master'
Diffstat (limited to 'ShiftOS.Engine/Terminal/TerminalBackend.cs')
| -rw-r--r-- | ShiftOS.Engine/Terminal/TerminalBackend.cs | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/ShiftOS.Engine/Terminal/TerminalBackend.cs b/ShiftOS.Engine/Terminal/TerminalBackend.cs deleted file mode 100644 index 793b748..0000000 --- a/ShiftOS.Engine/Terminal/TerminalBackend.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace ShiftOS.Engine.Terminal -{ - public static class TerminalBackend - { - // The line below gets all the terminal commands in... well... the entire ShiftOS.Engine - static readonly IEnumerable<TerminalCommand> Instances = from t in Assembly.GetExecutingAssembly().GetTypes() - where t.IsSubclassOf(typeof(TerminalCommand)) && - t.GetConstructor(Type.EmptyTypes) != null - select (TerminalCommand) Activator.CreateInstance(t); - - /// <summary> - /// Runs a terminal command. - /// </summary> - /// <param name="command"></param> - /// <returns>Returns all the output from that command.</returns> - public static string RunCommand(string command) - { - string name; - try - { - name = command.Split(' ')[0]; - } - catch - { - name = command; - } - - var theParams = new string[command.Split(' ').Length - 1]; - Array.Copy(command.Split(' '), 1, theParams, 0, command.Split(' ').Length - 1); - - foreach (var instance in Instances) - { - if (instance.GetName() == name) - { - return instance.Run(theParams); - } - } - - return "The command cannot be found."; - } - } -}
\ No newline at end of file |
