From 2747ec98b77a58a4d311265229b5c2981df6d92f Mon Sep 17 00:00:00 2001 From: carverh Date: Wed, 20 Jul 2016 20:47:35 -0700 Subject: [PATCH] Fixed Couple Bugs and Crashes - Fixed: Crash when Hacking With No Tools - Fixed: Accessing directories outside of C:\ShiftOS using 'ls' command - Added Small Features --- .../WindowsFormsApplication1/Apps/Terminal.cs | 11 +- .../Gameplay/Hacking.cs | 111 ++++++++++-------- .../Resources/Credits.txt | 17 +-- 3 files changed, 74 insertions(+), 65 deletions(-) diff --git a/source/WindowsFormsApplication1/Apps/Terminal.cs b/source/WindowsFormsApplication1/Apps/Terminal.cs index 8293283..1d39f70 100644 --- a/source/WindowsFormsApplication1/Apps/Terminal.cs +++ b/source/WindowsFormsApplication1/Apps/Terminal.cs @@ -1378,8 +1378,15 @@ public string GetPath(string path) public string GetParent(string path) { - var d = new DirectoryInfo(path); - return d.Parent.FullName; + if (new DirectoryInfo(path).Parent.FullName.Contains("ShiftOS")) + { + var d = new DirectoryInfo(path); + return d.Parent.FullName; + } + else + { + return path; + } } public void DoCommand() diff --git a/source/WindowsFormsApplication1/Gameplay/Hacking.cs b/source/WindowsFormsApplication1/Gameplay/Hacking.cs index 7b18852..23c382d 100644 --- a/source/WindowsFormsApplication1/Gameplay/Hacking.cs +++ b/source/WindowsFormsApplication1/Gameplay/Hacking.cs @@ -373,62 +373,71 @@ public static void StartHack(int cid, string upgrade) { StartHack(cid, GetRandomHack()); } - else { - var h = Tools[cid]; - switch(h.Name) + else + { + if (Tools.Count <= cid) { - case "Destabilizer Attack": - var t = new Timer(); - t.Interval = 1000 / h.Effectiveness; - var rnd = new Random(); - t.Tick += (object s, EventArgs a) => - { - int r = rnd.Next(0, 100); - if(r == 90) + API.CreateInfoboxSession("Failed!", "No Hacking Tools Avalible!", infobox.InfoboxMode.Info); + return; + } + else + { + HackTool h = Tools[cid]; + switch (h.Name) + { + case "Destabilizer Attack": + var t = new Timer(); + t.Interval = 1000 / h.Effectiveness; + var rnd = new Random(); + t.Tick += (object s, EventArgs a) => { - t.Stop(); - API.CreateInfoboxSession("Hack complete.", "The hack has been completed.", infobox.InfoboxMode.Info); - GiveUpgrade(upgrade); - } - else - { - int p = rnd.Next(0, 10); - switch(p) + int r = rnd.Next(0, 100); + if (r == 90) { - case 1: - API.OpenProgram("shiftorium"); - break; - case 2: - API.OpenProgram("ki"); - break; - case 3: - API.CreateInfoboxSession(API.Encryption.Encrypt("Praise Lord Michael"), API.Encryption.Encrypt("You will bow down to me."), infobox.InfoboxMode.Info); - break; - case 4: - API.PlaySound(Properties.Resources._3beepvirus); - break; - case 5: - API.CurrentSession.BackColor = Color.White; - break; - case 6: - API.CurrentSession.BackColor = Color.Black; - break; - case 7: - API.PlaySound(Properties.Resources.dial_up_modem_02); - break; - case 8: - API.PlaySound(Properties.Resources.writesound); - break; - case 9: - API.PlaySound(Properties.Resources.typesound); - break; + t.Stop(); + API.CreateInfoboxSession("Hack complete.", "The hack has been completed.", infobox.InfoboxMode.Info); + GiveUpgrade(upgrade); } - } - }; - t.Start(); + else + { + int p = rnd.Next(0, 10); + switch (p) + { + case 1: + API.OpenProgram("shiftorium"); + break; + case 2: + API.OpenProgram("ki"); + break; + case 3: + API.CreateInfoboxSession(API.Encryption.Encrypt("Praise Lord Michael"), API.Encryption.Encrypt("You will bow down to me."), infobox.InfoboxMode.Info); + break; + case 4: + API.PlaySound(Properties.Resources._3beepvirus); + break; + case 5: + API.CurrentSession.BackColor = Color.White; + break; + case 6: + API.CurrentSession.BackColor = Color.Black; + break; + case 7: + API.PlaySound(Properties.Resources.dial_up_modem_02); + break; + case 8: + API.PlaySound(Properties.Resources.writesound); + break; + case 9: + API.PlaySound(Properties.Resources.typesound); + break; + } + } + }; + t.Start(); - - break; + + break; + } } } } diff --git a/source/WindowsFormsApplication1/Resources/Credits.txt b/source/WindowsFormsApplication1/Resources/Credits.txt index 9961fa3..8ddd3d0 100644 --- a/source/WindowsFormsApplication1/Resources/Credits.txt +++ b/source/WindowsFormsApplication1/Resources/Credits.txt @@ -1,18 +1,11 @@ ShiftOS #VER# +== Developers == +Philip Adams +Michael VanOverbeek +Carver (www.harri.cf) - -A game by Michael VanOverbeek - - - - - - - - - - == External Libraries / Dependencies == +== External Libraries / Dependencies == JSON.NET - Version 8.0.2 By James Newton-King