mirror of
https://github.com/ShiftOS-Rewind/ShiftOS.git
synced 2025-01-22 03:11:47 -05:00
fixed invalid command handling
yoy it works
This commit is contained in:
parent
8ec044f8c9
commit
f986e59659
4 changed files with 73 additions and 8 deletions
|
@ -76,6 +76,12 @@
|
|||
<Compile Include="ShiftFS\ShiftFS.cs" />
|
||||
<Compile Include="ShiftFS\IShiftNode.cs" />
|
||||
<Compile Include="Misc\Tools.cs" />
|
||||
<Compile Include="UI\ShiftButton.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\ShiftButton.Designer.cs">
|
||||
<DependentUpon>ShiftButton.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindowManager\InfoboxTemplate.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -1102,8 +1108,6 @@
|
|||
<ItemGroup>
|
||||
<None Include="Resources\zoombuttonpressed.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="UI\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
37
ShiftOS.Engine/UI/ShiftButton.Designer.cs
generated
Normal file
37
ShiftOS.Engine/UI/ShiftButton.Designer.cs
generated
Normal file
|
@ -0,0 +1,37 @@
|
|||
namespace ShiftOS.Engine.UI
|
||||
{
|
||||
partial class ShiftButton
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
20
ShiftOS.Engine/UI/ShiftButton.cs
Normal file
20
ShiftOS.Engine/UI/ShiftButton.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ShiftOS.Engine.UI
|
||||
{
|
||||
public partial class ShiftButton : UserControl
|
||||
{
|
||||
public ShiftButton()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,6 +30,7 @@ namespace ShiftOS.Main.Terminal
|
|||
var theParams = new string[command.Split(' ').Length - 1];
|
||||
Array.Copy(command.Split(' '), 1, theParams, 0, command.Split(' ').Length - 1);
|
||||
|
||||
bool complete = false;
|
||||
foreach (TerminalCommand instance in instances)
|
||||
{
|
||||
if (instance.Name.ToLower() == name.ToLower())
|
||||
|
@ -38,14 +39,17 @@ namespace ShiftOS.Main.Terminal
|
|||
// Add a new line!
|
||||
Array.Find(trm.ToArray(), w => w.TerminalID == TermID).termmain.AppendText("\n");
|
||||
instance.Run(theParams);
|
||||
complete = true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
}
|
||||
if(!complete)
|
||||
{
|
||||
Array.Find(trm.ToArray(), w => w.TerminalID == TermID).termmain.AppendText($"\nsbash: {command.Split(' ').First()}: invalid command");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Array.Find(trm.ToArray(), w => w.TerminalID == TermID).termmain.Text += " \n The command cannot be found. \n";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue