Ejemplo n.º 1
0
 public void completeReboot()
 {
     this.os.terminal.reset();
     this.os.execute("FirstTimeInitdswhupwnemfdsiuoewnmdsmffdjsklanfeebfjkalnbmsdakj Init");
     this.os.inputEnabled = false;
     if (!this.graphicsErrorsDetected)
     {
         this.os.setMouseVisiblity(true);
         MusicManager.playSong();
     }
     this.os.connectedComp = (Computer)null;
     if (this.os.thisComputer.files.root.searchForFolder("sys").searchForFile("Notes_Reopener.bat") != null)
     {
         this.os.runCommand("notes");
     }
     try
     {
         this.os.threadedSaveExecute(false);
         this.os.gameSavedTextAlpha = -1f;
     }
     catch (Exception ex)
     {
         int num = 1 - 1;
     }
 }
Ejemplo n.º 2
0
 public static void playSongImmediatley(string songname)
 {
     if (MusicManager.currentSongName != songname)
     {
         try
         {
             MusicManager.curentSong = MusicManager.contentManager.Load <Song>(songname);
         }
         catch (Exception ex)
         {
             Console.WriteLine("Error switching to song: " + songname + "\r\n" + Utils.GenerateReportFromException(ex));
         }
     }
     if (!(MusicManager.curentSong != (Song)null))
     {
         return;
     }
     MusicManager.isPlaying       = false;
     MusicManager.currentSongName = songname;
     MusicManager.playSong();
     MusicManager.setVolume(MusicManager.destinationVolume);
 }
Ejemplo n.º 3
0
        public override void Update(float t)
        {
            base.Update(t);
            double timer = (double)this.timer;

            this.timer += t;
            float num1 = Settings.isDemoMode ? IntroTextModule.DEMO_DELAY_FROM_START_MUSIC_TIMER : IntroTextModule.DELAY_FROM_START_MUSIC_TIMER;

            if (Settings.IsInExtensionMode)
            {
                num1 = ExtensionLoader.ActiveExtensionInfo.IntroStartupSongDelay;
            }
            if (timer < (double)num1 && (double)this.timer >= (double)num1)
            {
                MusicManager.playSong();
            }
            float num2 = 1f;

            if (LocaleActivator.ActiveLocaleIsCJK())
            {
                num2 = 0.6f;
            }
            if (this.finishedText)
            {
                if ((double)this.timer <= (double)IntroTextModule.STAY_ONSCREEN_TIME || (double)this.timer <= (double)IntroTextModule.STAY_ONSCREEN_TIME + (double)IntroTextModule.MODULE_FLASH_TIME)
                {
                    return;
                }
                this.complete = true;
            }
            else if ((double)this.timer > (double)IntroTextModule.FLASH_TIME)
            {
                this.charTimer += t * num2;
                if ((double)this.charTimer < (double)IntroTextModule.CHAR_TIME)
                {
                    return;
                }
                KeyboardState keyboadState;
                double        num3;
                if (!Settings.isConventionDemo)
                {
                    num3 = 0.0;
                }
                else
                {
                    double charTime = (double)IntroTextModule.CHAR_TIME;
                    keyboadState = GuiData.getKeyboadState();
                    double num4 = keyboadState.IsKeyDown(Keys.LeftShift) ? 0.990000009536743 : 0.5;
                    num3 = charTime * num4;
                }
                this.charTimer = (float)num3;
                ++this.charIndex;
                if (this.charIndex >= this.text[this.textIndex].Length)
                {
                    this.charTimer  = IntroTextModule.CHAR_TIME;
                    this.charIndex  = this.text[this.textIndex].Length - 1;
                    this.lineTimer += t;
                    if ((double)this.lineTimer >= (double)IntroTextModule.LINE_TIME)
                    {
                        double num4;
                        if (!Settings.isConventionDemo)
                        {
                            num4 = 0.0;
                        }
                        else
                        {
                            double lineTime = (double)IntroTextModule.LINE_TIME;
                            keyboadState = GuiData.getKeyboadState();
                            double num5 = keyboadState.IsKeyDown(Keys.LeftShift) ? 0.990000009536743 : 0.200000002980232;
                            num4 = lineTime * num5;
                        }
                        this.lineTimer = (float)num4;
                        ++this.textIndex;
                        this.charIndex = 0;
                        if (this.textIndex >= this.text.Length)
                        {
                            if (!MusicManager.isPlaying)
                            {
                                MusicManager.playSong();
                            }
                            this.finishedText = true;
                            this.timer        = 0.0f;
                        }
                    }
                }
            }
            else if (Settings.isConventionDemo && GuiData.getKeyboadState().IsKeyDown(Keys.LeftShift))
            {
                this.timer += t + t;
            }
        }
