コード例 #1
0
        public PluginForm()
        {
            this.InitializeComponent();
            pForm = this;
            this.cbDomains.SelectedIndexChanged += new EventHandler(this.CbDomains_SelectedIndexChanged);
            this.sliderOffset.ValueChanged      += new Action <object, EventArgs>(this.SliderOffset_ValueChanged);
            this.sliderDelay.ValueChanged       += new Action <object, EventArgs>(this.SliderDelay_ValueChanged);
            this.sliderOffset.ValueCorrection    = new Func <long, long>(this.SliderOffsetCorrection);
            this.FormClosing += new FormClosingEventHandler(this.MemoryVisualizer_FormClosing);

            //Pixel formats
            string[] names = PixFormats.GetNames();
            this.display.curFormat = PixFormats.Get(names[0]);
            this.cbFormat.Items.AddRange(names);
            this.cbFormat.SelectedIndex         = 0;
            this.offsetIncr                     = display.curFormat.BytesWide;
            this.cbFormat.SelectedIndexChanged += new EventHandler(this.CbFormat_SelectedIndexChanged);

            //Context menu
            ContextMenu contextMenu = new ContextMenu();

            contextMenu.MenuItems.Add(new MenuItem("Copy Image", (o, e2) => { lock (executeLock) { ImageClipboard.SetClipboardImage(display.bitmap.Bitmap, null, null); } })); //TODO: PNG
            contextMenu.MenuItems.Add(new MenuItem("Copy Range", (o, e2) => { lock (executeLock) { Clipboard.SetText(this.rangeStartAddress.ToString("X") + "-" + this.rangeEndAddress.ToString("X")); } }));
            this.display.ContextMenu = contextMenu;

            //refreshDel = Delegate.CreateDelegate(typeof(Action), display, "Refresh");
            //Set loop
            StepActions.StepEnd += this.StepActions_StepEnd;

            this.Load += MemoryVisualizer_Load;

            this.labelVersion.Text = $"{PluginCore.Ver.ToString()}"; //automatic window title
        }
コード例 #2
0
        private void CbFormat_SelectedIndexChanged(object sender, EventArgs e)
        {
            lock (executeLock)
            {
                //PixFormat curFormat = this.display.curFormat;
                this.display.curFormat  = PixFormats.Get(this.cbFormat.SelectedItem.ToString());
                this.nAlignment.Maximum = this.display.curFormat.BytesWide - 1;

                if ((int)this.nWidth.Value % display.curFormat.Pixels > 0)
                {
                    this.nWidth.Value = this.nWidth.Value + ((int)this.nWidth.Value % display.curFormat.Pixels);
                }
                this.UpdateAllSizes();
                this.UpdateImage();
            }
        }