aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Engine/Terminal/TerminalBackend.cs
diff options
context:
space:
mode:
authorAlex-TIMEHACK <[email protected]>2017-11-18 16:33:30 +0000
committerAlex-TIMEHACK <[email protected]>2017-11-18 16:33:30 +0000
commit6faabfbbd86d70c99e197a3d8cfcf7db0680d17f (patch)
tree36b9adff940f8afe596d4b9c0ba0ef60a28bb690 /ShiftOS.Engine/Terminal/TerminalBackend.cs
parent4037be53b29a122732cfc10693e9c0027f606bb0 (diff)
downloadshiftos-rewind-6faabfbbd86d70c99e197a3d8cfcf7db0680d17f.tar.gz
shiftos-rewind-6faabfbbd86d70c99e197a3d8cfcf7db0680d17f.tar.bz2
shiftos-rewind-6faabfbbd86d70c99e197a3d8cfcf7db0680d17f.zip
Fixed fork?
Diffstat (limited to 'ShiftOS.Engine/Terminal/TerminalBackend.cs')
-rw-r--r--ShiftOS.Engine/Terminal/TerminalBackend.cs46
1 files changed, 0 insertions, 46 deletions
diff --git a/ShiftOS.Engine/Terminal/TerminalBackend.cs b/ShiftOS.Engine/Terminal/TerminalBackend.cs
deleted file mode 100644
index e079d22..0000000
--- a/ShiftOS.Engine/Terminal/TerminalBackend.cs
+++ /dev/null
@@ -1,46 +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
- public static IEnumerable<TerminalCommand> instances = Assembly.GetExecutingAssembly().GetTypes()
- .Where(t => t.IsSubclassOf(typeof(TerminalCommand)) && t.GetConstructor(Type.EmptyTypes) != null)
- .Select(t => Activator.CreateInstance(t) as TerminalCommand);
-
- /// <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