diff options
| author | Michael <[email protected]> | 2017-07-30 12:12:26 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-07-30 12:12:26 -0400 |
| commit | 38c78acaffdc8d04fb2201ac4517d20895c31759 (patch) | |
| tree | 63d8c2552a688940a82972d2fc6e25aed19cff7e /ShiftOS.Frontend | |
| parent | 3d22591f46a18ee3f585f169b34ccb5a0457e39f (diff) | |
| download | shiftos_thereturn-38c78acaffdc8d04fb2201ac4517d20895c31759.tar.gz shiftos_thereturn-38c78acaffdc8d04fb2201ac4517d20895c31759.tar.bz2 shiftos_thereturn-38c78acaffdc8d04fb2201ac4517d20895c31759.zip | |
fuckng hell
Diffstat (limited to 'ShiftOS.Frontend')
| -rw-r--r-- | ShiftOS.Frontend/Apps/Terminal.cs | 27 | ||||
| -rw-r--r-- | ShiftOS.Frontend/Hacking/HackingCommands.cs | 2 |
2 files changed, 17 insertions, 12 deletions
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 /// <returns>An absolute fucking mess. Seriously, can someone fix this method so it uhh WORKS PROPERLY?</returns> 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<string, object> args) { TerminalBackend.SetShellOverride("SimplFTP> "); } + //TODO: Implement firewall cracking [Command("connect")] [MetaCommand] |
