fuckng hell

This commit is contained in:
Michael 2017-07-30 12:12:26 -04:00
parent 3d22591f46
commit 38c78acaff
4 changed files with 22 additions and 14 deletions

View file

@ -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);

View file

@ -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]

View file

@ -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);
}
}
}

View file

@ -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()