diff --git a/source/WindowsFormsApplication1/PanelManager.cs b/source/WindowsFormsApplication1/PanelManager.cs index 9e5327a..d347fb5 100644 --- a/source/WindowsFormsApplication1/PanelManager.cs +++ b/source/WindowsFormsApplication1/PanelManager.cs @@ -30,6 +30,7 @@ private void setbgcolor(object sender, MouseEventArgs e) var c = API.GetLastColorFromSession(); pnl.BackgroundColor = c; pnl.BackgroundImage = null; + pnl.ImagePath = null; }; } else if(e.Button == MouseButtons.Right) diff --git a/source/WindowsFormsApplication1/Resources/NetBrowser_Enemies.txt b/source/WindowsFormsApplication1/Resources/NetBrowser_Enemies.txt index 9190dc6..950d6b7 100644 --- a/source/WindowsFormsApplication1/Resources/NetBrowser_Enemies.txt +++ b/source/WindowsFormsApplication1/Resources/NetBrowser_Enemies.txt @@ -1,5 +1,6 @@ { "BufferOverflow":{"IsLeader":false,"Name":"BufferOverflow","FriendDesc":"BufferOverflow is a question-and-answer site with millions of Shifters willing to share their knowledge.","Description":"BufferOverflow is a question-and-answer site with millions of Shifters willing to share their knowledge.","FriendSpeed":0,"FriendSkill":0,"Difficulty":"easy","Network":[{"Hostname":"bufferoverflow","ModuleType":0,"Type":0,"HP":100,"Grade":1,"X":0,"Y":0},{"Hostname":"main_av","ModuleType":0,"Type":1,"HP":0,"Grade":4,"X":371,"Y":148},{"Hostname":"defense1","ModuleType":0,"Type":3,"HP":0,"Grade":4,"X":252,"Y":121},{"Hostname":"defense2","ModuleType":0,"Type":3,"HP":0,"Grade":4,"X":251,"Y":163}]}, "Exodus Software":{"IsLeader":false,"Name":"Exodus Software","FriendDesc":"Known for their ShiftOS desktop environment \"Exodus Desktop Environment\", Exodus Software is well-known among the ShiftOS user-base. Now they're trying to dig their hands into hacker battles.","Description":"Known for their ShiftOS desktop environment \"Exodus Desktop Environment\", Exodus Software is well-known among the ShiftOS user-base. Now they're trying to dig their hands into hacker battles.","FriendSpeed":75,"FriendSkill":45,"Difficulty":"easy","Network":[{"Hostname":"exodus_software","ModuleType":0,"Type":0,"HP":100,"Grade":1,"X":0,"Y":0},{"Hostname":"exds_turret1","ModuleType":0,"Type":3,"HP":0,"Grade":4,"X":500,"Y":215},{"Hostname":"exds_antimalware","ModuleType":0,"Type":1,"HP":0,"Grade":1,"X":500,"Y":259},{"Hostname":"exds_antimalware2","ModuleType":0,"Type":1,"HP":0,"Grade":1,"X":498,"Y":162},{"Hostname":"exds_repairman","ModuleType":0,"Type":9,"HP":0,"Grade":2,"X":351,"Y":210}]}, -"Orange Inc.":{"IsLeader":false,"Name":"Orange Inc.","FriendDesc":"Orange is a computer industry giant. Let's see how they can compete in a Hacker Battle.","Description":"Orange is a computer industry giant. Let's see how they can compete in a Hacker Battle.","FriendSpeed":100,"FriendSkill":2001,"Difficulty":"hard","Network":[{"Hostname":"orange_inc.","ModuleType":0,"Type":0,"HP":100,"Grade":1,"X":0,"Y":0},{"Hostname":"blood_orange","ModuleType":0,"Type":6,"HP":0,"Grade":4,"X":484,"Y":203},{"Hostname":"yummy","ModuleType":0,"Type":2,"HP":0,"Grade":3,"X":497,"Y":150},{"Hostname":"juicy","ModuleType":0,"Type":5,"HP":0,"Grade":4,"X":356,"Y":212},{"Hostname":"sweet","ModuleType":0,"Type":9,"HP":0,"Grade":2,"X":316,"Y":212},{"Hostname":"orange","ModuleType":0,"Type":2,"HP":0,"Grade":3,"X":490,"Y":270}]} +"Orange Inc.":{"IsLeader":false,"Name":"Orange Inc.","FriendDesc":"Orange is a computer industry giant. Let's see how they can compete in a Hacker Battle.","Description":"Orange is a computer industry giant. Let's see how they can compete in a Hacker Battle.","FriendSpeed":100,"FriendSkill":2001,"Difficulty":"hard","Network":[{"Hostname":"orange_inc.","ModuleType":0,"Type":0,"HP":100,"Grade":1,"X":0,"Y":0},{"Hostname":"blood_orange","ModuleType":0,"Type":6,"HP":0,"Grade":4,"X":484,"Y":203},{"Hostname":"yummy","ModuleType":0,"Type":2,"HP":0,"Grade":3,"X":497,"Y":150},{"Hostname":"juicy","ModuleType":0,"Type":5,"HP":0,"Grade":4,"X":356,"Y":212},{"Hostname":"sweet","ModuleType":0,"Type":9,"HP":0,"Grade":2,"X":316,"Y":212},{"Hostname":"orange","ModuleType":0,"Type":2,"HP":0,"Grade":3,"X":490,"Y":270}]}, +"UltraDOS Foundation":{"IsLeader":false,"Name":"UltraDOS Foundation","FriendDesc":"UltraDOS Foundation is a group of competent programmers responsible for the ShiftOS-based UltraDOS operating system.","Description":"UltraDOS Foundation is a group of competent programmers responsible for the ShiftOS-based UltraDOS operating system.","FriendSpeed":65,"FriendSkill":75,"Difficulty":"medium","Network":[{"Hostname":"ultrados_foundation","ModuleType":0,"Type":0,"HP":100,"Grade":1,"X":0,"Y":0},{"Hostname":"ud_trt1","ModuleType":0,"Type":3,"HP":0,"Grade":2,"X":361,"Y":171},{"Hostname":"ud_trt2","ModuleType":0,"Type":3,"HP":0,"Grade":2,"X":358,"Y":220},{"Hostname":"ud_repairer","ModuleType":0,"Type":9,"HP":0,"Grade":4,"X":494,"Y":215}]} } \ No newline at end of file diff --git a/source/WindowsFormsApplication1/Shifter.cs b/source/WindowsFormsApplication1/Shifter.cs index 43ba200..25e4dd2 100644 --- a/source/WindowsFormsApplication1/Shifter.cs +++ b/source/WindowsFormsApplication1/Shifter.cs @@ -4,6 +4,7 @@ using System.ComponentModel; using System.Data; using System.Drawing; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -482,6 +483,7 @@ private void btnwindows_Click(object sender, EventArgs e) public void GrabSkinData() { + Skinning.Utilities.SavePanels(); string json = JsonConvert.SerializeObject(API.CurrentSkin); CustomizingSkin = JsonConvert.DeserializeObject(json); GetAllImages(); @@ -625,6 +627,8 @@ private void btnapply_Click(object sender, EventArgs e) Skinning.Utilities.loadedSkin = CustomizingSkin; Skinning.Utilities.loadedskin_images = CustomizingImages; + API.CurrentSkin.DesktopPanels = JsonConvert.DeserializeObject>(File.ReadAllText(Paths.LoadedSkin + "panels.json")); + Skinning.Utilities.LoadPanels(); Skinning.Utilities.saveimages(); Skinning.Utilities.saveskin(); API.AddCodepoints(codepointstogive); diff --git a/source/WindowsFormsApplication1/Terminal.cs b/source/WindowsFormsApplication1/Terminal.cs index 5bff0e2..8bda511 100644 --- a/source/WindowsFormsApplication1/Terminal.cs +++ b/source/WindowsFormsApplication1/Terminal.cs @@ -1451,46 +1451,60 @@ public void DoCommand() } break; case "endgame_test": - try + if (API.DeveloperMode) { - switch(args[1]) + try { - 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; + 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."); } } - catch + else { - WriteLine("Invalid arguments."); + wrongcommand(); } break; case "fake_buy": - try + if (API.DeveloperMode) { - if(API.Upgrades.ContainsKey(args[1])) + try { - API.Upgrades[args[1]] = true; - WriteLine($"Bought upgrade {args[1]}."); - API.CurrentSession.SetupAppLauncher(); - API.UpdateWindows(); - SaveSystem.Utilities.saveGame(); + 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."); + } } - else + catch { - WriteLine("Upgrade not found."); + WriteLine("fake_buy: Bad arguments."); } } - catch + else { - WriteLine("fake_buy: Bad arguments."); + wrongcommand(); } break; case "connections": @@ -1571,21 +1585,9 @@ public void DoCommand() else { wrongcommand(); } break; case "htutorial": - ShiftOS.Hacking.StartBattleTutorial(); - break; - case "lua_test": - if(API.DeveloperMode == true) + if (API.DeveloperMode) { - if(Lua_API.UseLuaAPI == true) - { - WriteLine("Lua API disabled, 'saa' command uses old Modding API"); - Lua_API.UseLuaAPI = false; - } - else - { - WriteLine("ShiftOS Lua API enabled. 'saa' command now parses Lua code and interprets it."); - Lua_API.UseLuaAPI = true; - } + ShiftOS.Hacking.StartBattleTutorial(); } else { @@ -1613,15 +1615,22 @@ public void DoCommand() } break; case "toggle_music": - if(Audio.Enabled == false) + if (API.DeveloperMode) { - WriteLine(@"Music enabled. + if (Audio.Enabled == false) + { + WriteLine(@"Music enabled. Warning: The music player code in ShiftOS has a memory leak issue and is quite CPU-intensive. If your CPU fan starts to spin up while listening to a song, that's why. Warning: Music is not embedded within the game. You must download the external resources directory at http://playshiftos.ml/shiftos/resources.zip to have applications play their music."); + } + Audio.Enabled = !Audio.Enabled; + } + else + { + wrongcommand(); } - Audio.Enabled = !Audio.Enabled; break; case "linux": if(API.DeveloperMode) @@ -1651,22 +1660,6 @@ public void DoCommand() wrongcommand(); } break; - case "enemy_test": - var e = new EnemyHacker("DevX", "I am the god of this world.", "I am the god of this world.", 100, 100, "Hard"); - e.AddModule(new Module(SystemType.Antivirus, 4, "you_can't_stop_me")); - e.AddModule(new Module(SystemType.Antivirus, 4, "not_happening")); - e.AddModule(new Module(SystemType.DedicatedDDoS, 2, "dos")); - e.AddModule(new Module(SystemType.Turret, 4, "remotehost")); - e.AddModule(new Module(SystemType.Turret, 2, "boom")); - string json = JsonConvert.SerializeObject(e); - var tp = new TextPad(); - API.CreateForm(tp, "Enemy JSON", API.GetIcon("TextPad")); - tp.txtuserinput.Text = json; - break; - case "htest": - var hui = new HackUI(); - hui.Show(); - break; case "lua": if(API.DeveloperMode == true) { @@ -1720,18 +1713,7 @@ public void DoCommand() wrongcommand(); } break; - case "unitytest": - if (API.DeveloperMode == true) - { - var u = new AlternateDesktop(); - u.Show(); - } - else - { - wrongcommand(); - } - break; - case "virusscanner": + case "virusscanner": case "vscan": if(API.Upgrades["virusscanner"] == true) { @@ -1792,26 +1774,16 @@ public void DoCommand() wrongcommand(); } break; - case "infect": - try { - if (API.DeveloperMode == true) - { - Viruses.InfectRandom(); - WriteLine("A random file has been infected."); - } - else - { - wrongcommand(); - } - } - catch(Exception ex) - { - WriteLine("infect: Error. Probably a mess-up with the virus scanner."); - } - break; case "binarywater": - 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."); + 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."); + } + 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 @@ -2159,75 +2131,11 @@ public void DoCommand() { showhelp(args[1]); } - catch (Exception ex) + catch { showhelp(); } break; - case "kill": - if(API.Upgrades["shiftnet"] == true) - { - List cleanup = new List(); - try - { - foreach (Process mod in API.RunningModProcesses) - { - try - { - if (args[1] == mod.Id.ToString() || args[1].ToLower() == mod.ProcessName.Remove(0, 1).Replace(".exe", "").ToLower()) - { - WriteLine("[" + mod.Id.ToString() + "] - Killed."); - cleanup.Add(mod); - mod.Kill(); - } - } - catch (Exception ex) - { - - } - } - } - catch(Exception ex) - { - WriteLine("kill: Missing argument."); - } - foreach (Process prc in cleanup) - { - try - { - API.RunningModProcesses.Remove(prc); - } - catch (Exception ex) - { - - } - } - } - else - { - wrongcommand(); - } - break; - case "proclist": - if(API.Upgrades["shiftnet"] == true) - { - WriteLine("Running Applications:"); - foreach(Process mod in API.RunningModProcesses) - { - try { - WriteLine("[" + mod.Id.ToString() + "] " + mod.ProcessName.Replace(".exe", "")); - } - catch(Exception ex) - { - - } - } - } - else - { - wrongcommand(); - } - break; case "codepoints": case "cp": WriteLine("You have " + API.Codepoints.ToString() + " Codepoints."); @@ -2383,7 +2291,6 @@ public void DoCommand() } break; } - //cmds(UBound(cmds)) = command } private void StartChoice1EndStory() diff --git a/source/WindowsFormsApplication1/skins.cs b/source/WindowsFormsApplication1/skins.cs index bfef221..0393a47 100644 --- a/source/WindowsFormsApplication1/skins.cs +++ b/source/WindowsFormsApplication1/skins.cs @@ -463,18 +463,24 @@ public static void LoadPanels() public static void SavePanels() { string dir = Paths.LoadedSkin + "panels"; - if(Directory.Exists(dir)) + if (!Directory.Exists(dir)) { - Directory.Delete(dir, true); + Directory.CreateDirectory(dir); } - Directory.CreateDirectory(dir); - foreach(var pnl in loadedSkin.DesktopPanels) + foreach (var pnl in loadedSkin.DesktopPanels) { string dpath = Paths.LoadedSkin + "panels" + OSInfo.DirectorySeparator + pnl.Position + loadedSkin.DesktopPanels.IndexOf(pnl).ToString(); - if(pnl.BackgroundImage != null) + if (pnl.BackgroundImage != null) { - pnl.BackgroundImage.Save(dpath); - pnl.BackgroundImage = null; + try + { + pnl.BackgroundImage.Save(dpath); + pnl.BackgroundImage = null; + } + catch + { + pnl.BackgroundImage = null; + } } } }