Пример #1
0
        public string checkOSBootFiles(string bootString)
        {
            this.BootLoadErrors = "";
            Folder folder    = this.os.thisComputer.files.root.searchForFolder("sys");
            bool   flag      = true;
            string newValue1 = "ERROR: " + LocaleTerms.Loc("Unable to Load System file os-config.sys") + "\n";

            if (folder.containsFile("os-config.sys"))
            {
                newValue1 = "Loaded os-config.sys : System Config Initialized";
            }
            else
            {
                this.os.failBoot();
                flag = false;
                CrashModule crashModule = this;
                string      str         = crashModule.BootLoadErrors + newValue1 + " \n";
                crashModule.BootLoadErrors = str;
            }
            bootString = bootString.Replace("[OSBoot1]", newValue1);
            string newValue2 = "ERROR: " + LocaleTerms.Loc("Unable to Load System file bootcfg.dll") + "\n";

            if (folder.containsFile("bootcfg.dll"))
            {
                newValue2 = "Loaded bootcfg.dll : Boot Config Module Loaded";
            }
            else
            {
                this.os.failBoot();
                flag = false;
                CrashModule crashModule = this;
                string      str         = crashModule.BootLoadErrors + newValue2 + " \n";
                crashModule.BootLoadErrors = str;
            }
            bootString = bootString.Replace("[OSBoot2]", newValue2);
            string newValue3 = "ERROR: " + LocaleTerms.Loc("Unable to Load System file netcfgx.dll") + "\n";

            if (folder.containsFile("netcfgx.dll"))
            {
                newValue3 = "Loaded netcfgx.dll : Network Config Module Loaded";
            }
            else
            {
                this.os.failBoot();
                flag = false;
                CrashModule crashModule = this;
                string      str         = crashModule.BootLoadErrors + newValue3 + " \n";
                crashModule.BootLoadErrors = str;
            }
            bootString = bootString.Replace("[OSBoot3]", newValue3);
            string newValue4 = "ERROR: " + LocaleTerms.Loc("Unable to Load System file x-server.sys") + "\nERROR: " + LocaleTerms.Loc("Locate and restore a valid x-server file in ~/sys/ folder to restore UX functionality") + "\nERROR: " + LocaleTerms.Loc("Consider examining reports in ~/log/ for problem cause and source") + "\nERROR: " + LocaleTerms.Loc("System UX resources unavailable -- defaulting to terminal mode") + "\n .\n .\n .\n";

            if (folder.containsFile("x-server.sys"))
            {
                newValue4 = "Loaded x-server.sys : UX Graphics Module Loaded";
                ThemeManager.switchTheme((object)this.os, ThemeManager.getThemeForDataString(folder.searchForFile("x-server.sys").data));
                this.graphicsErrorsDetected = false;
            }
            else
            {
                this.os.graphicsFailBoot();
                flag = false;
                this.graphicsErrorsDetected = true;
                CrashModule crashModule = this;
                string      str         = crashModule.BootLoadErrors + newValue4 + " \n";
                crashModule.BootLoadErrors = str;
            }
            bootString = bootString.Replace("[OSBootTheme]", newValue4);
            if (flag)
            {
                if (this.os.Flags.HasFlag("BootFailure") && !this.os.Flags.HasFlag("BootFailureThemeSongChange") && ThemeManager.currentTheme != OSTheme.HacknetBlue)
                {
                    this.os.Flags.AddFlag("BootFailureThemeSongChange");
                    if (MusicManager.isPlaying)
                    {
                        MusicManager.stop();
                    }
                    MusicManager.loadAsCurrentSong("Music\\The_Quickening");
                }
                this.os.sucsesfulBoot();
            }
            else
            {
                this.os.Flags.AddFlag("BootFailure");
            }
            return(bootString);
        }
