Removed Input() stuff!

This commit is contained in:
Alex-TIMEHACK 2017-11-18 16:09:54 +00:00
parent b2f7322f30
commit 65b7ac2b8c
3 changed files with 19 additions and 22 deletions

View file

@ -14,12 +14,10 @@ namespace ShiftOS.Main.Terminal.Commands
public override string Usage { get; } = "Hello <NAME>."; public override string Usage { get; } = "Hello <NAME>.";
public override bool Unlocked { get; set; } = false; public override bool Unlocked { get; set; } = false;
public override async void Run(params string[] parameters) public override void Run(params string[] parameters)
{ {
string name = string.Join(" ", parameters); string name = string.Join(" ", parameters);
WriteLine($"Oh, hello, {name}.", Color.Red); WriteLine($"Oh, hello, {name}.");
string age = await Input("Hey, What's your age?");
WriteLine($"Ok, so your name is {name} and your age {age}.");
} }
} }
} }

View file

@ -11,10 +11,9 @@ namespace ShiftOS.Main.Terminal
public static class TerminalBackend public static class TerminalBackend
{ {
// The line below gets all the terminal commands in... well... the entire ShiftOS.Engine // The line below gets all the terminal commands in... well... the entire ShiftOS.Engine
public static IEnumerable<TerminalCommand> instances = from t in Assembly.GetExecutingAssembly().GetTypes() public static IEnumerable<TerminalCommand> instances = Assembly.GetExecutingAssembly().GetTypes()
where t.IsSubclassOf(typeof(TerminalCommand)) .Where(t => t.IsSubclassOf(typeof(TerminalCommand)) && t.GetConstructor(Type.EmptyTypes) != null)
&& t.GetConstructor(Type.EmptyTypes) != null .Select(t => Activator.CreateInstance(t) as TerminalCommand);
select Activator.CreateInstance(t) as TerminalCommand;
public static List<ShiftOS.Apps.Terminal> trm = new List<ShiftOS.Apps.Terminal>(); public static List<ShiftOS.Apps.Terminal> trm = new List<ShiftOS.Apps.Terminal>();
public static int trmTopID = 0; public static int trmTopID = 0;

View file

@ -71,22 +71,22 @@ namespace ShiftOS.Main.Terminal
/// Writes specified text in the terminal. /// Writes specified text in the terminal.
/// </summary> /// </summary>
/// <param name="value"><summary>The text to say before requesting text. </summary></param> /// <param name="value"><summary>The text to say before requesting text. </summary></param>
public virtual Task<string> Input(string value = "") //public virtual Task<string> Input(string value = "")
{ //{
ShiftOS.Apps.Terminal trm = Array.Find(TerminalBackend.trm.ToArray(), w => w.TerminalID == TermID); // ShiftOS.Apps.Terminal trm = Array.Find(TerminalBackend.trm.ToArray(), w => w.TerminalID == TermID);
trm.Input(value); // trm.Input(value);
Task<string> Input = new Task<string>(() => // Task<string> Input = new Task<string>(() =>
{ // {
while (true) // while (true)
if (trm.InputReturnText != "") break; // if (trm.InputReturnText != "") break;
// The terminal has finally decided! // // The terminal has finally decided!
return trm.InputReturnText; // return trm.InputReturnText;
}); // });
Input.Start(); // Input.Start();
return Input; // return Input;
} //}
} }
} }