diff --git a/ShiftOS.Engine/Properties/Resources.Designer.cs b/ShiftOS.Engine/Properties/Resources.Designer.cs index ced728d..5959c79 100644 --- a/ShiftOS.Engine/Properties/Resources.Designer.cs +++ b/ShiftOS.Engine/Properties/Resources.Designer.cs @@ -1797,6 +1797,16 @@ namespace ShiftOS.Engine.Properties { } } + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] UbuntuMono_R { + get { + object obj = ResourceManager.GetObject("UbuntuMono_R", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/ShiftOS.Engine/Properties/Resources.resx b/ShiftOS.Engine/Properties/Resources.resx index 7d95cf4..bafd273 100644 --- a/ShiftOS.Engine/Properties/Resources.resx +++ b/ShiftOS.Engine/Properties/Resources.resx @@ -1114,4 +1114,7 @@ ..\Resources\3beepvirus.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\UbuntuMono-R.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/ShiftOS.Engine/Resources/UbuntuMono-R.ttf b/ShiftOS.Engine/Resources/UbuntuMono-R.ttf new file mode 100644 index 0000000..fdd309d Binary files /dev/null and b/ShiftOS.Engine/Resources/UbuntuMono-R.ttf differ diff --git a/ShiftOS.Engine/SaveSystem.cs b/ShiftOS.Engine/SaveSystem.cs new file mode 100644 index 0000000..59ddf4b --- /dev/null +++ b/ShiftOS.Engine/SaveSystem.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShiftOS.Engine +{ + public class SaveSystem + { + public static string gameDir + { + get + { + return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ShiftOS-Rewind"); + } + } + public static string fontDir + { + get + { + return gameDir + "\\Fonts"; + } + } + } +} diff --git a/ShiftOS.Engine/ShiftOS.Engine.csproj b/ShiftOS.Engine/ShiftOS.Engine.csproj index db21b5a..faff407 100644 --- a/ShiftOS.Engine/ShiftOS.Engine.csproj +++ b/ShiftOS.Engine/ShiftOS.Engine.csproj @@ -63,6 +63,7 @@ True Resources.resx + UserControl @@ -626,6 +627,7 @@ + diff --git a/ShiftOS.Main/Properties/Resources.Designer.cs b/ShiftOS.Main/Properties/Resources.Designer.cs index 94a198f..b3bb901 100644 --- a/ShiftOS.Main/Properties/Resources.Designer.cs +++ b/ShiftOS.Main/Properties/Resources.Designer.cs @@ -730,24 +730,25 @@ namespace ShiftOS.Main.Properties { } /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" ?> + /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8"?> + /// ///<grammar version="1.0" xml:lang="en-US" /// xmlns="http://www.w3.org/2001/06/grammar" /// tag-format="semantics/1.0" root="Main"> - /// + /// /// <!-- Catalyst Grammar File /// /// This file gives Catalyst the ability to recognize /// audio input and give a proper response. /// /// --> - /// + /// /// <rule id="Main"> /// <item> /// How much Code Points do I have? /// </item> - /// <item>Can you run <ruleref uri="#programs"/>?</item> - /// <item>Can you mini [rest of string was truncated]";. + /// <item>Can you run <ruleref uri="#programs" />?</item> + /// <item>Can you minimi [rest of string was truncated]";. /// internal static string CatalystGrammar { get { @@ -1796,6 +1797,16 @@ namespace ShiftOS.Main.Properties { } } + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] UbuntuMono_R { + get { + object obj = ResourceManager.GetObject("UbuntuMono_R", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/ShiftOS.Main/Properties/Resources.resx b/ShiftOS.Main/Properties/Resources.resx index 7d95cf4..bafd273 100644 --- a/ShiftOS.Main/Properties/Resources.resx +++ b/ShiftOS.Main/Properties/Resources.resx @@ -1114,4 +1114,7 @@ ..\Resources\3beepvirus.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\UbuntuMono-R.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/ShiftOS.Main/Resources/UbuntuMono-R.ttf b/ShiftOS.Main/Resources/UbuntuMono-R.ttf new file mode 100644 index 0000000..fdd309d Binary files /dev/null and b/ShiftOS.Main/Resources/UbuntuMono-R.ttf differ diff --git a/ShiftOS.Main/ShiftOS.Main.csproj b/ShiftOS.Main/ShiftOS.Main.csproj index 2171874..59351a4 100644 --- a/ShiftOS.Main/ShiftOS.Main.csproj +++ b/ShiftOS.Main/ShiftOS.Main.csproj @@ -99,6 +99,7 @@ Desktop.cs + @@ -592,6 +593,7 @@ + diff --git a/ShiftOS.Main/ShiftOS/Apps/Terminal.cs b/ShiftOS.Main/ShiftOS/Apps/Terminal.cs index c4bfe83..bd53ab7 100644 --- a/ShiftOS.Main/ShiftOS/Apps/Terminal.cs +++ b/ShiftOS.Main/ShiftOS/Apps/Terminal.cs @@ -4,6 +4,7 @@ using ShiftOS.Engine; using ShiftOS.Main.Terminal; using System.Linq; using System.Collections.Generic; +using System.Drawing.Text; namespace ShiftOS.Main.ShiftOS.Apps { @@ -17,6 +18,7 @@ namespace ShiftOS.Main.ShiftOS.Apps public bool WaitingResponse = false; public string InputReturnText = ""; public Stack c = TerminalBackend.commandBuffer; + private PrivateFontCollection fontCollection = new PrivateFontCollection(); // The below variables makes the terminal... a terminal! string OldText = ""; @@ -30,6 +32,11 @@ namespace ShiftOS.Main.ShiftOS.Apps termmain.ContextMenuStrip = new ContextMenuStrip(); // Disables the right click of a richtextbox! TerminalBackend.trm.Add(this); + + fontCollection.AddFontFile(SaveSystem.fontDir + "\\termFont.ttf"); + + termmain.Font = new System.Drawing.Font(fontCollection.Families[0], 12F, System.Drawing.FontStyle.Regular); + } void Print() diff --git a/ShiftOS.Main/ShiftOS/Desktop.cs b/ShiftOS.Main/ShiftOS/Desktop.cs index 28e3a38..7d1a052 100644 --- a/ShiftOS.Main/ShiftOS/Desktop.cs +++ b/ShiftOS.Main/ShiftOS/Desktop.cs @@ -1,22 +1,21 @@ using System; -using System.Linq; using System.Windows.Forms; -using ShiftOS.Engine.Misc; using ShiftOS.Engine.WindowManager; using ShiftOS.Main.Properties; using ShiftOS.Main.ShiftOS.Apps; -using System.Drawing; +using System.IO; +using ShiftOS.Engine; namespace ShiftOS.Main.ShiftOS { // testing github because git hates me - public partial class Desktop : Form + public partial class Desktop : Form { public Desktop() { InitializeComponent(); timer1.Start(); - + Setup(); Closed += (sender, args) => { Application.Exit(); }; } @@ -54,5 +53,11 @@ namespace ShiftOS.Main.ShiftOS { lblClock.Text = DateTime.Now.ToString("hh:mm:ss"); } + public void Setup() + { + if (!Directory.Exists(SaveSystem.gameDir)) Directory.CreateDirectory(SaveSystem.gameDir); + if (!Directory.Exists(SaveSystem.fontDir)) Directory.CreateDirectory(SaveSystem.fontDir); + if (!File.Exists(SaveSystem.fontDir + "\\termFont.ttf")) File.WriteAllBytes(SaveSystem.fontDir + "\\termFont.ttf", Resources.UbuntuMono_R); + } } } diff --git a/ShiftOS.Main/Terminal/Commands/Help.cs b/ShiftOS.Main/Terminal/Commands/Help.cs index c851baf..9067551 100644 --- a/ShiftOS.Main/Terminal/Commands/Help.cs +++ b/ShiftOS.Main/Terminal/Commands/Help.cs @@ -25,13 +25,13 @@ namespace ShiftOS.Main.Terminal.Commands if (t.Name == args[0]) { solved = true; - WriteLine($"{t.Name}: {t.Summary} \nusage: {t.Usage}"); + WriteLine($"{t.Name}: {t.Summary} \n usage: {t.Usage}"); break; } } if (!solved) { - WriteLine("The command \"" + args[0] + "\" could not be found."); + WriteLine($"sbash: invalid token: {args[0]}"); } } } diff --git a/ShiftOS.Main/Terminal/Commands/clear.cs b/ShiftOS.Main/Terminal/Commands/clear.cs new file mode 100644 index 0000000..cbabf88 --- /dev/null +++ b/ShiftOS.Main/Terminal/Commands/clear.cs @@ -0,0 +1,24 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShiftOS.Main.Terminal.Commands +{ + public class clear : TerminalCommand + { + public override string Name { get; } = "clear"; + public override string Summary { get; } = "Clears all text from the terminal."; + public override string Usage { get; } = "clear"; + public override bool Unlocked { get; set; } = false; + public static List trm = TerminalBackend.trm; + public override void Run(params string[] parameters) + { + ShiftOS.Apps.Terminal trm = Array.Find(TerminalBackend.trm.ToArray(), w => w.TerminalID == TermID); + + trm.Clear(); + } + } +} diff --git a/ShiftOS.Main/Terminal/Commands/tcpip.cs b/ShiftOS.Main/Terminal/Commands/tcpip.cs index 5e0e232..815c010 100644 --- a/ShiftOS.Main/Terminal/Commands/tcpip.cs +++ b/ShiftOS.Main/Terminal/Commands/tcpip.cs @@ -10,8 +10,8 @@ namespace ShiftOS.Main.Terminal.Commands public class tcpip : TerminalCommand { public override string Name { get; } = "tcpip"; - public override string Summary { get; } = "Shows a list of incoming or outgoing commands."; - public override string Usage { get; } = "tcpip "; + public override string Summary { get; } = "Shows a list of incoming or outgoing connections."; + public override string Usage { get; } = "tcpip "; public override bool Unlocked { get; set; } = false; public override void Run(params string[] args) @@ -29,10 +29,16 @@ namespace ShiftOS.Main.Terminal.Commands WriteLine("tcpip: syntax error"); break; case "incoming": - WriteLine($"Incoming connections from localhost:"); + WriteLine("Incoming connections from localhost:"); WriteLine($"IP ADDRESS v4 COMPUTER NAME"); WriteLine($"{r.Next(0, 255)}.{r.Next(0, 255)}.{r.Next(0, 255)}.{r.Next(255)} {gen}"); break; + case "outgoing": + WriteLine("Outgoing connections from localhost:"); + WriteLine($"IP ADDRESS v4 COMPUTER NAME"); + WriteLine($"{r.Next(0, 255)}.{r.Next(0, 255)}.{r.Next(0, 255)}.{r.Next(255)} {gen}"); + WriteLine($"[1] outgoing connection(s) is using {r.Next(0, 16)} MiBs of bandwith."); + break; } } public string Generate(int amountToGenerate) diff --git a/ShiftOS.Main/Terminal/TerminalCommand.cs b/ShiftOS.Main/Terminal/TerminalCommand.cs index 1f068ba..245f380 100644 --- a/ShiftOS.Main/Terminal/TerminalCommand.cs +++ b/ShiftOS.Main/Terminal/TerminalCommand.cs @@ -88,5 +88,15 @@ namespace ShiftOS.Main.Terminal // Input.Start(); // return Input; //} + /// + /// Clears all text from the terminal. + /// + public virtual void Clear() + { + + ShiftOS.Apps.Terminal trm = Array.Find(TerminalBackend.trm.ToArray(), w => w.TerminalID == TermID); + + trm.Clear(); + } } }