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

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

View file

@ -373,62 +373,71 @@ 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)
{ {
case "Destabilizer Attack": API.CreateInfoboxSession("Failed!", "No Hacking Tools Avalible!", infobox.InfoboxMode.Info);
var t = new Timer(); return;
t.Interval = 1000 / h.Effectiveness; }
var rnd = new Random(); else
t.Tick += (object s, EventArgs a) => {
{ HackTool h = Tools[cid];
int r = rnd.Next(0, 100); switch (h.Name)
if(r == 90) {
case "Destabilizer Attack":
var t = new Timer();
t.Interval = 1000 / h.Effectiveness;
var rnd = new Random();
t.Tick += (object s, EventArgs a) =>
{ {
t.Stop(); int r = rnd.Next(0, 100);
API.CreateInfoboxSession("Hack complete.", "The hack has been completed.", infobox.InfoboxMode.Info); if (r == 90)
GiveUpgrade(upgrade);
}
else
{
int p = rnd.Next(0, 10);
switch(p)
{ {
case 1: t.Stop();
API.OpenProgram("shiftorium"); API.CreateInfoboxSession("Hack complete.", "The hack has been completed.", infobox.InfoboxMode.Info);
break; GiveUpgrade(upgrade);
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;
} }
} else
}; {
t.Start(); 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;
}
} }
} }
} }

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