Ejemplo n.º 1
0
        private void DownloadMemoryDump()
        {
            string encodedFileString = this.target.Memory.GetEncodedFileString();

            if (this.os.thisComputer == this.target)
            {
                List <string> stringList = new List <string>();
                for (int index = 0; index < this.os.exes.Count; ++index)
                {
                    NotesExe ex = this.os.exes[index] as NotesExe;
                    if (ex != null)
                    {
                        stringList.AddRange((IEnumerable <string>)ex.notes);
                    }
                }
                encodedFileString = new MemoryContents()
                {
                    DataBlocks  = new List <string>((IEnumerable <string>)stringList.ToArray()),
                    CommandsRun = this.os.terminal.GetRecentTerminalHistoryList()
                }.GetEncodedFileString();
            }
            string reportFilename = this.getReportFilename(this.target.name);
            Folder folder         = this.os.thisComputer.files.root.searchForFolder("home");
            Folder f = folder.searchForFolder("MemDumps");

            if (f == null)
            {
                folder.folders.Add(new Folder("MemDumps"));
                f = folder.searchForFolder("MemDumps");
            }
            string repeatingFilename = Utils.GetNonRepeatingFilename(reportFilename, ".mem", f);

            f.files.Add(new FileEntry(encodedFileString, repeatingFilename));
            this.savedFileName = "home/MemDumps/" + repeatingFilename;
        }
Ejemplo n.º 2
0
 public static bool NoteExists(string note, OS os)
 {
     for (int index = 0; index < os.exes.Count; ++index)
     {
         NotesExe ex = os.exes[index] as NotesExe;
         if (ex != null)
         {
             return(ex.HasNote(note));
         }
     }
     return(false);
 }
Ejemplo n.º 3
0
 public void FlashMemoryWarning()
 {
     this.OutOfMemoryFlashTime = RamModule.FLASH_TIME;
     for (int index = 0; index < this.os.exes.Count; ++index)
     {
         NotesExe ex = this.os.exes[index] as NotesExe;
         if (ex != null)
         {
             ex.DisplayOutOfMemoryWarning();
         }
     }
 }
Ejemplo n.º 4
0
        public static void AddNoteToOS(string note, OS os, bool isRecursiveSelfAdd = false)
        {
            for (int index = 0; index < os.exes.Count; ++index)
            {
                NotesExe ex = os.exes[index] as NotesExe;
                if (ex != null)
                {
                    ex.AddNote(note);
                    return;
                }
            }
            if (!isRecursiveSelfAdd)
            {
                os.runCommand("notes");
            }
            Action action = (Action)(() => NotesExe.AddNoteToOS(note, os, true));

            os.delayer.Post(ActionDelayer.NextTick(), action);
        }
Ejemplo n.º 5
0
        public void doEmailViewerDisplay(Rectangle bounds, SpriteBatch sb)
        {
            var vector2 = new Vector2(bounds.X + 2, bounds.Y + 20);

            if (Button.doButton(800007, (int)vector2.X, (int)vector2.Y, bounds.Width - 20 - corner.Width, 30,
                                "Return to Inbox", os.darkBackgroundColor))
            {
                state = 3;
            }
            vector2.Y += 35f;
            var destinationRectangle = GuiData.tmpRect;

            destinationRectangle.X      = bounds.X + 1;
            destinationRectangle.Y      = (int)vector2.Y;
            destinationRectangle.Width  = bounds.Width - 2;
            destinationRectangle.Height = 38;
            sb.Draw(Utils.white, destinationRectangle, textColor);
            vector2.Y += 3f;
            sb.DrawString(GuiData.UITinyfont, "<" + emailData[1] + ">", vector2, Color.Black);
            vector2.Y += 18f;
            sb.DrawString(GuiData.UITinyfont, "Subject: " + emailData[2], vector2, Color.Black);
            vector2.Y += 25f;
            vector2.X += 20f;
            var num1       = 25;
            var num2       = (emailData.Length - 4 + 1) * num1;
            var textBounds = new Rectangle((int)vector2.X, (int)vector2.Y, bounds.Width - 22,
                                           (int)(bounds.Height - (vector2.Y - (double)bounds.Y) - num2));
            var str = Utils.SmartTwimForWidth(emailData[3], bounds.Width - 50, GuiData.tinyfont);

            vector2.Y += DrawMailMessageText(textBounds, sb, str.Split(Utils.newlineDelim));
            vector2.Y += num1 - 5;
            var num3 = 0;

            for (var index1 = 4; index1 < emailData.Length; ++index1)
            {
                var strArray = emailData[index1].Split(spaceDelim, StringSplitOptions.RemoveEmptyEntries);
                var flag     = true;
                if (strArray.Length >= 1)
                {
                    if (strArray[0].Equals("link"))
                    {
                        var labelSize = TextItem.doMeasuredTinyLabel(vector2,
                                                                     "LINK : " + strArray[1] + "@" + strArray[2], new Color?());
                        var computer = Programs.getComputer(os, strArray[2]);
                        if (!os.netMap.visibleNodes.Contains(os.netMap.nodes.IndexOf(computer)))
                        {
                            DrawButtonGlow(vector2, labelSize);
                        }
                        if (Button.doButton(800009 + num3, (int)(vector2.X + (double)labelSize.X + 5.0),
                                            (int)vector2.Y, 20, 17, "+", new Color?()))
                        {
                            computer.highlightFlashTime = 1f;
                            os.netMap.discoverNode(computer);
                            SFX.addCircle(Programs.getComputer(os, strArray[2]).getScreenSpacePosition(), Color.White,
                                          32f);
                            buttonSound.Play();
                        }
                    }
                    else if (strArray[0].Equals("account"))
                    {
                        var labelSize = TextItem.doMeasuredTinyLabel(vector2,
                                                                     "ACCOUNT : " + strArray[1] + " : User="******" Pass="******"+", new Color?()))
                        {
                            var computer = Programs.getComputer(os, strArray[1]);
                            computer.highlightFlashTime = 1f;
                            os.netMap.discoverNode(computer);
                            computer.highlightFlashTime = 1f;
                            SFX.addCircle(computer.getScreenSpacePosition(), Color.White, 32f);
                            for (var index2 = 0; index2 < computer.users.Count; ++index2)
                            {
                                var userDetail = computer.users[index2];
                                if (userDetail.name.Equals(strArray[3]))
                                {
                                    userDetail.known       = true;
                                    computer.users[index2] = userDetail;
                                    break;
                                }
                            }
                            buttonSound.Play();
                        }
                    }
                    else if (strArray[0].Equals("note"))
                    {
                        var labelSize = TextItem.doMeasuredTinyLabel(vector2, "NOTE : " + strArray[1], new Color?());
                        if (!NotesExe.NoteExists(strArray[2], os))
                        {
                            DrawButtonGlow(vector2, labelSize);
                        }
                        if (Button.doButton(800009 + num3, (int)(vector2.X + (double)labelSize.X + 5.0),
                                            (int)vector2.Y, 20, 17, "+", new Color?()))
                        {
                            NotesExe.AddNoteToOS(strArray[2], os, false);
                        }
                    }
                    else
                    {
                        flag = false;
                    }
                    if (flag)
                    {
                        ++num3;
                        vector2.Y += num1;
                    }
                }
            }
            vector2.Y = bounds.Y + bounds.Height - 35;
            if (!Button.doButton(90200, (int)vector2.X, (int)vector2.Y, 300, 30, "Reply", new Color?()))
            {
                return;
            }
            emailReplyStrings.Clear();
            addingNewReplyString   = false;
            missionIncompleteReply = false;
            state = 5;
        }