diff --git a/ShiftOS.Frontend/Apps/Terminal.cs b/ShiftOS.Frontend/Apps/Terminal.cs index 0621139..4af1196 100644 --- a/ShiftOS.Frontend/Apps/Terminal.cs +++ b/ShiftOS.Frontend/Apps/Terminal.cs @@ -164,34 +164,37 @@ namespace ShiftOS.Frontend.Apps /// An absolute fucking mess. Seriously, can someone fix this method so it uhh WORKS PROPERLY? public System.Drawing.Point GetPointAtIndex(Graphics gfx) { - int vertMeasure = 2; + var font = new Font(LoadedSkin.TerminalFont.Name, LoadedSkin.TerminalFont.Size * _zoomFactor, LoadedSkin.TerminalFont.Style); + + int _textHeight = (int)gfx.SmartMeasureString("#", font).Height; + float vertMeasure = 2; int horizMeasure = 2; if (string.IsNullOrEmpty(Text)) - return new System.Drawing.Point(horizMeasure, vertMeasure); + return new System.Drawing.Point(horizMeasure, (int)vertMeasure); int lineindex = 0; int line = GetCurrentLine(); for (int l = 0; l < line; l++) { - if (string.IsNullOrEmpty(Lines[l])) + lineindex += Lines[l].Length; + if (string.IsNullOrWhiteSpace(Lines[l])) { - vertMeasure += LoadedSkin.TerminalFont.Height * _zoomFactor; + vertMeasure += _textHeight; continue; } - lineindex += Lines[l].Length; - var stringMeasure = gfx.SmartMeasureString(Lines[l] == "\r" ? " " : Lines[l], LoadedSkin.TerminalFont, Width - 4); - vertMeasure += (int)stringMeasure.Height * _zoomFactor; - + var stringMeasure = gfx.SmartMeasureString(Lines[l], font, Width - 4); + vertMeasure += (int)(stringMeasure.Height); + } - var lnMeasure = gfx.SmartMeasureString(Text.Substring(lineindex, Index - lineindex), LoadedSkin.TerminalFont); - int w = (int)Math.Floor(lnMeasure.Width) * _zoomFactor; + var lnMeasure = gfx.SmartMeasureString(Text.Substring(lineindex, Index - lineindex), font); + int w = (int)Math.Floor(lnMeasure.Width); while (w > Width - 4) { w = w - (Width - 4); - vertMeasure += (int)lnMeasure.Height * _zoomFactor; + vertMeasure += (int)lnMeasure.Height; } horizMeasure += w; - return new System.Drawing.Point(horizMeasure, vertMeasure); + return new System.Drawing.Point(horizMeasure, (int)vertMeasure); } private PointF CaretPosition = new PointF(2, 2); diff --git a/ShiftOS.Frontend/Hacking/HackingCommands.cs b/ShiftOS.Frontend/Hacking/HackingCommands.cs index 5d51006..9ebb824 100644 --- a/ShiftOS.Frontend/Hacking/HackingCommands.cs +++ b/ShiftOS.Frontend/Hacking/HackingCommands.cs @@ -14,11 +14,13 @@ namespace ShiftOS.Frontend { TerminalBackend.SetShellOverride("sploitset> "); } + [Command("ftp")] public static void FTPEnter(Dictionary args) { TerminalBackend.SetShellOverride("SimplFTP> "); } + //TODO: Implement firewall cracking [Command("connect")] [MetaCommand] diff --git a/ShiftOS_TheReturn/CommandParser.cs b/ShiftOS_TheReturn/CommandParser.cs index bd274cd..7568b98 100644 --- a/ShiftOS_TheReturn/CommandParser.cs +++ b/ShiftOS_TheReturn/CommandParser.cs @@ -131,9 +131,9 @@ namespace ShiftOS.Engine if(id_found == false) { id_found = true; - id_text = inp; + id_text = inp.Remove(0,1); res = ""; - arguments.Add("id", inp); + arguments.Add("id", id_text); } } } diff --git a/ShiftOS_TheReturn/Hacking.cs b/ShiftOS_TheReturn/Hacking.cs index 0186e51..8412203 100644 --- a/ShiftOS_TheReturn/Hacking.cs +++ b/ShiftOS_TheReturn/Hacking.cs @@ -124,10 +124,13 @@ namespace ShiftOS.Engine throw new NaughtyDeveloperException("Someone tried to fail a non-existent hack."); if (CurrentHackable.IsPwn3d) throw new NaughtyDeveloperException("A developer tried to un-pwn a pwn3d hackable."); + Console.WriteLine(); Console.WriteLine("[sploitset] [FAIL] disconnected - connection terminated by remote machine "); if (!string.IsNullOrWhiteSpace(CurrentHackable.Data.OnHackFailedStoryEvent)) Story.Start(CurrentHackable.Data.OnHackFailedStoryEvent); CurrentHackable = null; + TerminalBackend.SetShellOverride(""); + TerminalBackend.PrintPrompt(); } public static void EndHack()