MADE EVERY DAMN COMMAND A FUNCTION. FINALY I DID IT!

This commit is contained in:
carverh 2016-07-21 13:56:50 -07:00
parent 852aba27c0
commit da7cfe03b7

View file

@ -1463,6 +1463,152 @@ public void cmd_close(String[] args)
} }
} }
public void cmd_05tray(String[] args)
{
if (API.DeveloperMode == true)
{
API.AddCodepoints(500);
WriteLine("You've been granted 500 Codepoints.");
}
else
{
wrongcommand();
}
}
public void cmd_debug(String[] args)
{
if (API.DeveloperMode == true)
{
try
{
switch (args[1].ToLower())
{
case "shiftnet-story":
WriteLine("Debugging Shiftnet Story...");
StartShiftnetStory();
break;
case "devmode":
API.DeveloperMode = false;
WriteLine("Turned off developer mode. Use the passcode to turn it back on.");
break;
default:
WriteLine("Invalid argument: " + args[1] + ". Debug can only debug the following: 'shiftnet-story'.");
break;
}
}
catch (Exception ex)
{
WriteLine("debug: " + ex.Message);
}
}
else
{
try
{
switch (args[1].ToLower())
{
case "developers123":
WriteLine("Turned Developer Mode on!");
API.DeveloperMode = true;
break;
default:
WriteLine("debug: lp0 is on fire"); // Keeps Cheaters from Flooding The Fourms With "The Debug Mode Doesn't Work"
break;
}
}
catch
{
WriteLine("debug: lp0 is on fire"); // Keeps Cheaters from Flooding The Fourms With "The Debug Mode Doesn't Work"
}
}
}
public void cmd_echo(String[] args)
{
if (command.Contains("echo "))
{
WriteLine(command.Replace("echo ", ""));
}
else
{
WriteLine("echo: Insufficient Parameters.");
}
}
public void cmd_default(String[] args)
{
if (API.OpenProgram(args[0]) == false)
{
if (API.Upgrades["trmfiles"] == false)
{
bool done = false;
foreach (KeyValuePair<string, string> kv in API.CommandAliases)
{
if (kv.Key == command)
{
command = kv.Value;
done = true;
DoCommand();
}
}
if (done == false)
{
wrongcommand();
}
}
else
{
var f = command.Replace("\\", "/");
if (f.StartsWith("/"))
{
var withoutslash = f.Remove(0, 1);
var dirsep = OSInfo.DirectorySeparator;
var proper = $"{Paths.SaveRoot}{dirsep}{withoutslash.Replace("/", dirsep)}";
if (File.Exists(proper))
{
runterminalfile(proper);
}
else
{
wrongcommand();
}
}
else
{
bool done = false;
foreach (KeyValuePair<string, string> kv in API.CommandAliases)
{
if (kv.Key == command)
{
command = kv.Value;
done = true;
DoCommand();
}
}
if (done == false)
{
wrongcommand();
}
}
}
}
}
// HISTACOM REFERENCES, DO NOT REMOVE, CRUCIAL FOR SECRET STORY ARC
public void cmd_histacom_year(String[] args)
{
WriteLine("Year: 2002");
}
public void cmd_histacom_timedistorter(String[] args)
{
WriteLine("Install 'timedistorter' by going to shiftnet://12padams");
}
public void DoCommand() public void DoCommand()
{ {
API.LastRanCommand = command; API.LastRanCommand = command;
@ -1573,134 +1719,22 @@ public void DoCommand()
cmd_close(args); cmd_close(args);
break; break;
case "05tray": case "05tray":
cmd_05tray cmd_05tray(args);
break; break;
case "debug": case "debug":
if (API.DeveloperMode == true) cmd_debug(args);
{
try
{
switch (args[1].ToLower())
{
case "shiftnet-story":
WriteLine("Debugging Shiftnet Story...");
StartShiftnetStory();
break;
case "devmode":
API.DeveloperMode = false;
WriteLine("Turned off developer mode. Use the passcode to turn it back on.");
break;
default:
WriteLine("Invalid argument: " + args[1] + ". Debug can only debug the following: 'shiftnet-story'.");
break;
}
}
catch (Exception ex)
{
WriteLine("debug: " + ex.Message);
}
}
else
{
try
{
switch (args[1].ToLower())
{
case "developers123":
WriteLine("Turned Developer Mode on!");
API.DeveloperMode = true;
break;
default:
wrongcommand();
break;
}
}
catch
{
wrongcommand(); //Debug command pretends to be an invalid command if an exception is thrown.
}
}
break; break;
case "echo": case "echo":
if (command.Contains("echo ")) cmd_echo(args);
{
WriteLine(command.Replace("echo ", ""));
}
else
{
WriteLine("echo: Insufficient Parameters.");
}
break;
case "syncsave":
WriteLine("Command removed.");
break; break;
case "year": case "year":
WriteLine("Year: 2002"); // Histacom Reference cmd_histacom_year(args);
break; break;
case "timedistorter": case "timedistorter":
WriteLine("Install 'timedistorter' by going to shiftnet://12padams"); // Histacom Reference cmd_histacom_timedistorter(args);
break; break;
default: default:
if (API.OpenProgram(args[0]) == false) cmd_default(args);
{
if (API.Upgrades["trmfiles"] == false)
{
bool done = false;
foreach (KeyValuePair<string, string> kv in API.CommandAliases)
{
if (kv.Key == command)
{
command = kv.Value;
done = true;
DoCommand();
}
}
if (done == false)
{
wrongcommand();
}
}
else
{
var f = command.Replace("\\", "/");
if (f.StartsWith("/"))
{
var withoutslash = f.Remove(0, 1);
var dirsep = OSInfo.DirectorySeparator;
var proper = $"{Paths.SaveRoot}{dirsep}{withoutslash.Replace("/", dirsep)}";
if (File.Exists(proper))
{
runterminalfile(proper);
}
else
{
wrongcommand();
}
}
else
{
bool done = false;
foreach (KeyValuePair<string, string> kv in API.CommandAliases)
{
if (kv.Key == command)
{
command = kv.Value;
done = true;
DoCommand();
}
}
if (done == false)
{
wrongcommand();
}
}
}
}
break; break;
} }
} }