Ejemplo n.º 4
0
        public override void Update(float t)
        {
            base.Update(t);
            var num1 = timer;

            timer += t;
            var num2 = Settings.isDemoMode ? DEMO_DELAY_FROM_START_MUSIC_TIMER : DELAY_FROM_START_MUSIC_TIMER;

            if (num1 < (double)num2 && timer >= (double)num2)
            {
                MusicManager.playSong();
            }
            if (finishedText)
            {
                if (timer <= (double)STAY_ONSCREEN_TIME || timer <= STAY_ONSCREEN_TIME + (double)MODULE_FLASH_TIME)
                {
                    return;
                }
                complete = true;
            }
            else if (timer > (double)FLASH_TIME)
            {
                charTimer += t;
                if (charTimer < (double)CHAR_TIME)
                {
                    return;
                }
                charTimer = Settings.isConventionDemo
                    ? CHAR_TIME * (GuiData.getKeyboadState().IsKeyDown(Keys.LeftShift) ? 0.99f : 0.5f)
                    : 0.0f;
                ++charIndex;
                if (charIndex < text[textIndex].Length)
                {
                    return;
                }
                charIndex  = text[textIndex].Length - 1;
                lineTimer += t;
                if (lineTimer < (double)LINE_TIME)
                {
                    return;
                }
                lineTimer = Settings.isConventionDemo
                    ? LINE_TIME * (GuiData.getKeyboadState().IsKeyDown(Keys.LeftShift) ? 0.99f : 0.2f)
                    : 0.0f;
                ++textIndex;
                charIndex = 0;
                if (textIndex < text.Length)
                {
                    return;
                }
                if (!MusicManager.isPlaying)
                {
                    MusicManager.playSong();
                }
                finishedText = true;
                timer        = 0.0f;
            }
            else
            {
                if (!Settings.isConventionDemo || !GuiData.getKeyboadState().IsKeyDown(Keys.LeftShift))
                {
                    return;
                }
                timer += t + t;
            }
        }
