Ejemplo n.º 1
0
 public static T ReadChain <T>(this MemoryReader reader, MemoryAddress address, params int[] offsets)
 {
     for (int i = 0; i < offsets.Length; i++)
     {
         address  = reader.Read <MemoryAddress>(address);
         address += offsets[i];
     }
     return(reader.Read <T>(address));
 }
Ejemplo n.º 2
0
        private WriteableBitmap ReadForPictureTakenEvent()
        {
            System.Drawing.Bitmap image = MemoryReader.Read <System.Drawing.Bitmap>(new BitmapSerialization());

            IntPtr hBitmap = image.GetHbitmap();

            WriteableBitmap writeableBitmap = null;

            try
            {
                BitmapSource bitmapSource =
                    System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
                        hBitmap, IntPtr.Zero, Int32Rect.Empty,
                        BitmapSizeOptions.FromEmptyOptions()
                        );

                writeableBitmap = new WriteableBitmap(bitmapSource);
            }
            finally
            {
                DeleteObject(hBitmap);
            }

            return(writeableBitmap);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            WriteableBitmap image = MemoryReader.Read <WriteableBitmap>(new WriteableBitmapSerialization());

            image = image.Rotate(90);
            MemoryWriter.Write <WriteableBitmap>(image, new WriteableBitmapSerialization());
        }
Ejemplo n.º 4
0
        public static List <Export> GetExports(PEHeaderReader pe, MemoryReader memory)
        {
            var exports = new List <Export>();

            if (pe.OptionalHeader64.ExportTable.Size > 0)
            {
                var imageBase = pe.OptionalHeader64.ImageBase;
                var ied       = memory.Read <IMAGE_EXPORT_DIRECTORY>(imageBase + pe.OptionalHeader64.ExportTable.VirtualAddress);
                var name      = memory.ReadString(imageBase + ied.Name, 512);
                var names     = memory.Read <uint>(imageBase + ied.AddressOfNames, (int)ied.NumberOfNames)
                                .Select(rva => memory.ReadString(imageBase + rva, 512)).ToArray();
                var functions = memory.Read <uint>(imageBase + ied.AddressOfFunctions, (int)ied.NumberOfFunctions)
                                .Select(rva => imageBase + rva).ToArray();
                var ordinals = memory.Read <ushort>(imageBase + ied.AddressOfNameOrdinals, (int)ied.NumberOfNames);

                exports = Enumerable.Range(0, (int)ied.NumberOfFunctions).Select(i => new Export {
                    Name = names[i], Ordinal = (int)(ied.Base + ordinals[i]), Address = functions[i]
                }).ToList();
            }
            return(exports);
        }
Ejemplo n.º 5
0
        public MemoryAddress DecodeDisp32(MemoryReader reader, string label)
        {
            var marker = Pattern.Markers.FirstOrDefault(x => x.Name.Equals(label, StringComparison.Ordinal));

            if (marker == null)
            {
                throw new KeyNotFoundException();
            }
            var displacement = Position + marker.Position;
            var op           = Pattern.Operations.First(x => x.Contains(marker.Position));
            var op_end       = op.Start + op.Size;

            return(Position + op_end + reader.Read <int>(displacement));
        }
Ejemplo n.º 6
0
        private void SetImage()
        {
            if (is256Frames)
            {
                double phaseShiftInRadians = Math.PI * currentPhaseShiftValue / 180.0;
                Image  image = GenerateImage(phaseShiftInRadians);

                imageForm.SetImage(image);
            }
            else
            {
                Image image = MemoryReader.Read(new ImageSerialization());
                imageForm.SetImage(image);
            }
        }
        private void ReadChart()
        {
            this.plottableList  = new List <IPlottable>();
            this.seriesViewList = new List <ChartSeriesListItem>();

            this.InitLegend();

            Chart chart = MemoryReader.Read <Chart>(new ChartSerialization());

            this.mainPlot.Plot.XAxis.TickLabelNotation(invertSign: chart.InvertAxisX);
            this.mainPlot.Plot.YAxis.TickLabelNotation(invertSign: chart.InvertAxisY);

            ChartSeries first = chart.SeriesCollection.First();

            double[] dataX = first.Points.Select(p => p.X).ToArray();

            int count = chart.SeriesCollection.Count();

            for (int k = 0; k < count; k++)
            {
                IPlottable  plottable = null;
                ChartSeries series    = chart.SeriesCollection[k];
                switch (series.Type)
                {
                case ChartSeriesType.Linear:
                {
                    plottable = this.AddLinearPlot(series, dataX);
                    break;
                }

                case ChartSeriesType.Bubble:
                {
                    plottable = this.AddBubblePlot(series);
                    break;
                }
                }

                this.plottableList.Add(plottable);
                this.seriesViewList.Add(new ChartSeriesListItem()
                {
                    Name      = series.Name,
                    IsVisible = true,
                    Plottable = plottable
                });
            }

            this.listViewSeries.ItemsSource = this.seriesViewList;
        }
Ejemplo n.º 8
0
        private void ShowBackgroundFromMainImage()
        {
            Screen currentScreen = Screen.FromControl(this);
            Screen targetScreen  = Screen.AllScreens.FirstOrDefault(s => !s.Equals(currentScreen)) ?? currentScreen;

            Point location = new Point();

            location.X = targetScreen.WorkingArea.Left;
            location.Y = targetScreen.WorkingArea.Top;

            this.imageForm = new ImageForm();
            this.imageForm.StartPosition = FormStartPosition.Manual;
            this.imageForm.Location      = location;
            this.imageForm.WindowState   = FormWindowState.Maximized;
            this.imageForm.Show();

            Image image = MemoryReader.Read(new ImageSerialization());

            this.imageForm.SetImage(image);
        }
Ejemplo n.º 9
0
 private static T Read <T>(this FlairPattern pattern, MemoryReader reader, int match, string name)
 {
     return(reader.Read <T>(pattern.AddressOfReference(name, match)));
 }
Ejemplo n.º 10
0
        private WriteableBitmap ReadForImageCreatedEvent()
        {
            WriteableBitmap writeableBitmap = MemoryReader.Read <WriteableBitmap>(new WriteableBitmapSerialization());

            return(writeableBitmap);
        }
Ejemplo n.º 11
0
 public T Read <T>(MemoryReader dump, string label)
 => dump.Read <T>(this[label]);