Example #1
0
        internal void LoadFile(string filename, Folder f)
        {
            FileEntry fileEntry = f.searchForFile(filename);

            if (fileEntry == null)
            {
                fileEntry = f.searchForFile(filename + ".md");
                if (fileEntry == null)
                {
                    this.State        = MemoryForensicsExe.MemForensicsState.Error;
                    this.ErrorMessage = string.Format(LocaleTerms.Loc("File {0} not found in current folder!"), (object)filename);
                    return;
                }
            }
            try
            {
                this.ActiveMem          = MemoryContents.GetMemoryFromEncodedFileString(fileEntry.data);
                this.filenameLoaded     = filename;
                this.State              = MemoryForensicsExe.MemForensicsState.ReadingFile;
                this.timeInCurrentState = 0.0f;
            }
            catch (Exception ex)
            {
                this.State        = MemoryForensicsExe.MemForensicsState.Error;
                this.ErrorMessage = LocaleTerms.Loc("Error deserializing memory dump.") + "\r\n\r\n" + Utils.GenerateReportFromException(ex);
            }
        }
Example #2
0
 private void MoveToProcessing()
 {
     this.State = MemoryForensicsExe.MemForensicsState.Processing;
     this.timeInCurrentState      = 0.0f;
     this.processingTimeThisBatch = (float)(2.0 + ((double)Utils.randm(2f) - 1.0));
     this.PanelScroll             = Vector2.Zero;
     this.IsDisplayingImages      = false;
 }
Example #3
0
 public MemoryForensicsExe(Rectangle location, OS operatingSystem, string[] p)
     : base(location, operatingSystem)
 {
     this.needsProxyAccess = false;
     this.name             = "MemForensics";
     this.ramCost          = 300;
     this.IdentifierName   = "MemForensics";
     if (p.Length <= 1)
     {
         this.ErrorMessage = "No file specified.";
         this.State        = MemoryForensicsExe.MemForensicsState.Error;
     }
     else
     {
         this.LoadFile(p[1], Programs.getCurrentFolder(this.os));
     }
     this.DisplayOverrideIsActive = true;
 }
Example #4
0
 public override void Update(float t)
 {
     base.Update(t);
     this.timeInCurrentState += t;
     if (this.State == MemoryForensicsExe.MemForensicsState.ReadingFile && (double)this.timeInCurrentState >= 2.0)
     {
         this.timeInCurrentState = 0.0f;
         this.State = MemoryForensicsExe.MemForensicsState.Main;
     }
     if (this.State == MemoryForensicsExe.MemForensicsState.Processing && (double)this.timeInCurrentState >= (double)this.processingTimeThisBatch)
     {
         this.timeInCurrentState = 0.0f;
         this.State = MemoryForensicsExe.MemForensicsState.DisplayingSolution;
     }
     if (this.State == MemoryForensicsExe.MemForensicsState.Main)
     {
         this.OutputData.Clear();
     }
     this.GridEffect.Update(t);
 }