Ejemplo n.º 5
0
        private static void executeThreadedScript(string[] script, OS os)
        {
            KeyValuePair <string, string>?nullable = new KeyValuePair <string, string>?();
            bool     flag1   = false;
            Computer target  = os.thisComputer;
            Computer source  = (Computer)null;
            TimeSpan timeout = TimeSpan.FromSeconds(0.5);

            for (int index1 = 0; index1 < script.Length; ++index1)
            {
                if (source != null && source.disabled)
                {
                    Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("cDisconnect", target, source), os);
                    Console.WriteLine("Early Script Exit on Source Disable");
                    return;
                }
                if (!string.IsNullOrWhiteSpace(script[index1]))
                {
                    string[]    strArray    = script[index1].Trim().Split(Utils.spaceDelim, StringSplitOptions.RemoveEmptyEntries);
                    CultureInfo cultureInfo = new CultureInfo("en-au");
                    bool        flag2       = target == os.thisComputer;
                    try
                    {
                        switch (strArray[0])
                        {
                        case "config":
                            target = Programs.getComputer(os, strArray[1]);
                            if (target == null)
                            {
                                if (!OS.DEBUG_COMMANDS)
                                {
                                    return;
                                }
                                os.write(" ");
                                os.write("Error: ");
                                os.write("Hack Script target " + strArray[1] + " not found! Aborting.");
                                os.write("This error will not show up if debug commands are disabled.");
                                os.write(" ");
                                return;
                            }
                            source = Programs.getComputer(os, strArray[2]);
                            if (source == null)
                            {
                                if (!OS.DEBUG_COMMANDS)
                                {
                                    return;
                                }
                                os.write(" ");
                                os.write("Error: ");
                                os.write("Hack Script source " + strArray[2] + " not found! Aborting.");
                                os.write("This error will not show up if debug commands are disabled.");
                                os.write(" ");
                                return;
                            }
                            timeout  = TimeSpan.FromSeconds(Convert.ToDouble(strArray[3], (IFormatProvider)cultureInfo));
                            flag2    = false;
                            nullable = new KeyValuePair <string, string>?(new KeyValuePair <string, string>(source.ip, target.ip));
                            os.ActiveHackers.Add(nullable.Value);
                            break;

                        case "delay":
                            if (!OS.TestingPassOnly)
                            {
                                Thread.Sleep(TimeSpan.FromSeconds(Convert.ToDouble(strArray[1], (IFormatProvider)cultureInfo)));
                            }
                            flag2 = false;
                            break;

                        case "connect":
                            Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("cConnection", target, source), os);
                            if (!flag1 && target.ip == os.thisComputer.ip)
                            {
                                os.IncConnectionOverlay.Activate();
                                flag1 = true;
                                break;
                            }
                            break;

                        case "openPort":
                            Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("cPortOpen", target, source) + " " + strArray[1], os);
                            break;

                        case "delete":
                            string pathString = HackerScriptExecuter.getPathString(strArray[1], os, target.files.root);
                            Multiplayer.parseInputMessage("cDelete #" + target.ip + "#" + source.ip + "#" + strArray[2] + pathString, os);
                            break;

                        case "reboot":
                            if (target == os.thisComputer)
                            {
                                if (os.connectedComp == null || os.connectedComp == os.thisComputer)
                                {
                                    os.runCommand("reboot");
                                    break;
                                }
                                os.rebootThisComputer();
                                break;
                            }
                            target.reboot(source.ip);
                            break;

                        case "forkbomb":
                            Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("eForkBomb", target, source), os);
                            break;

                        case "disconnect":
                            target.disconnecting(source.ip, true);
                            break;

                        case "systakeover":
                            HostileHackerBreakinSequence.Execute((object)os, source, target);
                            break;

                        case "clearTerminal":
                            if (target == os.thisComputer)
                            {
                                os.terminal.reset();
                                break;
                            }
                            break;

                        case "write":
                            string str1 = "";
                            for (int index2 = 1; index2 < strArray.Length; ++index2)
                            {
                                str1 = str1 + strArray[index2] + " ";
                            }
                            string str2 = ComputerLoader.filter(str1.Trim());
                            if (target == os.thisComputer)
                            {
                                os.terminal.write(" " + str2);
                                os.warningFlash();
                                break;
                            }
                            break;

                        case "write_silent":
                            string str3 = "";
                            for (int index2 = 1; index2 < strArray.Length; ++index2)
                            {
                                str3 = str3 + strArray[index2] + " ";
                            }
                            string str4 = ComputerLoader.filter(str3.Trim());
                            if (target == os.thisComputer)
                            {
                                os.terminal.write(" " + str4);
                            }
                            flag2 = false;
                            break;

                        case "writel":
                            string str5 = "";
                            for (int index2 = 1; index2 < strArray.Length; ++index2)
                            {
                                str5 = str5 + strArray[index2] + " ";
                            }
                            string text1 = ComputerLoader.filter(str5.Trim());
                            if (string.IsNullOrWhiteSpace(text1))
                            {
                                flag2 = false;
                            }
                            if (target == os.thisComputer)
                            {
                                os.terminal.writeLine(text1);
                                os.warningFlash();
                                break;
                            }
                            break;

                        case "writel_silent":
                            string str6 = "";
                            for (int index2 = 1; index2 < strArray.Length; ++index2)
                            {
                                str6 = str6 + strArray[index2] + " ";
                            }
                            string text2 = ComputerLoader.filter(str6.Trim());
                            if (string.IsNullOrWhiteSpace(text2))
                            {
                                flag2 = false;
                            }
                            if (target == os.thisComputer)
                            {
                                os.terminal.writeLine(text2);
                            }
                            flag2 = false;
                            break;

                        case "hideNetMap":
                            if (target == os.thisComputer)
                            {
                                os.netMap.visible = false;
                                break;
                            }
                            break;

                        case "hideRam":
                            if (target == os.thisComputer)
                            {
                                os.ram.visible = false;
                                break;
                            }
                            break;

                        case "hideDisplay":
                            if (target == os.thisComputer)
                            {
                                os.display.visible = false;
                                break;
                            }
                            break;

                        case "hideTerminal":
                            if (target == os.thisComputer)
                            {
                                os.terminal.visible = false;
                                break;
                            }
                            break;

                        case "showNetMap":
                            if (target == os.thisComputer)
                            {
                                os.netMap.visible = true;
                                break;
                            }
                            break;

                        case "showRam":
                            if (target == os.thisComputer)
                            {
                                os.ram.visible = true;
                                break;
                            }
                            break;

                        case "showTerminal":
                            if (target == os.thisComputer)
                            {
                                os.terminal.visible = true;
                                break;
                            }
                            break;

                        case "showDisplay":
                            if (target == os.thisComputer)
                            {
                                os.display.visible = true;
                                break;
                            }
                            break;

                        case "stopMusic":
                            flag2 = false;
                            if (target == os.thisComputer)
                            {
                                if (HackerScriptExecuter.MusicStopSFX == null)
                                {
                                    HackerScriptExecuter.MusicStopSFX = !DLC1SessionUpgrader.HasDLC1Installed ? os.content.Load <SoundEffect>("SFX/MeltImpact") : os.content.Load <SoundEffect>("DLC/SFX/GlassBreak");
                                }
                                MusicManager.stop();
                                if (HackerScriptExecuter.MusicStopSFX != null)
                                {
                                    HackerScriptExecuter.MusicStopSFX.Play();
                                }
                                break;
                            }
                            break;

                        case "startMusic":
                            flag2 = false;
                            if (!OS.TestingPassOnly)
                            {
                                if (target == os.thisComputer)
                                {
                                    MusicManager.playSong();
                                }
                                break;
                            }
                            break;

                        case "trackseq":
                            try
                            {
                                if (target == os.thisComputer)
                                {
                                    TrackerCompleteSequence.FlagNextForkbombCompletionToTrace(source != null ? source.ip : (string)null);
                                    break;
                                }
                                break;
                            }
                            catch (Exception ex)
                            {
                                os.write(Utils.GenerateReportFromExceptionCompact(ex));
                                break;
                            }

                        case "instanttrace":
                            if (target == os.thisComputer)
                            {
                                TrackerCompleteSequence.TriggerETAS((object)os);
                                break;
                            }
                            break;

                        case "flash":
                            if (!OS.TestingPassOnly)
                            {
                                if (target == os.thisComputer)
                                {
                                    os.warningFlash();
                                }
                                break;
                            }
                            break;

                        case "openCDTray":
                            if (!OS.TestingPassOnly)
                            {
                                if (target == os.thisComputer)
                                {
                                    target.openCDTray(source.ip);
                                }
                                break;
                            }
                            break;

                        case "closeCDTray":
                            if (!OS.TestingPassOnly)
                            {
                                if (target == os.thisComputer)
                                {
                                    target.closeCDTray(source.ip);
                                }
                                break;
                            }
                            break;

                        case "setAdminPass":
                            target.setAdminPassword(strArray[1]);
                            break;

                        case "makeFile":
                            string        folderName    = strArray[1];
                            StringBuilder stringBuilder = new StringBuilder();
                            for (int index2 = 3; index2 < strArray.Length; ++index2)
                            {
                                stringBuilder.Append(strArray[index2]);
                                if (index2 + 1 < strArray.Length)
                                {
                                    stringBuilder.Append(" ");
                                }
                            }
                            Folder     folder     = target.files.root.searchForFolder(folderName);
                            List <int> folderPath = new List <int>();
                            if (folder == null)
                            {
                                folderPath.Add(0);
                            }
                            else
                            {
                                folderPath.Add(target.files.root.folders.IndexOf(folder));
                            }
                            target.makeFile(source.ip, strArray[2], ComputerLoader.filter(stringBuilder.ToString()), folderPath, true);
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        if (OS.TestingPassOnly)
                        {
                            throw new FormatException("Error Parsing command " + strArray[0] + " in HackerScript:", ex);
                        }
                        if (OS.DEBUG_COMMANDS)
                        {
                            os.terminal.write(Utils.GenerateReportFromException(ex));
                            os.write("HackScript error: " + strArray[0]);
                            os.write("Report written to Warnings file");
                            Utils.AppendToWarningsFile(Utils.GenerateReportFromException(ex));
                        }
                    }
                    try
                    {
                        if (flag2 && !os.thisComputer.disabled)
                        {
                            if (!OS.TestingPassOnly)
                            {
                                os.beepSound.Play();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        os.terminal.write(Utils.GenerateReportFromException(ex));
                        Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
                        return;
                    }
                    if (!OS.TestingPassOnly)
                    {
                        Thread.Sleep(timeout);
                    }
                }
            }
            if (!nullable.HasValue)
            {
                return;
            }
            os.ActiveHackers.Remove(nullable.Value);
        }