Пример #2
0
 public override void LoadContent()
 {
     if (canRunContent)
     {
         delayer = new ActionDelayer();
         ComputerLoader.init(this);
         content = ScreenManager.Game.Content;
         username = SaveUserAccountName == null
             ? (Settings.isConventionDemo ? Settings.ConventionLoginName : Environment.UserName)
             : SaveUserAccountName;
         username = FileSanitiser.purifyStringForDisplay(username);
         var compLocation = new Vector2(0.1f, 0.5f);
         if (multiplayer && !isServer)
             compLocation = new Vector2(0.8f, 0.8f);
         ramAvaliable = totalRam;
         var str = !multiplayer || !isServer ? NetworkMap.generateRandomIP() : NetworkMap.generateRandomIP();
         thisComputer = new Computer(username + " PC", NetworkMap.generateRandomIP(), compLocation, 5, 4, this);
         thisComputer.adminIP = thisComputer.ip;
         thisComputer.idName = "playerComp";
         var folder = thisComputer.files.root.searchForFolder("home");
         folder.folders.Add(new Folder("stash"));
         folder.folders.Add(new Folder("misc"));
         var userDetail = thisComputer.users[0];
         userDetail.known = true;
         thisComputer.users[0] = userDetail;
         defaultUser = new UserDetail(username, "password", 1);
         defaultUser.known = true;
         var theme = OSTheme.HacknetBlue;
         if (Settings.isConventionDemo)
         {
             var num = Utils.random.NextDouble();
             if (num < 0.33)
                 theme = OSTheme.HacknetMint;
             else if (num < 0.66)
                 theme = OSTheme.HackerGreen;
         }
         ThemeManager.setThemeOnComputer(thisComputer, theme);
         if (multiplayer)
         {
             thisComputer.addMultiplayerTargetFile();
             sendMessage("newComp #" + thisComputer.ip + "#" + compLocation.X + "#" + compLocation.Y +
                         "#" + 5 + "#" + thisComputer.name);
             multiplayerMissionLoaded = false;
         }
         if (!WillLoadSave)
             People.init();
         modules = new List<Module>();
         exes = new List<ExeModule>();
         shells = new List<ShellExe>();
         shellIPs = new List<string>();
         var viewport = ScreenManager.GraphicsDevice.Viewport;
         var width1 = RamModule.MODULE_WIDTH;
         var height1 = 205;
         var width2 = (int) ((viewport.Width - width1 - 6)*0.4442);
         var num1 = (int) ((viewport.Width - width1 - 6)*0.5558);
         var height2 = viewport.Height - height1 - TOP_BAR_HEIGHT - 6;
         terminal =
             new Terminal(
                 new Rectangle(viewport.Width - 2 - width2, TOP_BAR_HEIGHT, width2,
                     viewport.Height - TOP_BAR_HEIGHT - 2), this);
         terminal.name = "TERMINAL";
         modules.Add(terminal);
         netMap = new NetworkMap(new Rectangle(width1 + 4, viewport.Height - height1 - 2, num1 - 1, height1),
             this);
         netMap.name = "netMap v1.7";
         modules.Add(netMap);
         display = new DisplayModule(new Rectangle(width1 + 4, TOP_BAR_HEIGHT, num1 - 2, height2), this);
         display.name = "DISPLAY";
         modules.Add(display);
         ram =
             new RamModule(
                 new Rectangle(2, TOP_BAR_HEIGHT, width1, ramAvaliable + RamModule.contentStartOffset), this);
         ram.name = "RAM";
         modules.Add(ram);
         for (var index = 0; index < modules.Count; ++index)
             modules[index].LoadContent();
         for (var index = 0; index < 2; ++index)
         {
             if (isServer || !multiplayer)
                 thisComputer.links.Add(index);
             else
                 thisComputer.links.Add(netMap.nodes.Count - 1 - index);
         }
         var flag1 = false;
         if (!WillLoadSave)
         {
             netMap.nodes.Insert(0, thisComputer);
             netMap.visibleNodes.Add(0);
             MusicManager.loadAsCurrentSong("Music\\Revolve");
         }
         else
         {
             loadSaveFile();
             flag1 = true;
             Settings.initShowsTutorial = false;
         }
         if (!multiplayer && !flag1)
         {
             MailServer.shouldGenerateJunk = false;
             netMap.mailServer.addNewUser(thisComputer.ip, defaultUser);
         }
         mailicon = new MailIcon(this, new Vector2(0.0f, 0.0f));
         mailicon.pos.X = viewport.Width - mailicon.getWidth() - 2;
         topBar = new Rectangle(0, 0, viewport.Width, TOP_BAR_HEIGHT - 1);
         crashModule =
             new CrashModule(
                 new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width,
                     ScreenManager.GraphicsDevice.Viewport.Height), this);
         crashModule.LoadContent();
         introTextModule =
             new IntroTextModule(
                 new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width,
                     ScreenManager.GraphicsDevice.Viewport.Height), this);
         introTextModule.LoadContent();
         traceTracker = new TraceTracker(this);
         IncConnectionOverlay = new IncomingConnectionOverlay(this);
         if (allFactions == null)
         {
             allFactions = new AllFactions();
             allFactions.init();
         }
         currentFaction = allFactions.factions[allFactions.currentFaction];
         scanLines = content.Load<Texture2D>("ScanLines");
         cross = content.Load<Texture2D>("Cross");
         cog = content.Load<Texture2D>("Cog");
         saveIcon = content.Load<Texture2D>("SaveIcon");
         beepSound = content.Load<SoundEffect>("SFX/beep");
         if (!multiplayer & !flag1)
             loadMissionNodes();
         if (!flag1)
             MusicManager.playSong();
         if (flag1 || !Settings.slowOSStartup)
         {
             initShowsTutorial = false;
             introTextModule.complete = true;
         }
         inputEnabled = true;
         isLoaded = true;
         fullscreen = new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width,
             ScreenManager.GraphicsDevice.Viewport.Height);
         TraceDangerSequence = new TraceDangerSequence(content, ScreenManager.SpriteBatch, fullscreen, this);
         endingSequence = new EndingSequenceModule(fullscreen, this);
         var flag2 = Settings.slowOSStartup && !flag1;
         var flag3 = Settings.osStartsWithTutorial && (!flag1 || !Flags.HasFlag("TutorialComplete"));
         if (flag2)
         {
             rebootThisComputer();
             if (!Settings.initShowsTutorial)
                 return;
             display.visible = false;
             ram.visible = false;
             netMap.visible = false;
             terminal.visible = true;
         }
         else if (flag3)
         {
             display.visible = false;
             ram.visible = false;
             netMap.visible = false;
             terminal.visible = true;
             terminal.reset();
             Settings.initShowsTutorial = true;
             initShowsTutorial = true;
             if (TestingPassOnly)
                 return;
             execute("FirstTimeInitdswhupwnemfdsiuoewnmdsmffdjsklanfeebfjkalnbmsdakj Init");
         }
         else
         {
             if (!TestingPassOnly)
                 runCommand("connect " + thisComputer.ip);
             if (thisComputer.files.root.searchForFolder("sys").searchForFile("Notes_Reopener.bat") == null)
                 return;
             runCommand("notes");
         }
     }
     else
     {
         if (!multiplayer)
             return;
         initializeNetwork();
     }
 }