Example #5
0
        private void RenderResultsDisplayMainState(Rectangle dest, SpriteBatch sb, bool isProcessing)
        {
            Color     color      = new Color(5, 5, 5, 230);
            Rectangle rectangle1 = new Rectangle(dest.X + 22, dest.Y + 30, dest.Width - 44, 40);

            sb.Draw(Utils.white, rectangle1, color);
            rectangle1.X += 10;
            TextItem.doFontLabelToSize(rectangle1, isProcessing ? LocaleTerms.Loc("PROCESSING") : LocaleTerms.Loc("OUTPUT"), GuiData.font, Color.White, true, true);
            rectangle1.X -= 10;
            int width  = 200;
            int height = 30;

            if (Button.doButton(381023909, rectangle1.X + rectangle1.Width - (width + 6), rectangle1.Y + (rectangle1.Height / 2 - height / 2), width, height, isProcessing ? LocaleTerms.Loc("Cancel") : LocaleTerms.Loc("Return to Menu"), new Color?(Color.White)))
            {
                this.State = MemoryForensicsExe.MemForensicsState.Main;
                this.timeInCurrentState = 0.0f;
            }
            rectangle1.Y     += rectangle1.Height;
            rectangle1.Height = 1;
            sb.Draw(Utils.white, rectangle1, Color.White);
            if (isProcessing)
            {
                Rectangle destinationRectangle = new Rectangle(dest.X + 2, rectangle1.Y + rectangle1.Height + 2, dest.Width - 4, 20);
                sb.Draw(Utils.white, destinationRectangle, Color.Black);
                float num = this.timeInCurrentState / this.processingTimeThisBatch;
                destinationRectangle.Width = (int)((double)destinationRectangle.Width * (double)num);
                sb.Draw(Utils.white, destinationRectangle, Utils.makeColorAddative(Color.LightBlue));
            }
            else
            {
                Rectangle rectangle2 = new Rectangle(rectangle1.X, rectangle1.Y + rectangle1.Height + 2, rectangle1.Width, 1);
                rectangle2.Height = dest.Y + dest.Height - (rectangle1.Y + rectangle1.Height + 4);
                sb.Draw(Utils.white, rectangle2, color);
                if (this.OutputData.Count <= 0)
                {
                    TextItem.doFontLabelToSize(rectangle2, " - " + LocaleTerms.Loc("No Valid Matches Found") + " - ", GuiData.smallfont, Color.White, true, false);
                }
                else
                {
                    Rectangle drawbounds = new Rectangle(0, 0, rectangle2.Width, rectangle2.Height);
                    float     num1       = 10f;
                    for (int index = 0; index < this.OutputData.Count; ++index)
                    {
                        if (this.IsDisplayingImages)
                        {
                            if (this.OutputTextures.Count >= index)
                            {
                                num1 += (float)(Math.Min(drawbounds.Width - 16, this.OutputTextures[index].Height) + 30);
                            }
                            else
                            {
                                break;
                            }
                        }
                        else
                        {
                            num1 += 26f + GuiData.smallfont.MeasureString(Utils.SuperSmartTwimForWidth(this.OutputData[index], drawbounds.Width - 16, GuiData.smallfont)).Y;
                        }
                    }
                    drawbounds.Height = (int)num1;
                    ScrollablePanel.beginPanel(3371001, drawbounds, this.PanelScroll);
                    Vector2 pos = new Vector2((float)(drawbounds.X + 14), (float)drawbounds.Y);
                    TextItem.doMeasuredFontLabel(pos, this.AnnouncementData, GuiData.tinyfont, new Color?(Color.White), float.MaxValue, float.MaxValue);
                    pos.Y += 20f;
                    Rectangle destinationRectangle1 = new Rectangle(drawbounds.X, (int)pos.Y, drawbounds.Width, 1);
                    GuiData.spriteBatch.Draw(Utils.white, destinationRectangle1, Color.White);
                    pos.Y += 20f;
                    for (int index = 0; index < this.OutputData.Count; ++index)
                    {
                        if (this.IsDisplayingImages)
                        {
                            if (this.OutputTextures.Count >= index)
                            {
                                Rectangle dest1 = new Rectangle((int)pos.X + 8, (int)pos.Y, drawbounds.Width - 16, drawbounds.Width - 16);
                                dest1.Height = Math.Min(dest1.Height, this.OutputTextures[index].Height);
                                Rectangle rectangle3 = Utils.DrawSpriteAspectCorrect(dest1, GuiData.spriteBatch, this.OutputTextures[index], Color.White, false);
                                float     num2       = (float)(rectangle3.Y - dest1.Y + rectangle3.Height);
                                pos.Y += num2 + 12f;
                            }
                            else
                            {
                                break;
                            }
                        }
                        else
                        {
                            string    text    = Utils.SuperSmartTwimForWidth(this.OutputData[index], drawbounds.Width - 16, GuiData.smallfont);
                            Vector2   vector2 = TextItem.doMeasuredFontLabel(pos, text, GuiData.smallfont, new Color?(Color.White * 0.9f), float.MaxValue, float.MaxValue);
                            Rectangle destinationRectangle2 = new Rectangle(drawbounds.X + 6, (int)pos.Y + (int)(((double)vector2.Y - 3.0) / 2.0), 3, 3);
                            GuiData.spriteBatch.Draw(Utils.white, destinationRectangle2, Color.Gray);
                            pos.Y += vector2.Y + 6f;
                        }
                        destinationRectangle1 = new Rectangle(drawbounds.X, (int)pos.Y, rectangle2.Width, 1);
                        GuiData.spriteBatch.Draw(Utils.white, destinationRectangle1, Color.Gray);
                        pos.Y += 10f;
                    }
                    this.PanelScroll = ScrollablePanel.endPanel(3371001, this.PanelScroll, rectangle2, 2000f, false);
                    float num3 = num1 - (float)rectangle2.Height;
                    if ((double)this.PanelScroll.Y > (double)num3)
                    {
                        this.PanelScroll.Y = num3;
                    }
                }
            }
        }