diff options
| author | carverh <[email protected]> | 2016-07-21 13:43:08 -0700 |
|---|---|---|
| committer | carverh <[email protected]> | 2016-07-21 13:43:08 -0700 |
| commit | 852aba27c091b7da3e9c7156ac05146098d9d0ec (patch) | |
| tree | 01e6ce7ee5e0fa8ca31dcc17e71d6d5e98f45a20 | |
| parent | 81a2cdc582817fc6575ac6096c3d795e1f1831ca (diff) | |
| download | shiftos-c-_theultimatehacker-852aba27c091b7da3e9c7156ac05146098d9d0ec.tar.gz shiftos-c-_theultimatehacker-852aba27c091b7da3e9c7156ac05146098d9d0ec.tar.bz2 shiftos-c-_theultimatehacker-852aba27c091b7da3e9c7156ac05146098d9d0ec.zip | |
part1
| -rw-r--r-- | source/WindowsFormsApplication1/Apps/Terminal.cs | 1485 |
1 files changed, 821 insertions, 664 deletions
diff --git a/source/WindowsFormsApplication1/Apps/Terminal.cs b/source/WindowsFormsApplication1/Apps/Terminal.cs index 38f91f1..3e3c0d0 100644 --- a/source/WindowsFormsApplication1/Apps/Terminal.cs +++ b/source/WindowsFormsApplication1/Apps/Terminal.cs @@ -623,800 +623,957 @@ namespace ShiftOS } } - public void DoCommand() + public void cmd_dir(String[] args) { - API.LastRanCommand = command; - string[] args = command.ToLower().Split(' '); - switch (args[0]) + if (API.Upgrades["fileskimmer"]) { - case "ls": - case "dir": - if (API.Upgrades["fileskimmer"]) + foreach (var d in Directory.GetDirectories(current_dir)) + { + WriteLine($"[DIR] {new DirectoryInfo(d).Name}"); + } + foreach (var d in Directory.GetFiles(current_dir)) + { + WriteLine($"{new FileInfo(d).Name}"); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_cd(String[] args) + { + if (API.Upgrades["fileskimmer"]) + { + if (args[1] == "..") + { + if (GetPath(current_dir) != "/") { - foreach (var d in Directory.GetDirectories(current_dir)) - { - WriteLine($"[DIR] {new DirectoryInfo(d).Name}"); - } - foreach (var d in Directory.GetFiles(current_dir)) - { - WriteLine($"{new FileInfo(d).Name}"); - } + current_dir = GetParent(current_dir); + SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> "); } else { - wrongcommand(); + WriteLine("cd: Can't go up past the root."); } - break; - case "cd": - if (API.Upgrades["fileskimmer"]) + } + else + { + string newdir = current_dir + OSInfo.DirectorySeparator; + foreach (var dir in Directory.GetDirectories(current_dir)) { - if (args[1] == "..") - { - if (GetPath(current_dir) != "/") - { - current_dir = GetParent(current_dir); - SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> "); - } - else - { - WriteLine("cd: Can't go up past the root."); - } - } - else - { - string newdir = current_dir + OSInfo.DirectorySeparator; - foreach (var dir in Directory.GetDirectories(current_dir)) - { - if (new DirectoryInfo(dir).Name.ToLower() == args[1]) - newdir = dir; - } - current_dir = newdir; - SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> "); - } + if (new DirectoryInfo(dir).Name.ToLower() == args[1]) + newdir = dir; } - break; - case "upg": - if (API.DeveloperMode) - { - try - { - switch (args[1]) - { - case "get": - WriteLine(API.Upgrades[args[2]].ToString()); - break; - } - } - catch - { + current_dir = newdir; + SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> "); + } + } + } - } - } - else - { - wrongcommand(); - } - break; - case "endgame_test": - if (API.DeveloperMode) + public void cmd_upg(String[] args) + { + if (API.DeveloperMode) + { + try + { + switch (args[1]) { - try - { - switch (args[1]) - { - case "choice_screen": - var cscreen = new ShiftOS.FinalMission.ChooseYourApproach(); - cscreen.WindowState = FormWindowState.Maximized; - //cscreen.TopMost = true; - cscreen.Show(); - break; - case "limitedmode": - API.LimitedMode = !API.LimitedMode; - WriteLine($"Limited mode set to {API.LimitedMode}."); - break; - } - } - catch - { - WriteLine("Invalid arguments."); - } + case "get": + WriteLine(API.Upgrades[args[2]].ToString()); + break; } - else + } + catch + { + + } + } + else + { + wrongcommand(); + } + } + + public void cmd_endgame_test(String[] args) + { + if (API.DeveloperMode) + { + try + { + switch (args[1]) { - wrongcommand(); + case "choice_screen": + var cscreen = new ShiftOS.FinalMission.ChooseYourApproach(); + cscreen.WindowState = FormWindowState.Maximized; + //cscreen.TopMost = true; + cscreen.Show(); + break; + case "limitedmode": + API.LimitedMode = !API.LimitedMode; + WriteLine($"Limited mode set to {API.LimitedMode}."); + break; } - break; - case "htutorial": - ShiftOS.Hacking.StartBattleTutorial(); - break; - case "fake_buy": - if (API.DeveloperMode) + } + catch + { + WriteLine("Invalid arguments."); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_htutorial(String[] args) + { + ShiftOS.Hacking.StartBattleTutorial(); + } + + public void cmd_fake_buy(String[] args) + { + if (API.DeveloperMode) + { + try + { + if (API.Upgrades.ContainsKey(args[1])) { - try - { - if (API.Upgrades.ContainsKey(args[1])) - { - API.Upgrades[args[1]] = true; - WriteLine($"Bought upgrade {args[1]}."); - API.CurrentSession.SetupAppLauncher(); - API.UpdateWindows(); - SaveSystem.Utilities.saveGame(); - } - else - { - WriteLine("Upgrade not found."); - } - } - catch - { - WriteLine("fake_buy: Bad arguments."); - } + API.Upgrades[args[1]] = true; + WriteLine($"Bought upgrade {args[1]}."); + API.CurrentSession.SetupAppLauncher(); + API.UpdateWindows(); + SaveSystem.Utilities.saveGame(); } else { - wrongcommand(); - } - break; - case "connections": - try - { - switch (args[1]) - { - case "list": - foreach (var client in Package_Grabber.clients) - { - WriteLine($"Hostname: {client.Key}, Port: {client.Value.RemotePort}, Online: {client.Value.IsConnected}"); - } - break; - case "gui": - API.CreateForm(new ConnectionManager(), "Connections", API.GetIcon("Connections")); - break; - case "drop": - foreach (var client in Package_Grabber.clients) - { - Package_Grabber.Disconnect(client.Key); - } - break; - case "add": - string host = args[2]; - int port = 0; - int.TryParse(args[3], out port); - if (!Package_Grabber.clients.ContainsKey(host)) - { - Package_Grabber.ConnectToServer(host, port); - WriteLine("Connection to host established successfully."); - } - else - { - var c = Package_Grabber.clients[host]; - if (c.IsConnected == false) - { - c.Connect(host, port); - WriteLine("Re-established connection with host."); - } - else - { - WriteLine("This host has been connected to already."); - } - } - break; - } - } - catch - { - WriteLine("connections: Missing arguments."); + WriteLine("Upgrade not found."); } - break; - case "story": - if (API.DeveloperMode == true && API.Upgrades["shiftnet"]) - { - try + } + catch + { + WriteLine("fake_buy: Bad arguments."); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_connections(String[] args) + { + try + { + switch (args[1]) + { + case "list": + foreach (var client in Package_Grabber.clients) { - switch (args[1]) - { - case "aidennirh": - StartAidenNirhStory(); - break; - case "devxfurious": - StartDevXFuriousStory(); - break; - case "battletut": - StartHackerBattleIntro(); - break; - case "otherplayer": - StartDevXFuriousStory(); - break; - case "hacker101": - StartHacker101Story(); - break; - } + WriteLine($"Hostname: {client.Key}, Port: {client.Value.RemotePort}, Online: {client.Value.IsConnected}"); } - catch + break; + case "gui": + API.CreateForm(new ConnectionManager(), "Connections", API.GetIcon("Connections")); + break; + case "drop": + foreach (var client in Package_Grabber.clients) { - WriteLine("Missing arguments."); + Package_Grabber.Disconnect(client.Key); } - } - else { wrongcommand(); } - break; - case "make": - try - { - string path = command.Replace("make ", ""); - string realpath = $"{Paths.SaveRoot}{path.Replace("/", OSInfo.DirectorySeparator)}"; - if (File.Exists(realpath + OSInfo.DirectorySeparator + "main.lua")) + break; + case "add": + string host = args[2]; + int port = 0; + int.TryParse(args[3], out port); + if (!Package_Grabber.clients.ContainsKey(host)) { - WriteLine("Compiling to " + path + ".saa"); - ZipFile.CreateFromDirectory(realpath, realpath + ".saa"); + Package_Grabber.ConnectToServer(host, port); + WriteLine("Connection to host established successfully."); } else { - WriteLine($"make: *** No rule to make target \"{realpath}\". Stop."); - } - } - catch - { - WriteLine("make: Invalid arguments."); - } - break; - case "devupg": - if (API.DeveloperMode) - { - WriteLine("Upgrading your system..."); - foreach (var upg in Shiftorium.Utilities.GetAvailable()) - { - API.Upgrades[upg.id] = true; - WriteLine("Installed upgrade \"" + upg.Name + "\"..."); - } - API.UpdateWindows(); - API.CurrentSession.SetupDesktop(); - } - else - { - wrongcommand(); - } - break; - case "cheat": - if (API.DeveloperMode) - { - WriteLine("Opening..."); - - //Apps.Cheats chts = new Apps.Cheats(); - //chts.Show(); - API.CreateForm(new Apps.Cheats(), "Cheats", API.GetIcon("Terminal")); - } - else - { - wrongcommand(); - } - break; - case "netgen": - WriteLine("Starting netgen..."); - API.CreateForm(new NetGen(), "Network Generator", API.GetIcon("Terminal")); - break; - case "lua": - if (API.DeveloperMode == true) - { - try - { - string f = args[1]; - WriteLine(f); - f = command.Remove(0, 4); - WriteLine(f); - string real = $"{Paths.SaveRoot}{f.Replace("/", OSInfo.DirectorySeparator)}"; - WriteLine(real); - if (File.Exists(real)) + var c = Package_Grabber.clients[host]; + if (c.IsConnected == false) { - WriteLine("Running Lua script at " + f + "."); - var l = new LuaInterpreter(real); + c.Connect(host, port); + WriteLine("Re-established connection with host."); } else { - WriteLine("Lua script file not found."); + WriteLine("This host has been connected to already."); } } - catch - { - this.LuaMode = true; - this.Interpreter = new LuaInterpreter(); - this.Interpreter.mod.print = new Action<string>((text) => WriteLine(text)); - this.Interpreter.mod.exit = new Action(() => - { - this.LuaMode = false; - this.Interpreter = null; - WriteLine($"{API.CurrentSave.username}@{API.CurrentSave.osname} $> "); - }); - WriteLine("ShiftOS Lua Interpreter - v1.0"); - WriteLine("Created by Michael VanOverbeek"); - WriteLine(Environment.NewLine + "How to use: Simply type some Lua code and watch it come to life. Code can be executed on one line, and unlike most interpreters, you can access code from one line in another."); - WriteLine(Environment.NewLine + "When you're done, simply press the Enter key to execute the code." + Environment.NewLine); - } - } - else + break; + } + } + catch + { + WriteLine("connections: Missing arguments."); + } + } + + public void cmd_story(String[] args) + { + if (API.DeveloperMode == true && API.Upgrades["shiftnet"]) + { + try + { + switch (args[1]) { - wrongcommand(); + case "aidennirh": + StartAidenNirhStory(); + break; + case "devxfurious": + StartDevXFuriousStory(); + break; + case "battletut": + StartHackerBattleIntro(); + break; + case "otherplayer": + StartDevXFuriousStory(); + break; + case "hacker101": + StartHacker101Story(); + break; } - break; - case "hack": - if (API.Upgrades["hacking"] == true) + } + catch + { + WriteLine("Missing arguments."); + } + } + else { wrongcommand(); } + } + + public void cmd_make(String[] args) + { + try + { + string path = command.Replace("make ", ""); + string realpath = $"{Paths.SaveRoot}{path.Replace("/", OSInfo.DirectorySeparator)}"; + if (File.Exists(realpath + OSInfo.DirectorySeparator + "main.lua")) + { + WriteLine("Compiling to " + path + ".saa"); + ZipFile.CreateFromDirectory(realpath, realpath + ".saa"); + } + else + { + WriteLine($"make: *** No rule to make target \"{realpath}\". Stop."); + } + } + catch + { + WriteLine("make: Invalid arguments."); + } + } + + public void cmd_devupg(String[] args) + { + if (API.DeveloperMode) + { + WriteLine("Upgrading your system..."); + foreach (var upg in Shiftorium.Utilities.GetAvailable()) + { + API.Upgrades[upg.id] = true; + WriteLine("Installed upgrade \"" + upg.Name + "\"..."); + } + API.UpdateWindows(); + API.CurrentSession.SetupDesktop(); + } + else + { + wrongcommand(); + } + } + + public void cmd_cheat(String[] args) + { + if (API.DeveloperMode) + { + WriteLine("Opening..."); + + //Apps.Cheats chts = new Apps.Cheats(); + //chts.Show(); + API.CreateForm(new Apps.Cheats(), "Cheats", API.GetIcon("Terminal")); + } + else + { + wrongcommand(); + } + } + + public void cmd_netgen(String[] args) + { + WriteLine("Starting netgen..."); + API.CreateForm(new NetGen(), "Network Generator", API.GetIcon("Terminal")); + } + + public void cmd_lua(String[] args) + { + if (API.DeveloperMode == true) + { + try + { + string f = args[1]; + WriteLine(f); + f = command.Remove(0, 4); + WriteLine(f); + string real = $"{Paths.SaveRoot}{f.Replace("/", OSInfo.DirectorySeparator)}"; + WriteLine(real); + if (File.Exists(real)) { - StartHackingSession("random"); + WriteLine("Running Lua script at " + f + "."); + var l = new LuaInterpreter(real); } else { - wrongcommand(); + WriteLine("Lua script file not found."); } - break; - case "virusscanner": - case "vscan": - if (API.Upgrades["virusscanner"] == true) + } + catch + { + this.LuaMode = true; + this.Interpreter = new LuaInterpreter(); + this.Interpreter.mod.print = new Action<string>((text) => WriteLine(text)); + this.Interpreter.mod.exit = new Action(() => + { + this.LuaMode = false; + this.Interpreter = null; + WriteLine($"{API.CurrentSave.username}@{API.CurrentSave.osname} $> "); + }); + WriteLine("ShiftOS Lua Interpreter - v1.0"); + WriteLine("Created by Michael VanOverbeek"); + WriteLine(Environment.NewLine + "How to use: Simply type some Lua code and watch it come to life. Code can be executed on one line, and unlike most interpreters, you can access code from one line in another."); + WriteLine(Environment.NewLine + "When you're done, simply press the Enter key to execute the code." + Environment.NewLine); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_hack(String[] args) + { + if (API.Upgrades["hacking"] == true) + { + StartHackingSession("random"); + } + else + { + wrongcommand(); + } + } + + public void cmd_vscan(String[] args) + { + if (API.Upgrades["virusscanner"] == true) + { + WriteLine("Scanning for infected files..."); + var goodList = new Dictionary<string, string>(); + foreach (KeyValuePair<string, string> kv in Viruses.Infections) + { + if (kv.Value.Contains(";")) { - WriteLine("Scanning for infected files..."); - var goodList = new Dictionary<string, string>(); - foreach (KeyValuePair<string, string> kv in Viruses.Infections) + foreach (string file in kv.Value.Split(';')) { - if (kv.Value.Contains(";")) + if (goodList.ContainsKey(file)) { - foreach (string file in kv.Value.Split(';')) - { - if (goodList.ContainsKey(file)) - { - goodList[file] += ", " + kv.Key; - } - else - { - goodList.Add(file, kv.Key); - } - } + goodList[file] += ", " + kv.Key; } else { - if (goodList.ContainsKey(kv.Value)) - { - goodList[kv.Value] += ", " + kv.Key; - } - else - { - goodList.Add(kv.Value, kv.Key); - } - } - } - WriteLine("Scan complete."); - if (goodList.Count > 0) - { - foreach (KeyValuePair<string, string> kv in goodList) - { - WriteLine("File " + kv.Key + " is infected with " + kv.Value + ". Disinfecting..."); - Viruses.DisInfect(kv.Key); + goodList.Add(file, kv.Key); } - WriteLine("Disinfection complete."); - } - else - { - WriteLine("No infections found. You are safe."); - } - } - break; - case "infections": - if (API.DeveloperMode == true) - { - foreach (KeyValuePair<string, string> kv in Viruses.Infections) - { - WriteLine(kv.Key + " @ " + kv.Value); - } - } - else - { - wrongcommand(); - } - break; - case "binarywater": - if (API.DeveloperMode) - { - ShiftOS.Hacking.AddCharacter(new Character("Philip Adams", "Hello, and welcome to another episode of OSFirstTimer.", 100, 100, 0)); - WriteLine("Philip Adams is now in the list of hirable hackers."); - WriteLine("\" I Don't Think This is Canon \" -Carver"); - } - else - { - 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": - try - { - if (API.Upgrades["setterminalcolors"] == true) - { - - Color bcol = SetColor(args[1]); - Color tcol = SetColor(args[2]); - API.CurrentSkin.TerminalTextColor = tcol; - API.CurrentSkin.TerminalBackColor = bcol; - } } - catch (Exception) - { - WriteLine("color: Missing arguments."); - } - break; - case "encrypt": - if (API.DeveloperMode == true) - { - string messageToEncrypt = command.Replace("encrypt ", ""); - string encryptedMessage = API.Encryption.Encrypt(messageToEncrypt); - WriteLine("Encrypted Message: " + encryptedMessage); - } else { - wrongcommand(); - } - break; - case "font": - if (API.Upgrades["setterminalfont"] == true) - { - var fname = command.Replace("font ", ""); - if (GetFonts().Contains(fname)) + if (goodList.ContainsKey(kv.Value)) { - API.CurrentSkin.TerminalFontStyle = fname; + goodList[kv.Value] += ", " + kv.Key; } else { - WriteLine("font: Unrecognized font name \"" + fname + "\". Note: Font names are case sensitive."); - } - } - else - { - wrongcommand(); - } - break; - case "colorlist": - if (API.Upgrades["setterminalcolors"] == true) - { - foreach (string itm in GetColorList()) - { - WriteLine(itm); + goodList.Add(kv.Value, kv.Key); } } - else + } + WriteLine("Scan complete."); + if (goodList.Count > 0) + { + foreach (KeyValuePair<string, string> kv in goodList) { - wrongcommand(); + WriteLine("File " + kv.Key + " is infected with " + kv.Value + ". Disinfecting..."); + Viruses.DisInfect(kv.Key); } - break; - case "spkg": - if (!API.LimitedMode) + WriteLine("Disinfection complete."); + } + else + { + WriteLine("No infections found. You are safe."); + } + } + } + + public void cmd_infections(String[] args) + { + if (API.DeveloperMode == true) + { + foreach (KeyValuePair<string, string> kv in Viruses.Infections) + { + WriteLine(kv.Key + " @ " + kv.Value); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_binarywater(String[] args) + { + if (API.DeveloperMode) + { + ShiftOS.Hacking.AddCharacter(new Character("Philip Adams", "Hello, and welcome to another episode of OSFirstTimer.", 100, 100, 0)); + WriteLine("Philip Adams is now in the list of hirable hackers."); + WriteLine("\" I Don't Think This is Canon \" -Carver"); + } + else + { + 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."); + } + } + + public void cmd_color(String[] args) + { + try + { + if (API.Upgrades["setterminalcolors"] == true) + { + + Color bcol = SetColor(args[1]); + Color tcol = SetColor(args[2]); + API.CurrentSkin.TerminalTextColor = tcol; + API.CurrentSkin.TerminalBackColor = bcol; + + } + } + catch (Exception) + { + WriteLine("color: Missing arguments."); + } + } + + public void cmd_encrypt(String[] args) + { + if (API.DeveloperMode == true) + { + string messageToEncrypt = command.Replace("encrypt ", ""); + string encryptedMessage = API.Encryption.Encrypt(messageToEncrypt); + WriteLine("Encrypted Message: " + encryptedMessage); + } + else + { + wrongcommand(); + } + } + + public void cmd_font(String[] args) + { + if (API.Upgrades["setterminalfont"] == true) + { + var fname = command.Replace("font ", ""); + if (GetFonts().Contains(fname)) + { + API.CurrentSkin.TerminalFontStyle = fname; + } + else + { + WriteLine("font: Unrecognized font name \"" + fname + "\". Note: Font names are case sensitive."); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_colorlist(String[] args) + { + if (API.Upgrades["setterminalcolors"] == true) + { + foreach (string itm in GetColorList()) + { + WriteLine(itm); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_spkg(String[] args) + { + if (!API.LimitedMode) + { + if (API.Upgrades["shiftnet"] == true) + { + try { - if (API.Upgrades["shiftnet"] == true) + switch (args[1].ToLower()) { - try - { - switch (args[1].ToLower()) + case "install": + if (args[2] != null && args[2] != "") { - case "install": - if (args[2] != null && args[2] != "") + string pkgname = args[2].ToLower().Replace(".pkg", ""); + if (Package_Grabber.GetPackage(pkgname) == true) + { + WriteLine("Downloaded package '" + pkgname + "' from shiftnet://main/spkg/ successfully. Installing now."); + string r = Package_Grabber.ExtractPackage(); + if (r == "fail") + { + WriteLine("[FATAL] Could not install package."); + WriteLine("spkg: Killed."); + } + else { - string pkgname = args[2].ToLower().Replace(".pkg", ""); - if (Package_Grabber.GetPackage(pkgname) == true) + WriteLine("Extracted " + pkgname + " to " + r + "..."); + var res2 = Package_Grabber.InstallPackage(r + "\\"); + if (res2 != "success") { - WriteLine("Downloaded package '" + pkgname + "' from shiftnet://main/spkg/ successfully. Installing now."); - string r = Package_Grabber.ExtractPackage(); - if (r == "fail") - { - WriteLine("[FATAL] Could not install package."); - WriteLine("spkg: Killed."); - } - else - { - WriteLine("Extracted " + pkgname + " to " + r + "..."); - var res2 = Package_Grabber.InstallPackage(r + "\\"); - if (res2 != "success") - { - WriteLine("[FATAL] Could not install package. " + res2); - WriteLine("spkg: Killed."); - } - else - { - WriteLine("[DONE] Package installed."); - } - } + WriteLine("[FATAL] Could not install package. " + res2); + WriteLine("spkg: Killed."); } else { - WriteLine("spkg: Package '" + args[2] + "' not found."); + WriteLine("[DONE] Package installed."); } } - break; - default: - WriteLine("spkg: Invalid argument: " + args[1]); - break; + } + else + { + WriteLine("spkg: Package '" + args[2] + "' not found."); + } } - } - catch (Exception ex) - { - WriteLine("spkg: " + ex.Message); - } - } - else - { - wrongcommand(); + break; + default: + WriteLine("spkg: Invalid argument: " + args[1]); + break; } } - else + catch (Exception ex) { - try + WriteLine("spkg: " + ex.Message); + } + } + else + { + wrongcommand(); + } + } + else + { + try + { + if (args[2] == "god_utils") + { + if (FinalMission.EndGameHandler.GodModeInstallEnabled == true) { - if (args[2] == "god_utils") + var t = new Thread(new ThreadStart(new Action(() => { - if (FinalMission.EndGameHandler.GodModeInstallEnabled == true) - { - var t = new Thread(new ThreadStart(new Action(() => - { - WriteLine("Downloading package 'god_utils'... Please wait."); - Thread.Sleep(10000); - WriteLine("Download complete."); - Thread.Sleep(100); - WriteLine("Beginning installation."); - Thread.Sleep(1000); - WriteLine(@" == GOD MODE == + WriteLine("Downloading package 'god_utils'... Please wait."); + Thread.Sleep(10000); + WriteLine("Download complete."); + Thread.Sleep(100); + WriteLine("Beginning installation."); + Thread.Sleep(1000); + WriteLine(@" == GOD MODE == God Mode gives you FULL control of ShiftOS. You can add/remove Codepoints, buy or unbuy Shiftorium upgrades, and can do whatever you want. Installing core applications..."); - Thread.Sleep(250); - WriteLine("Installing subpackage 'json_edit'..."); - Thread.Sleep(250); - WriteLine("Installing subpackage 'upgrade_mod'..."); - Thread.Sleep(100); - WriteLine("Installing subpackage 'hijacker'..."); - Thread.Sleep(500); - WriteLine(@" == HIJACKER by DevX == + Thread.Sleep(250); + WriteLine("Installing subpackage 'json_edit'..."); + Thread.Sleep(250); + WriteLine("Installing subpackage 'upgrade_mod'..."); + Thread.Sleep(100); + WriteLine("Installing subpackage 'hijacker'..."); + Thread.Sleep(500); + WriteLine(@" == HIJACKER by DevX == HIJACKER is a utility that allows you to hijack any system and install ShiftOS on it during a hacker battle."); - Thread.Sleep(100); - WriteLine("[hijacker] Injecting HIJACKER code into hbattleui.sft..."); - Thread.Sleep(150); - WriteLine("[hijacker] Done."); - this.Invoke(new Action(() => - { - StartChoice1EndStory(); - })); - }))); - t.Start(); - } - else + Thread.Sleep(100); + WriteLine("[hijacker] Injecting HIJACKER code into hbattleui.sft..."); + Thread.Sleep(150); + WriteLine("[hijacker] Done."); + this.Invoke(new Action(() => { - WriteLine("spkg: Package '" + args[2] + "' not found."); - } - } - else - { - WriteLine("spkg: Package '" + args[2] + "' not found."); - } - } - catch - { - WriteLine("spkg: Missing arguments."); + StartChoice1EndStory(); + })); + }))); + t.Start(); } - } - break; - case "alias": - try - { - switch (args[1]) + else { - case "-?": - case "--help": - WriteLine("Aliases Help" + Environment.NewLine); - WriteLine("Alias is a command that lets you create aliases for other commands. You could make a command 'upgrade' alias 'shiftorium' if you wanted." + Environment.NewLine); - WriteLine("Arguments:"); - WriteLine(" -h, --help: Displays this screen."); - WriteLine("-a, --add <alias> <command>: Adds a new alias."); - WriteLine("-d, --delete <alias>: Deletes an alias."); - WriteLine("-l, --list: Shows all available aliases."); - break; - case "--add": - case "-a": - if (API.AddAlias(args[2], command.Replace("alias " + args[1] + " " + args[2] + " ", ""))) - { - WriteLine("Alias added successfully."); - API.SaveAliases(); - } - else - { - WriteLine("That alias already exists."); - } - break; - case "--delete": - case "-d": - if (API.RemoveAlias(args[2]) == true) - { - WriteLine("Alias \"" + args[2] + "\" removed successfully."); - API.SaveAliases(); - } - else - { - WriteLine("That alias doesn't exist."); - } - break; - case "-l": - case "--list": - WriteLine("Aliases:"); - foreach (KeyValuePair<string, string> kv in API.CommandAliases) - { - WriteLine(kv.Key + " => " + kv.Value); - } - break; - default: - WriteLine("alias: Invalid argument. Try alias --help for help with the Alias command."); - break; + WriteLine("spkg: Package '" + args[2] + "' not found."); } } - catch + else { - WriteLine("alias: Missing arguments. Try alias --help for help with the Alias command."); + WriteLine("spkg: Package '" + args[2] + "' not found."); } - break; - case "username": - if (API.Upgrades["customusername"] == true) - { - try + } + catch + { + WriteLine("spkg: Missing arguments."); + } + } + } + + public void cmd_alias(String[] args) + { + try + { + switch (args[1]) + { + case "-?": + case "--help": + WriteLine("Aliases Help" + Environment.NewLine); + WriteLine("Alias is a command that lets you create aliases for other commands. You could make a command 'upgrade' alias 'shiftorium' if you wanted." + Environment.NewLine); + WriteLine("Arguments:"); + WriteLine(" -h, --help: Displays this screen."); + WriteLine("-a, --add <alias> <command>: Adds a new alias."); + WriteLine("-d, --delete <alias>: Deletes an alias."); + WriteLine("-l, --list: Shows all available aliases."); + break; + case "--add": + case "-a": + if (API.AddAlias(args[2], command.Replace("alias " + args[1] + " " + args[2] + " ", ""))) + { + WriteLine("Alias added successfully."); + API.SaveAliases(); + } + else { - API.CurrentSave.username = args[1]; + WriteLine("That alias already exists."); } - catch + break; + case "--delete": + case "-d": + if (API.RemoveAlias(args[2]) == true) { - WriteLine("username: Missing arguments."); + WriteLine("Alias \"" + args[2] + "\" removed successfully."); + API.SaveAliases(); } - } - else - { - wrongcommand(); - } - break; - case "osname": - if (API.Upgrades["customusername"] == true) - { - try + else { - API.CurrentSave.osname = args[1]; + WriteLine("That alias doesn't exist."); } - catch + break; + case "-l": + case "--list": + WriteLine("Aliases:"); + foreach (KeyValuePair<string, string> kv in API.CommandAliases) { - WriteLine("osname: Missing arguments."); + WriteLine(kv.Key + " => " + kv.Value); } - } - else - { - wrongcommand(); - } - break; + break; + default: + WriteLine("alias: Invalid argument. Try alias --help for help with the Alias command."); + break; + } + } + catch + { + WriteLine("alias: Missing arguments. Try alias --help for help with the Alias command."); + } + } - case "unity": - if (API.Upgrades["unitymode"] == true) - { - API.CurrentSession.SetUnityMode(); - API.CurrentSession.SetupDesktop(); - txtterm.Focus(); - } - else - { - wrongcommand(); - } - break; - case "time": - if (API.Upgrades["pmandam"] == false) + public void cmd_username(String[] args) + { + if (API.Upgrades["customusername"] == true) + { + try + { + API.CurrentSave.username = args[1]; + } + catch + { + WriteLine("username: Missing arguments."); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_osname(String[] args) + { + if (API.Upgrades["customusername"] == true) + { + try + { + API.CurrentSave.osname = args[1]; + } + catch + { + WriteLine("osname: Missing arguments."); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_unity(String[] args) + { + if (API.Upgrades["unitymode"] == true) + { + API.CurrentSession.SetUnityMode(); + API.CurrentSession.SetupDesktop(); + txtterm.Focus(); + } + else + { + wrongcommand(); + } + } + + public void cmd_time(String[] args) + { + if (API.Upgrades["pmandam"] == false) + { + if (API.Upgrades["hourssincemidnight"] == false) + { + if (API.Upgrades["minutessincemidnight"] == false) { - if (API.Upgrades["hourssincemidnight"] == false) + if (API.Upgrades["secondssincemidnight"] == true) { - if (API.Upgrades["minutessincemidnight"] == false) - { - if (API.Upgrades["secondssincemidnight"] == true) - { - WriteLine("Since midnight, " + API.GetTime() + " seconds have passed."); - } - else - { - wrongcommand(); - } - } - else - { - WriteLine("Since midnight, " + API.GetTime() + " minutes have passed."); - } + WriteLine("Since midnight, " + API.GetTime() + " seconds have passed."); } else { - WriteLine("Since Midnight, " + API.GetTime() + " hours have passed."); + wrongcommand(); } } else { - WriteLine("Current time: " + API.GetTime()); + WriteLine("Since midnight, " + API.GetTime() + " minutes have passed."); } - break; - case "saa": - if (API.Upgrades["shiftnet"]) + } + else + { + WriteLine("Since Midnight, " + API.GetTime() + " hours have passed."); + } + } + else + { + WriteLine("Current time: " + API.GetTime()); + } + } + + public void cmd_saa(String[] args) + { + if (API.Upgrades["shiftnet"]) + { + var f = command.Replace("saa ", ""); + if (f.StartsWith("/")) + { + var withoutslash = f.Remove(0, 1); + var dirsep = OSInfo.DirectorySeparator; + var rightdir = $"{Paths.SaveRoot}{dirsep}{f.Replace("/", dirsep)}"; + if (File.Exists(rightdir)) { - var f = command.Replace("saa ", ""); - if (f.StartsWith("/")) + var finf = new FileInfo(rightdir); + if (finf.Extension == ".saa") { - var withoutslash = f.Remove(0, 1); - var dirsep = OSInfo.DirectorySeparator; - var rightdir = $"{Paths.SaveRoot}{dirsep}{f.Replace("/", dirsep)}"; - if (File.Exists(rightdir)) - { - var finf = new FileInfo(rightdir); - if (finf.Extension == ".saa") - { - API.LaunchMod(finf.FullName); - } - else - { - WriteLine("saa: Cannot launch the file '" + finf.FullName + " because it isn't a valid stand-alone app."); - } - } - else - { - WriteLine("saa: Cannot launch the file '" + f + "' because it doesn't exist."); - } + API.LaunchMod(finf.FullName); } else { - WriteLine("saa: Cannot launch the file '" + f + "' because it doesn't exist."); + WriteLine("saa: Cannot launch the file '" + finf.FullName + " because it isn't a valid stand-alone app."); } } else { - wrongcommand(); + WriteLine("saa: Cannot launch the file '" + f + "' because it doesn't exist."); } + } + else + { + WriteLine("saa: Cannot launch the file '" + f + "' because it doesn't exist."); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_help(String[] args) + { + try + { + showhelp(args[1]); + } + catch + { + showhelp(); + } + } + + public void cmd_cp(String[] args) + { + WriteLine("You have " + API.Codepoints.ToString() + " Codepoints."); + } + + public void cmd_shutdown(String[] args) + { + API.ShutDownShiftOS(); + } + + public void cmd_clear(String[] args) + { + txtterm.Text = ""; + } + + public void cmd_close(String[] args) + { + if (command.Contains("close ")) + { + var pid = command.Replace("close ", ""); + if (API.CloseProgram(pid) == true) + { + WriteLine("Closed all running " + pid + "s."); + } + else + { + WriteLine("No processes with id '" + pid + "' were found!"); + } + } + else + { + 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": - try - { - showhelp(args[1]); - } - catch - { - showhelp(); - } + cmd_help(args); break; case "codepoints": case "cp": - WriteLine("You have " + API.Codepoints.ToString() + " Codepoints."); + cmd_cp(args); break; case "shutdown": - API.ShutDownShiftOS(); + cmd_shutdown(args); break; case "clear": - txtterm.Text = ""; + cmd_clear(args); break; case "close": - if (command.Contains("close ")) - { - var pid = command.Replace("close ", ""); - if (API.CloseProgram(pid) == true) - { - WriteLine("Closed all running " + pid + "s."); - } - else - { - WriteLine("No processes with id '" + pid + "' were found!"); - } - } - else - { - WriteLine("Insufficient arguments."); - } + cmd_close(args); break; case "05tray": - if (API.DeveloperMode == true) - { - API.AddCodepoints(500); - WriteLine("You've been granted 500 Codepoints."); - } - else - { - wrongcommand(); - } + cmd_05tray break; case "debug": |
