Exemplo n.º 1
0
		private void ViewInHexEditorContextMenuItem_Click(object sender, EventArgs e)
		{
			if (SelectedWatches.Any())
			{
				ViewInHexEditor(_searches.Domain, SelectedWatches.Select(x => x.Address), SelectedSize);
			}
		}
Exemplo n.º 2
0
        private void EditWatch(bool duplicate = false)
        {
            var indexes = SelectedIndices.ToList();

            if (SelectedWatches.Any())
            {
                var we = new WatchEditor
                {
                    InitialLocation = this.ChildPointToScreen(WatchListView)
                };

                we.SetWatch(_watches.Domain, SelectedWatches, duplicate ? WatchEditor.Mode.Duplicate : WatchEditor.Mode.Edit);

                var result = we.ShowHawkDialog();
                if (result == DialogResult.OK)
                {
                    Changes();
                    if (duplicate)
                    {
                        _watches.AddRange(we.Watches);
                        WatchListView.ItemCount = _watches.ItemCount;
                    }
                    else
                    {
                        for (var i = 0; i < we.Watches.Count; i++)
                        {
                            _watches[indexes[i]] = we.Watches[i];
                        }
                    }
                }

                UpdateValues();
            }
        }
        private void EditWatch(bool duplicate = false)
        {
            var indexes = SelectedIndices.ToList();

            if (SelectedWatches.Any())
            {
                var we = new WatchEditor
                {
                    InitialLocation = this.ChildPointToScreen(WatchListView),
                    MemoryDomains   = MemoryDomains
                };

                we.SetWatch(SelectedWatches.First().Domain, SelectedWatches, duplicate ? WatchEditor.Mode.Duplicate : WatchEditor.Mode.Edit);

                if (this.ShowDialogWithTempMute(we) == DialogResult.OK)
                {
                    if (duplicate)
                    {
                        _watches.AddRange(we.Watches);
                        WatchListView.RowCount = _watches.Count;
                        UpdateWatchCount();
                    }
                    else
                    {
                        for (var i = 0; i < we.Watches.Count; i++)
                        {
                            _watches[indexes[i]] = we.Watches[i];
                        }
                    }
                    Changes();
                }

                GeneralUpdate();
            }
            else if (SelectedSeparators.Any() && !duplicate)
            {
                var inputPrompt = new InputPrompt
                {
                    Text          = "Edit Separator",
                    StartLocation = this.ChildPointToScreen(WatchListView),
                    Message       = "Separator Text:",
                    TextInputType = InputPrompt.InputType.Text
                };

                if (this.ShowDialogWithTempMute(inputPrompt) == DialogResult.OK)
                {
                    Changes();

                    for (int i = 0; i < SelectedSeparators.Count(); i++)
                    {
                        var sep = SelectedSeparators.ToList()[i];
                        sep.Notes            = inputPrompt.PromptText;
                        _watches[indexes[i]] = sep;
                    }
                }

                GeneralUpdate();
            }
        }
Exemplo n.º 4
0
        private void ListViewContextMenu_Opening(object sender, CancelEventArgs e)
        {
            var indexes = WatchListView.SelectedIndices;

            EditContextMenuItem.Visible                   =
                RemoveContextMenuItem.Visible             =
                    DuplicateContextMenuItem.Visible      =
                        PokeContextMenuItem.Visible       =
                            FreezeContextMenuItem.Visible =
                                Separator4.Visible        =
                                    ReadBreakpointContextMenuItem.Visible      =
                                        WriteBreakpointContextMenuItem.Visible =
                                            Separator6.Visible =
                                                InsertSeperatorContextMenuItem.Visible            =
                                                    MoveUpContextMenuItem.Visible                 =
                                                        MoveDownContextMenuItem.Visible           =
                                                            MoveTopContextMenuItem.Visible        =
                                                                MoveBottomContextMenuItem.Visible =
                                                                    indexes.Count > 0;

            ReadBreakpointContextMenuItem.Visible      =
                WriteBreakpointContextMenuItem.Visible =
                    Separator6.Visible =
                        SelectedWatches.Any() &&
                        Debuggable != null &&
                        Debuggable.MemoryCallbacksAvailable() &&
                        SelectedWatches.All(w => w.Domain.Name == (MemoryDomains != null ? MemoryDomains.SystemBus.Name : ""));

            PokeContextMenuItem.Enabled       =
                FreezeContextMenuItem.Visible =
                    SelectedIndices.Any() &&
                    SelectedWatches.All(w => w.Domain.CanPoke());

            var allCheats = SelectedWatches.All(x => Global.CheatList.IsActive(x.Domain, x.Address));

            if (allCheats)
            {
                FreezeContextMenuItem.Text  = "&Unfreeze Address";
                FreezeContextMenuItem.Image = Properties.Resources.Unfreeze;
            }
            else
            {
                FreezeContextMenuItem.Text  = "&Freeze Address";
                FreezeContextMenuItem.Image = Properties.Resources.Freeze;
            }

            UnfreezeAllContextMenuItem.Visible = Global.CheatList.ActiveCount > 0;

            ViewInHexEditorContextMenuItem.Visible = SelectedWatches.Count() == 1;

            newToolStripMenuItem.Visible = indexes.Count == 0;
        }
