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
This commit is contained in:
carverh 2016-07-20 20:47:35 -07:00
parent 4fe0de40aa
commit 2747ec98b7
3 changed files with 74 additions and 65 deletions

View file

@ -1377,10 +1377,17 @@ public string GetPath(string path)
} }
public string GetParent(string path) public string GetParent(string path)
{
if (new DirectoryInfo(path).Parent.FullName.Contains("ShiftOS"))
{ {
var d = new DirectoryInfo(path); var d = new DirectoryInfo(path);
return d.Parent.FullName; return d.Parent.FullName;
} }
else
{
return path;
}
}
public void DoCommand() public void DoCommand()
{ {

View file

@ -373,9 +373,17 @@ public static void StartHack(int cid, string upgrade)
{ {
StartHack(cid, GetRandomHack()); StartHack(cid, GetRandomHack());
} }
else { else
var h = Tools[cid]; {
switch(h.Name) if (Tools.Count <= cid)
{
API.CreateInfoboxSession("Failed!", "No Hacking Tools Avalible!", infobox.InfoboxMode.Info);
return;
}
else
{
HackTool h = Tools[cid];
switch (h.Name)
{ {
case "Destabilizer Attack": case "Destabilizer Attack":
var t = new Timer(); var t = new Timer();
@ -384,7 +392,7 @@ public static void StartHack(int cid, string upgrade)
t.Tick += (object s, EventArgs a) => t.Tick += (object s, EventArgs a) =>
{ {
int r = rnd.Next(0, 100); int r = rnd.Next(0, 100);
if(r == 90) if (r == 90)
{ {
t.Stop(); t.Stop();
API.CreateInfoboxSession("Hack complete.", "The hack has been completed.", infobox.InfoboxMode.Info); API.CreateInfoboxSession("Hack complete.", "The hack has been completed.", infobox.InfoboxMode.Info);
@ -393,7 +401,7 @@ public static void StartHack(int cid, string upgrade)
else else
{ {
int p = rnd.Next(0, 10); int p = rnd.Next(0, 10);
switch(p) switch (p)
{ {
case 1: case 1:
API.OpenProgram("shiftorium"); API.OpenProgram("shiftorium");
@ -432,6 +440,7 @@ public static void StartHack(int cid, string upgrade)
} }
} }
} }
}
/// <summary> /// <summary>
/// Initiates the Hacker Battle training simulation. /// Initiates the Hacker Battle training simulation.

View file

@ -1,18 +1,11 @@
ShiftOS #VER# ShiftOS #VER#
== Developers ==
Philip Adams
Michael VanOverbeek
Carver (www.harri.cf)
== External Libraries / Dependencies ==
A game by Michael VanOverbeek
== External Libraries / Dependencies ==
JSON.NET - Version 8.0.2 JSON.NET - Version 8.0.2
By James Newton-King By James Newton-King