I don't know WHAT git did but I fixed it.

This commit is contained in:
Alex-TIMEHACK 2017-11-18 16:46:45 +00:00
parent 6faabfbbd8
commit 179ec19e6b
5 changed files with 31 additions and 78 deletions

Binary file not shown.

View file

@ -63,7 +63,6 @@
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
<Compile Include="Tools.cs" />
<Compile Include="ShiftFS\ShiftDirectory.cs" /> <Compile Include="ShiftFS\ShiftDirectory.cs" />
<Compile Include="ShiftFS\ShiftFileStream.cs" /> <Compile Include="ShiftFS\ShiftFileStream.cs" />
<Compile Include="ShiftFS\ShiftTree.cs" /> <Compile Include="ShiftFS\ShiftTree.cs" />

View file

@ -102,9 +102,6 @@
<Compile Include="Terminal\Commands\Hello.cs" /> <Compile Include="Terminal\Commands\Hello.cs" />
<Compile Include="Terminal\TerminalBackend.cs" /> <Compile Include="Terminal\TerminalBackend.cs" />
<Compile Include="Terminal\TerminalCommand.cs" /> <Compile Include="Terminal\TerminalCommand.cs" />
<EmbeddedResource Include="HijackScreen.resx">
<DependentUpon>HijackScreen.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>

View file

@ -14,51 +14,47 @@ namespace ShiftOS.Main.ShiftOS.Apps
public bool RunningCommand = false; public bool RunningCommand = false;
public bool WaitingResponse = false; public bool WaitingResponse = false;
public string InputReturnText = ""; public string InputReturnText = "";
using ShiftOS.Engine.Terminal;
namespace ShiftOS.Main.ShiftOS.Apps
{
public partial class Terminal : UserControl
{
public string DefaulttextBefore = "user> ";
string DefaulttextResult = "user@shiftos> "; // NOT YET IMPLEMENTED!!!
bool DoClear = false;
// The below variables makes the terminal... a terminal! // The below variables makes the terminal... a terminal!
string OldText = ""; string OldText = "";
int TrackingPosition; int TrackingPosition;
termmain.ContextMenuStrip = new ContextMenuStrip(); // Disables the right click of a richtextbox!
TerminalBackend.trm.Add(this); // Makes the commands run!
}
public Terminal() public Terminal()
{ {
InitializeComponent(); InitializeComponent();
termmain.ContextMenuStrip = new ContextMenuStrip(); // Disables the right click of a richtextbox! termmain.ContextMenuStrip = new ContextMenuStrip(); // Disables the right click of a richtextbox!
TerminalBackend.trm.Add(this);
}
void Print()
{
termmain.AppendText($"\n {defaulttextResult}");
TrackingPosition = termmain.Text.Length;
} }
void Print(string text) void Print(string text)
{ {
termmain.AppendText($"\n {text} \n {DefaulttextResult}"); termmain.AppendText($"\n {text} \n {defaulttextResult}");
TrackingPosition = termmain.Text.Length; TrackingPosition = termmain.Text.Length;
} }
if (e.Control && e.KeyCode == Keys.V)
{ //if (e.Control && e.KeyCode == Keys.V)
//if (Clipboard.ContainsText()) // {
// termmain.Paste(DataFormats.GetFormat(DataFormats.Text)); // //if (Clipboard.ContainsText())
e.Handled = true; // // termmain.Paste(DataFormats.GetFormat(DataFormats.Text));
} else if (e.KeyCode == Keys.Enter) { // e.Handled = true;
RunningCommand = true; // } else if (e.KeyCode == Keys.Enter) {
TerminalBackend.RunCommand(termmain.Text.Substring(TrackingPosition, termmain.Text.Length - TrackingPosition), TerminalID); // The most horrific line in the entire application! // RunningCommand = true;
RunningCommand = false; // TerminalBackend.RunCommand(termmain.Text.Substring(TrackingPosition, termmain.Text.Length - TrackingPosition), TerminalID); // The most horrific line in the entire application!
termmain.AppendText($"\n {defaulttextResult}"); // RunningCommand = false;
TrackingPosition = termmain.Text.Length; // termmain.AppendText($"\n {defaulttextResult}");
e.Handled = true; // TrackingPosition = termmain.Text.Length;
} // e.Handled = true;
} // }
//}
private void termmain_TextChanged(object sender, EventArgs e) private void termmain_TextChanged(object sender, EventArgs e)
{ {
@ -113,8 +109,7 @@ namespace ShiftOS.Main.ShiftOS.Apps
TrackingPosition = termmain.Text.Length; TrackingPosition = termmain.Text.Length;
DoClear = false; DoClear = false;
} }
}
}
void termmain_KeyDown(object sender, KeyEventArgs e) void termmain_KeyDown(object sender, KeyEventArgs e)
{ {
// The below code disables the ability to paste anything other then text... // The below code disables the ability to paste anything other then text...
@ -127,41 +122,10 @@ namespace ShiftOS.Main.ShiftOS.Apps
} }
else if (e.KeyCode == Keys.Enter) else if (e.KeyCode == Keys.Enter)
{ {
Print( TerminalBackend.RunCommand(termmain.Text.Substring(TrackingPosition, termmain.Text.Length - TrackingPosition), TerminalID); // The most horrific line in the entire application!
TerminalBackend.RunCommand( Print();
termmain.Text.Substring(
TrackingPosition,
termmain.Text.Length - TrackingPosition))); // The most horrific line in the entire application!
e.Handled = true; e.Handled = true;
} }
} }
void termmain_TextChanged(object sender, EventArgs e)
{
if (termmain.SelectionStart < TrackingPosition)
{
if (DoClear) return;
termmain.Text = OldText;
termmain.Select(termmain.Text.Length, 0);
}
else
{
OldText = termmain.Text;
}
}
void termmain_SelectionChanged(object sender, EventArgs e)
{
if (termmain.SelectionStart >= TrackingPosition) return;
termmain.Text = OldText;
termmain.Select(termmain.Text.Length, 0);
}
void Terminal_Load(object sender, EventArgs e)
{
Print("\n");
}
} }
} }

View file

@ -60,13 +60,6 @@ namespace ShiftOS.Main.ShiftOS
ShiftWM.Init(trm, "Terminal", null, false, true); ShiftWM.Init(trm, "Terminal", null, false, true);
} }
}
}
void terminalToolStripMenuItem_Click(object sender, EventArgs e)
{
var trm = new Terminal();
ShiftWM.Init(trm, "Terminal", null);
}
void textPadToolStripMenuItem_Click(object sender, EventArgs e) void textPadToolStripMenuItem_Click(object sender, EventArgs e)
{ {