예제 #1
0
        public static void UpgradeSession(object osobj, bool needsNodeInjection)
        {
            OS os = (OS)osobj;

            MemoryDumpInjector.InjectMemory(LocalizedFileLoader.GetLocalizedFilepath("Content/DLC/Missions/Injections/MemoryDumps/GibsonLink.xml"), (object)Programs.getComputer(os, "polarSnakeDest"));
            MemoryDumpInjector.InjectMemory(LocalizedFileLoader.GetLocalizedFilepath("Content/DLC/Missions/Injections/MemoryDumps/NaixHome.xml"), (object)Programs.getComputer(os, "naixGateway"));
            MemoryDumpInjector.InjectMemory(LocalizedFileLoader.GetLocalizedFilepath("Content/DLC/Missions/Injections/MemoryDumps/BitDropBox.xml"), (object)Programs.getComputer(os, "BitWorkServer"));
            MemoryDumpInjector.InjectMemory(LocalizedFileLoader.GetLocalizedFilepath("Content/DLC/Missions/Injections/MemoryDumps/ExpandKeysInjection.xml"), (object)Programs.getComputer(os, "portcrack01"));
            if (os.thisComputer.Memory == null)
            {
                os.thisComputer.Memory = new MemoryContents();
            }
            os.allFactions.factions.Add("Bibliotheque", (Faction)CustomFaction.ParseFromFile("Content/DLC/DLCFaction.xml"));
            if (needsNodeInjection)
            {
                if (People.all == null)
                {
                    People.init();
                }
                else if (!People.PeopleWereGeneratedWithDLCAdditions)
                {
                    People.LoadInDLCPeople();
                }
                List <string> dlcList = BootLoadList.getDLCList();
                for (int index = 0; index < dlcList.Count; ++index)
                {
                    Computer.loadFromFile(dlcList[index]);
                }
                ComputerLoader.postAllLoadedActions();
            }
            Computer computer = Programs.getComputer(os, "ispComp");

            if (!computer.ports.Contains(443))
            {
                computer.ports.Add(443);
            }
            if (computer.ports.Contains(6881))
            {
                return;
            }
            computer.ports.Add(6881);
        }
예제 #2
0
        public static void LoadNewExtensionSession(ExtensionInfo info, object os_obj)
        {
            LocaleActivator.ActivateLocale(info.Language, Game1.getSingleton().Content);
            OS os = (OS)os_obj;

            People.ReInitPeopleForExtension();
            if (Directory.Exists(info.FolderPath + "/Nodes"))
            {
                Utils.ActOnAllFilesRevursivley(info.FolderPath + "/Nodes", (Action <string>)(filename =>
                {
                    if (!filename.EndsWith(".xml"))
                    {
                        return;
                    }
                    if (OS.TestingPassOnly)
                    {
                        try
                        {
                            Computer c = Computer.loadFromFile(filename);
                            if (c != null)
                            {
                                ExtensionLoader.CheckAndAssignCoreServer(c, os);
                            }
                        }
                        catch (Exception ex)
                        {
                            string format       = "COMPUTER LOAD ERROR:\nError loading computer \"{0}\"";
                            Exception exception = ex;
                            string message      = string.Format(format, (object)filename);
                            for (; exception != null; exception = exception.InnerException)
                            {
                                string str = string.Format("\r\nError: {0} - {1}", (object)exception.GetType().Name, (object)exception.Message);
                                message   += str;
                            }
                            throw new FormatException(message, ex);
                        }
                    }
                    else
                    {
                        Computer c = Computer.loadFromFile(filename);
                        if (c != null)
                        {
                            ExtensionLoader.CheckAndAssignCoreServer(c, os);
                        }
                    }
                }));
            }
            if (ComputerLoader.postAllLoadedActions != null)
            {
                ComputerLoader.postAllLoadedActions();
            }
            if (Programs.getComputer(os, "jmail") == null)
            {
                Computer c = new Computer("JMail Email Server", NetworkMap.generateRandomIP(), new Vector2(0.8f, 0.2f), 6, (byte)1, os);
                c.idName = "jmail";
                c.daemons.Add((Daemon) new MailServer(c, "JMail", os));
                MailServer.shouldGenerateJunk = false;
                c.users.Add(new UserDetail(os.defaultUser.name, "mailpassword", (byte)2));
                c.initDaemons();
                os.netMap.mailServer = c;
                os.netMap.nodes.Add(c);
            }
            for (int index = 0; index < info.StartingVisibleNodes.Length; ++index)
            {
                Computer computer = Programs.getComputer(os, info.StartingVisibleNodes[index]);
                if (computer != null)
                {
                    os.netMap.discoverNode(computer);
                }
            }
            for (int index = 0; index < info.FactionDescriptorPaths.Count; ++index)
            {
                string path = info.FolderPath + "/" + info.FactionDescriptorPaths[index];
                using (FileStream fileStream = File.OpenRead(path))
                {
                    try
                    {
                        Faction faction = Faction.loadFromSave(XmlReader.Create((Stream)fileStream));
                        os.allFactions.factions.Add(faction.idName, faction);
                    }
                    catch (Exception ex)
                    {
                        throw new FormatException("Error loading Faction: " + path, ex);
                    }
                }
            }
            OSTheme theme = OSTheme.Custom;
            bool    flag  = false;

            foreach (object obj in Enum.GetValues(typeof(OSTheme)))
            {
                if (obj.ToString().ToLower() == info.Theme)
                {
                    theme = (OSTheme)obj;
                    flag  = true;
                }
            }
            if (!flag)
            {
                if (File.Exists(info.FolderPath + "/" + info.Theme))
                {
                    ThemeManager.setThemeOnComputer((object)os.thisComputer, info.Theme);
                    ThemeManager.switchTheme((object)os, info.Theme);
                }
            }
            else
            {
                ThemeManager.setThemeOnComputer((object)os.thisComputer, theme);
                ThemeManager.switchTheme((object)os, theme);
            }
            ExtensionLoader.LoadExtensionStartTrackAsCurrentSong(info);
            if (info.StartingActionsPath != null)
            {
                RunnableConditionalActions.LoadIntoOS(info.StartingActionsPath, (object)os);
            }
            if (info.StartingMissionPath == null || info.StartsWithTutorial || info.HasIntroStartup)
            {
                return;
            }
            ExtensionLoader.SendStartingEmailForActiveExtensionNextFrame((object)os);
        }
