This commit is contained in:
carverh 2016-07-21 13:43:08 -07:00
parent 81a2cdc582
commit 852aba27c0

View file

@ -623,14 +623,8 @@ public string GetParent(string path)
} }
} }
public void DoCommand() public void cmd_dir(String[] args)
{ {
API.LastRanCommand = command;
string[] args = command.ToLower().Split(' ');
switch (args[0])
{
case "ls":
case "dir":
if (API.Upgrades["fileskimmer"]) if (API.Upgrades["fileskimmer"])
{ {
foreach (var d in Directory.GetDirectories(current_dir)) foreach (var d in Directory.GetDirectories(current_dir))
@ -646,8 +640,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "cd":
public void cmd_cd(String[] args)
{
if (API.Upgrades["fileskimmer"]) if (API.Upgrades["fileskimmer"])
{ {
if (args[1] == "..") if (args[1] == "..")
@ -674,8 +670,10 @@ public void DoCommand()
SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> "); SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> ");
} }
} }
break; }
case "upg":
public void cmd_upg(String[] args)
{
if (API.DeveloperMode) if (API.DeveloperMode)
{ {
try try
@ -696,8 +694,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "endgame_test":
public void cmd_endgame_test(String[] args)
{
if (API.DeveloperMode) if (API.DeveloperMode)
{ {
try try
@ -725,11 +725,15 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "htutorial":
public void cmd_htutorial(String[] args)
{
ShiftOS.Hacking.StartBattleTutorial(); ShiftOS.Hacking.StartBattleTutorial();
break; }
case "fake_buy":
public void cmd_fake_buy(String[] args)
{
if (API.DeveloperMode) if (API.DeveloperMode)
{ {
try try
@ -756,8 +760,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "connections":
public void cmd_connections(String[] args)
{
try try
{ {
switch (args[1]) switch (args[1])
@ -806,8 +812,10 @@ public void DoCommand()
{ {
WriteLine("connections: Missing arguments."); WriteLine("connections: Missing arguments.");
} }
break; }
case "story":
public void cmd_story(String[] args)
{
if (API.DeveloperMode == true && API.Upgrades["shiftnet"]) if (API.DeveloperMode == true && API.Upgrades["shiftnet"])
{ {
try try
@ -837,8 +845,10 @@ public void DoCommand()
} }
} }
else { wrongcommand(); } else { wrongcommand(); }
break; }
case "make":
public void cmd_make(String[] args)
{
try try
{ {
string path = command.Replace("make ", ""); string path = command.Replace("make ", "");
@ -857,8 +867,10 @@ public void DoCommand()
{ {
WriteLine("make: Invalid arguments."); WriteLine("make: Invalid arguments.");
} }
break; }
case "devupg":
public void cmd_devupg(String[] args)
{
if (API.DeveloperMode) if (API.DeveloperMode)
{ {
WriteLine("Upgrading your system..."); WriteLine("Upgrading your system...");
@ -874,8 +886,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "cheat":
public void cmd_cheat(String[] args)
{
if (API.DeveloperMode) if (API.DeveloperMode)
{ {
WriteLine("Opening..."); WriteLine("Opening...");
@ -888,12 +902,16 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "netgen":
public void cmd_netgen(String[] args)
{
WriteLine("Starting netgen..."); WriteLine("Starting netgen...");
API.CreateForm(new NetGen(), "Network Generator", API.GetIcon("Terminal")); API.CreateForm(new NetGen(), "Network Generator", API.GetIcon("Terminal"));
break; }
case "lua":
public void cmd_lua(String[] args)
{
if (API.DeveloperMode == true) if (API.DeveloperMode == true)
{ {
try try
@ -935,8 +953,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "hack":
public void cmd_hack(String[] args)
{
if (API.Upgrades["hacking"] == true) if (API.Upgrades["hacking"] == true)
{ {
StartHackingSession("random"); StartHackingSession("random");
@ -945,9 +965,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "virusscanner":
case "vscan": public void cmd_vscan(String[] args)
{
if (API.Upgrades["virusscanner"] == true) if (API.Upgrades["virusscanner"] == true)
{ {
WriteLine("Scanning for infected files..."); WriteLine("Scanning for infected files...");
@ -995,8 +1016,10 @@ public void DoCommand()
WriteLine("No infections found. You are safe."); WriteLine("No infections found. You are safe.");
} }
} }
break; }
case "infections":
public void cmd_infections(String[] args)
{
if (API.DeveloperMode == true) if (API.DeveloperMode == true)
{ {
foreach (KeyValuePair<string, string> kv in Viruses.Infections) foreach (KeyValuePair<string, string> kv in Viruses.Infections)
@ -1008,8 +1031,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "binarywater":
public void cmd_binarywater(String[] args)
{
if (API.DeveloperMode) if (API.DeveloperMode)
{ {
ShiftOS.Hacking.AddCharacter(new Character("Philip Adams", "Hello, and welcome to another episode of OSFirstTimer.", 100, 100, 0)); ShiftOS.Hacking.AddCharacter(new Character("Philip Adams", "Hello, and welcome to another episode of OSFirstTimer.", 100, 100, 0));
@ -1020,8 +1045,10 @@ public void DoCommand()
{ {
WriteLine("I see you went in the ShiftOS source code... ummm yeah... this isn't a developer mode release so I can't just give you a full-skilled hacker even if you beg."); WriteLine("I see you went in the ShiftOS source code... ummm yeah... this isn't a developer mode release so I can't just give you a full-skilled hacker even if you beg.");
} }
break; }
case "color":
public void cmd_color(String[] args)
{
try try
{ {
if (API.Upgrades["setterminalcolors"] == true) if (API.Upgrades["setterminalcolors"] == true)
@ -1038,8 +1065,10 @@ public void DoCommand()
{ {
WriteLine("color: Missing arguments."); WriteLine("color: Missing arguments.");
} }
break; }
case "encrypt":
public void cmd_encrypt(String[] args)
{
if (API.DeveloperMode == true) if (API.DeveloperMode == true)
{ {
string messageToEncrypt = command.Replace("encrypt ", ""); string messageToEncrypt = command.Replace("encrypt ", "");
@ -1050,8 +1079,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "font":
public void cmd_font(String[] args)
{
if (API.Upgrades["setterminalfont"] == true) if (API.Upgrades["setterminalfont"] == true)
{ {
var fname = command.Replace("font ", ""); var fname = command.Replace("font ", "");
@ -1068,8 +1099,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "colorlist":
public void cmd_colorlist(String[] args)
{
if (API.Upgrades["setterminalcolors"] == true) if (API.Upgrades["setterminalcolors"] == true)
{ {
foreach (string itm in GetColorList()) foreach (string itm in GetColorList())
@ -1081,8 +1114,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "spkg":
public void cmd_spkg(String[] args)
{
if (!API.LimitedMode) if (!API.LimitedMode)
{ {
if (API.Upgrades["shiftnet"] == true) if (API.Upgrades["shiftnet"] == true)
@ -1197,8 +1232,10 @@ public void DoCommand()
WriteLine("spkg: Missing arguments."); WriteLine("spkg: Missing arguments.");
} }
} }
break; }
case "alias":
public void cmd_alias(String[] args)
{
try try
{ {
switch (args[1]) switch (args[1])
@ -1254,8 +1291,10 @@ public void DoCommand()
{ {
WriteLine("alias: Missing arguments. Try alias --help for help with the Alias command."); WriteLine("alias: Missing arguments. Try alias --help for help with the Alias command.");
} }
break; }
case "username":
public void cmd_username(String[] args)
{
if (API.Upgrades["customusername"] == true) if (API.Upgrades["customusername"] == true)
{ {
try try
@ -1271,8 +1310,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "osname":
public void cmd_osname(String[] args)
{
if (API.Upgrades["customusername"] == true) if (API.Upgrades["customusername"] == true)
{ {
try try
@ -1288,9 +1329,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "unity": public void cmd_unity(String[] args)
{
if (API.Upgrades["unitymode"] == true) if (API.Upgrades["unitymode"] == true)
{ {
API.CurrentSession.SetUnityMode(); API.CurrentSession.SetUnityMode();
@ -1301,8 +1343,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "time":
public void cmd_time(String[] args)
{
if (API.Upgrades["pmandam"] == false) if (API.Upgrades["pmandam"] == false)
{ {
if (API.Upgrades["hourssincemidnight"] == false) if (API.Upgrades["hourssincemidnight"] == false)
@ -1332,8 +1376,10 @@ public void DoCommand()
{ {
WriteLine("Current time: " + API.GetTime()); WriteLine("Current time: " + API.GetTime());
} }
break; }
case "saa":
public void cmd_saa(String[] args)
{
if (API.Upgrades["shiftnet"]) if (API.Upgrades["shiftnet"])
{ {
var f = command.Replace("saa ", ""); var f = command.Replace("saa ", "");
@ -1368,8 +1414,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "help":
public void cmd_help(String[] args)
{
try try
{ {
showhelp(args[1]); showhelp(args[1]);
@ -1378,18 +1426,25 @@ public void DoCommand()
{ {
showhelp(); showhelp();
} }
break; }
case "codepoints":
case "cp": public void cmd_cp(String[] args)
{
WriteLine("You have " + API.Codepoints.ToString() + " Codepoints."); WriteLine("You have " + API.Codepoints.ToString() + " Codepoints.");
break; }
case "shutdown":
public void cmd_shutdown(String[] args)
{
API.ShutDownShiftOS(); API.ShutDownShiftOS();
break; }
case "clear":
public void cmd_clear(String[] args)
{
txtterm.Text = ""; txtterm.Text = "";
break; }
case "close":
public void cmd_close(String[] args)
{
if (command.Contains("close ")) if (command.Contains("close "))
{ {
var pid = command.Replace("close ", ""); var pid = command.Replace("close ", "");
@ -1406,17 +1461,119 @@ public void DoCommand()
{ {
WriteLine("Insufficient arguments."); WriteLine("Insufficient arguments.");
} }
}
public void DoCommand()
{
API.LastRanCommand = command;
string[] args = command.ToLower().Split(' ');
switch (args[0])
{
case "ls":
case "dir":
cmd_dir(args);
break;
case "cd":
cmd_cd(args);
break;
case "upg":
cmd_upg(args);
break;
case "endgame_test":
cmd_endgame_test(args);
break;
case "htutorial":
cmd_htutorial(args);
break;
case "fake_buy":
cmd_fake_buy(args);
break;
case "connections":
cmd_connections(args);
break;
case "story":
cmd_story(args);
break;
case "make":
cmd_make(args);
break;
case "devupg":
cmd_devupg(args);
break;
case "cheat":
cmd_cheat(args);
break;
case "netgen":
cmd_netgen(args);
break;
case "lua":
cmd_lua(args);
break;
case "hack":
cmd_hack(args);
break;
case "virusscanner":
case "vscan":
case "antivirus":
cmd_vscan(args);
break;
case "infections":
cmd_infections(args);
break;
case "binarywater":
cmd_binarywater(args);
break;
case "color":
cmd_color(args);
break;
case "encrypt":
cmd_encrypt(args);
break;
case "font":
cmd_font(args);
break;
case "colorlist":
cmd_colorlist(args);
break;
case "spkg":
cmd_spkg(args);
break;
case "alias":
cmd_alias(args);
break;
case "username":
cmd_username(args);
break;
case "osname":
cmd_osname(args);
break;
case "unity":
cmd_unity(args);
break;
case "time":
cmd_time(args);
break;
case "saa":
cmd_saa(args);
break;
case "help":
cmd_help(args);
break;
case "codepoints":
case "cp":
cmd_cp(args);
break;
case "shutdown":
cmd_shutdown(args);
break;
case "clear":
cmd_clear(args);
break;
case "close":
cmd_close(args);
break; break;
case "05tray": case "05tray":
if (API.DeveloperMode == true) cmd_05tray
{
API.AddCodepoints(500);
WriteLine("You've been granted 500 Codepoints.");
}
else
{
wrongcommand();
}
break; break;
case "debug": case "debug":