Cleaned up that messy Clear function

This commit is contained in:
Alex-TIMEHACK 2017-11-23 18:25:57 +00:00
parent b1a4d9ea4e
commit 0925e5a059
3 changed files with 5 additions and 7 deletions

View file

@ -99,7 +99,7 @@
<Compile Include="ShiftOS\Desktop.Designer.cs"> <Compile Include="ShiftOS\Desktop.Designer.cs">
<DependentUpon>Desktop.cs</DependentUpon> <DependentUpon>Desktop.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Terminal\Commands\clear.cs" /> <Compile Include="Terminal\Commands\Clear.cs" />
<Compile Include="Terminal\Commands\Hello.cs" /> <Compile Include="Terminal\Commands\Hello.cs" />
<Compile Include="Terminal\Commands\Help.cs" /> <Compile Include="Terminal\Commands\Help.cs" />
<Compile Include="Terminal\Commands\sftp.cs" /> <Compile Include="Terminal\Commands\sftp.cs" />

View file

@ -7,18 +7,16 @@ using System.Threading.Tasks;
namespace ShiftOS.Main.Terminal.Commands namespace ShiftOS.Main.Terminal.Commands
{ {
public class clear : TerminalCommand public class Clear : TerminalCommand
{ {
public override string Name { get; } = "clear"; public override string Name { get; } = "clear";
public override string Summary { get; } = "Clears all text from the terminal."; public override string Summary { get; } = "Clears all text from the terminal.";
public override string Usage { get; } = "clear"; public override string Usage { get; } = "clear";
public override bool Unlocked { get; set; } = false; public override bool Unlocked { get; set; } = false;
public static List<ShiftOS.Apps.Terminal> trm = TerminalBackend.trm;
public override void Run(params string[] parameters) public override void Run(params string[] parameters)
{ {
ShiftOS.Apps.Terminal trm = Array.Find(TerminalBackend.trm.ToArray(), w => w.TerminalID == TermID); Clear();
trm.Clear();
} }
} }
} }

View file

@ -88,12 +88,12 @@ namespace ShiftOS.Main.Terminal
// Input.Start(); // Input.Start();
// return Input; // return Input;
//} //}
/// <summary> /// <summary>
/// Clears all text from the terminal. /// Clears all text from the terminal.
/// </summary> /// </summary>
public virtual void Clear() public virtual void Clear()
{ {
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.Clear(); trm.Clear();