예제 #3
0
        public static void FixSavesWithTerribleHacks(object osObj)
        {
            OS       os        = (OS)osObj;
            Computer computer1 = Programs.getComputer(os, "mainHubAssets");

            if (computer1 != null)
            {
                Folder folder1 = computer1.files.root.searchForFolder("bin");
                if (folder1 != null)
                {
                    Folder folder2 = folder1.searchForFolder("Sequencer");
                    if (folder2 != null)
                    {
                        FileEntry fileEntry = folder2.searchForFile("Sequencer.exe");
                        if (fileEntry == null)
                        {
                            folder2.files.Add(new FileEntry(PortExploits.crackExeData[17], "Sequencer.exe"));
                        }
                        else
                        {
                            fileEntry.data = PortExploits.crackExeData[17];
                        }
                    }
                }
            }
            Computer computer2 = Programs.getComputer(os, "pacemakerSW_BE");

            if (computer2 != null)
            {
                Console.WriteLine("Searching for pacemaker comp");
                Folder folder1 = computer2.files.root.searchForFolder("projects");
                if (folder1 != null)
                {
                    Console.WriteLine("Searching for pacemaker projects");
                    Folder folder2 = folder1.searchForFolder("KellisBT");
                    if (folder2 != null)
                    {
                        Folder folder3 = folder2.searchForFolder("Tests");
                        if (folder3 != null)
                        {
                            Console.WriteLine("Searching for pacemaker file");
                            FileEntry fileEntry = folder3.searchForFile("PacemakerFirmware_Cycle_Test.dll");
                            if (fileEntry == null)
                            {
                                folder3.files.Add(new FileEntry(PortExploits.DangerousPacemakerFirmware, "PacemakerFirmware_Cycle_Test.dll"));
                            }
                            else
                            {
                                fileEntry.data = PortExploits.DangerousPacemakerFirmware;
                            }
                        }
                    }
                }
            }
            if (!os.HasLoadedDLCContent)
            {
                return;
            }
            List <Computer> computerList = new List <Computer>();

            if (Programs.getComputer(os, "dPets_MF").links.Count == 0)
            {
                ComputerLoader.postAllLoadedActions = (Action)null;
                List <string> dlcList = BootLoadList.getDLCList();
                for (int index = 0; index < dlcList.Count; ++index)
                {
                    Computer computer3 = (Computer)ComputerLoader.loadComputer(dlcList[index], true, true);
                    computerList.Add(computer3);
                }
                ComputerLoader.postAllLoadedActions();
            }
            for (int index = 0; index < computerList.Count; ++index)
            {
                Programs.getComputer(os, computerList[index].idName).links = computerList[index].links;
            }
            Folder folder = Programs.getComputer(os, "dPets_MF").files.root.searchForFolder("Database");
            bool   flag   = false;

            if (folder.files.Count > 0 && folder.files[0].data.Contains("DigiPet"))
            {
                for (int index = 0; index < folder.files.Count; ++index)
                {
                    folder.files[index].data = folder.files[index].data.Replace("DigiPet", "Neopal");
                    if (folder.files[index].data.Contains("Minx"))
                    {
                        flag = true;
                    }
                }
                if (flag)
                {
                    ;
                }
                DLCHubServer daemon = (DLCHubServer)Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer));
                daemon.navigatedTo();
                if (daemon.ActiveMissions.Count == 0)
                {
                    daemon.AddMission(os.currentMission, os.defaultUser.name, false);
                }
            }
            if (os.Flags.HasFlag("KaguyaTrialComplete") && !os.netMap.visibleNodes.Contains(os.netMap.nodes.IndexOf(Programs.getComputer(os, "dhs"))))
            {
                os.Flags.RemoveFlag("KaguyaTrialComplete");
            }
        }