Exemplo n.º 5
0
        private void PokeAddressMenuItem_Click(object sender, EventArgs e)
        {
            if (SelectedWatches.Any())
            {
                var poke = new RamPoke
                {
                    InitialLocation = this.ChildPointToScreen(WatchListView)
                };

                poke.SetWatch(SelectedWatches);

                if (poke.ShowHawkDialog(this) == DialogResult.OK)
                {
                    UpdateValues();
                }
            }
        }
Exemplo n.º 6
0
        private void EditWatch(bool duplicate = false)
        {
            var indexes = SelectedIndices.ToList();

            if (SelectedWatches.Any())
            {
                foreach (var sw in SelectedWatches)
                {
                    if (sw.Domain != SelectedWatches.First().Domain)
                    {
                        throw new InvalidOperationException("Can't edit multiple watches on varying memorydomains");
                    }
                }

                var we = new WatchEditor
                {
                    InitialLocation = this.ChildPointToScreen(WatchListView),
                    MemoryDomains   = _memoryDomains
                };

                we.SetWatch(SelectedWatches.First().Domain, SelectedWatches, duplicate ? WatchEditor.Mode.Duplicate : WatchEditor.Mode.Edit);

                var result = we.ShowHawkDialog(this);
                if (result == DialogResult.OK)
                {
                    Changes();
                    if (duplicate)
                    {
                        _watches.AddRange(we.Watches);
                        WatchListView.ItemCount = _watches.Count;
                    }
                    else
                    {
                        for (var i = 0; i < we.Watches.Count; i++)
                        {
                            _watches[indexes[i]] = we.Watches[i];
                        }
                    }
                }

                UpdateValues();
            }
        }
Exemplo n.º 7
0
        private void EditWatch(bool duplicate = false)
        {
            var indexes = SelectedIndices.ToList();

            if (SelectedWatches.Any())
            {
                foreach (var sw in SelectedWatches)
                {
                    if (sw.Domain != SelectedWatches.First().Domain)
                    {
                        throw new InvalidOperationException("Can't edit multiple watches on varying memory domains");
                    }
                }

                var we = new WatchEditor
                {
                    InitialLocation = this.ChildPointToScreen(WatchListView),
                    MemoryDomains   = MemoryDomains
                };

                we.SetWatch(SelectedWatches.First().Domain, SelectedWatches, duplicate ? WatchEditor.Mode.Duplicate : WatchEditor.Mode.Edit);

                var result = we.ShowHawkDialog(this);
                if (result == DialogResult.OK)
                {
                    Changes();
                    if (duplicate)
                    {
                        _watches.AddRange(we.Watches);
                        WatchListView.ItemCount = _watches.Count;
                        UpdateWatchCount();
                    }
                    else
                    {
                        for (var i = 0; i < we.Watches.Count; i++)
                        {
                            _watches[indexes[i]] = we.Watches[i];
                        }
                    }
                }

                UpdateValues();
            }
            else if (SelectedSeparators.Any() && !duplicate)
            {
                var inputPrompt = new InputPrompt
                {
                    Text          = "Edit Separator",
                    StartLocation = this.ChildPointToScreen(WatchListView),
                    Message       = "Separator Text:",
                    TextInputType = InputPrompt.InputType.Text
                };

                var result = inputPrompt.ShowHawkDialog();

                if (result == DialogResult.OK)
                {
                    Changes();

                    for (int i = 0; i < SelectedSeparators.Count(); i++)
                    {
                        var sep = SelectedSeparators.ToList()[i];
                        sep.Notes            = inputPrompt.PromptText;
                        _watches[indexes[i]] = sep;
                    }
                }

                UpdateValues();
            }
        }