private void DoEdit()
        {
            if (Watches.Count == 1)
            {
                Watches[0].Notes = NotesBox.Text;
            }

            if (_changedSize)
            {
                for (var i = 0; i < Watches.Count; i++)
                {
                    var size = SizeDropDown.SelectedIndex switch
                    {
                        1 => WatchSize.Word,
                        2 => WatchSize.DWord,
                        _ => WatchSize.Byte
                    };

                    var displayType = Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString());

                    Watches[i] = Watch.GenerateWatch(
                        Watches[i].Domain,
                        Watches.Count == 1 ? AddressBox.ToRawInt() ?? 0 : Watches[i].Address,
                        size,
                        _changedDisplayType ? displayType : Watches[i].Type,
                        Watches[i].BigEndian,
                        Watches[i].Notes);
                }
            }

            if (BigEndianCheckBox.CheckState != CheckState.Indeterminate)
            {
                Watches.ForEach(x => x.BigEndian = BigEndianCheckBox.Checked);
            }
        }
Esempio n. 2
0
		private void DisplayTypeDropdown_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (!_dropdownDontfire)
			{
				DoDisplayTypeClick(Watch.StringToDisplayType(DisplayTypeDropdown.SelectedItem.ToString()));
			}
		}
Esempio n. 3
0
        private void Ok_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;

            switch (_mode)
            {
            default:
            case Mode.New:
                var domain    = Global.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString());
                var address   = AddressBox.ToRawInt() ?? 0;
                var notes     = NotesBox.Text;
                var type      = Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString());
                var bigendian = BigEndianCheckBox.Checked;
                switch (SizeDropDown.SelectedIndex)
                {
                case 0:
                    _watchList.Add(new ByteWatch(domain, address, type, bigendian, notes));
                    break;

                case 1:
                    _watchList.Add(new WordWatch(domain, address, type, bigendian, notes));
                    break;

                case 2:
                    _watchList.Add(new DWordWatch(domain, address, type, bigendian, notes));
                    break;
                }

                break;

            case Mode.Edit:
                DoEdit();
                break;

            case Mode.Duplicate:
                var tempWatchList = new List <Watch>();
                tempWatchList.AddRange(_watchList);
                _watchList.Clear();
                foreach (var watch in tempWatchList)
                {
                    _watchList.Add(Watch.GenerateWatch(
                                       watch.Domain,
                                       watch.Address ?? 0,
                                       watch.Size,
                                       watch.Type,
                                       watch.Notes,
                                       watch.BigEndian));
                }

                DoEdit();
                break;
            }

            Close();
        }
Esempio n. 4
0
        public Cheat GetCheat()
        {
            Cheat.COMPARISONTYPE comparisonType = Cheat.COMPARISONTYPE.NONE;
            var domain  = MemoryDomains[DomainDropDown.SelectedItem.ToString()];
            var address = AddressBox.ToRawInt().Value;

            if (address < domain.Size)
            {
                var watch = Watch.GenerateWatch(
                    MemoryDomains[DomainDropDown.SelectedItem.ToString()],
                    AddressBox.ToRawInt().Value,
                    GetCurrentSize(),
                    Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()),
                    BigEndianCheckBox.Checked,
                    NameBox.Text
                    );

                switch (CompareTypeDropDown.SelectedItem.ToString())
                {
                case "": comparisonType = Cheat.COMPARISONTYPE.NONE; break;

                case "=": comparisonType = Cheat.COMPARISONTYPE.EQUAL; break;

                case ">": comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN; break;

                case ">=": comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN_OR_EQUAL; break;

                case "<": comparisonType = Cheat.COMPARISONTYPE.LESS_THAN; break;

                case "<=": comparisonType = Cheat.COMPARISONTYPE.LESS_THAN_OR_EQUAL; break;

                case "!=": comparisonType = Cheat.COMPARISONTYPE.NOT_EQUAL; break;

                default: comparisonType = Cheat.COMPARISONTYPE.NONE; break;
                }

                int?c = CompareBox.ToRawInt() == null ? null : (int?)CompareBox.ToRawInt().Value;


                return(new Cheat(
                           watch,
                           ValueBox.ToRawInt().Value,
                           CompareBox.ToRawInt() == null ? null : (int?)CompareBox.ToRawInt().Value,
                           true,
                           comparisonType
                           ));
            }
            else
            {
                MessageBox.Show(address.ToString() + " is not a valid address for the domain " + domain.Name, "Index out of range", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(Cheat.Separator);
            }
        }
Esempio n. 5
0
        private void DoEdit()
        {
            if (_watchList.Count == 1)
            {
                _watchList[0].Notes = NotesBox.Text;
            }

            if (_changedSize)
            {
                for (var i = 0; i < _watchList.Count; i++)
                {
                    var size = Watch.WatchSize.Byte;
                    switch (SizeDropDown.SelectedIndex)
                    {
                    case 0:
                        size = Watch.WatchSize.Byte;
                        break;

                    case 1:
                        size = Watch.WatchSize.Word;
                        break;

                    case 2:
                        size = Watch.WatchSize.DWord;
                        break;
                    }

                    _watchList[i] = Watch.GenerateWatch(
                        _watchList[i].Domain,
                        _watchList.Count == 1 ? AddressBox.ToRawInt() ?? 0 : _watchList[i].Address ?? 0,
                        size,
                        _watchList[i].Type,
                        _watchList[i].Notes,
                        _watchList[i].BigEndian
                        );
                }
            }

            if (_changedDisplayType)
            {
                _watchList.ForEach(x => x.Type = Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()));
            }

            if (BigEndianCheckBox.CheckState != CheckState.Indeterminate)
            {
                _watchList.ForEach(x => x.BigEndian = BigEndianCheckBox.Checked);
            }
        }
Esempio n. 6
0
        public Cheat GetCheat()
        {
            var domain  = MemoryDomains[DomainDropDown.SelectedItem.ToString()] !;
            var address = AddressBox.ToRawInt().Value;

            if (address < domain.Size)
            {
                var watch = Watch.GenerateWatch(
                    MemoryDomains[DomainDropDown.SelectedItem.ToString()],
                    AddressBox.ToRawInt().Value,
                    GetCurrentSize(),
                    Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()),
                    BigEndianCheckBox.Checked,
                    NameBox.Text);

                var comparisonType = CompareTypeDropDown.SelectedItem.ToString() switch
                {
                    "" => Cheat.CompareType.None,
                    "=" => Cheat.CompareType.Equal,
                    ">" => Cheat.CompareType.GreaterThan,
                    ">=" => Cheat.CompareType.GreaterThanOrEqual,
                    "<" => Cheat.CompareType.LessThan,
                    "<=" => Cheat.CompareType.LessThanOrEqual,
                    "!=" => Cheat.CompareType.NotEqual,
                    _ => Cheat.CompareType.None
                };

                return(new Cheat(
                           watch,
                           ValueBox.ToRawInt().Value,
                           CompareBox.ToRawInt() == null ? null : (int?)CompareBox.ToRawInt().Value,
                           true,
                           comparisonType));
            }

            MessageBox.Show($"{address} is not a valid address for the domain {domain.Name}", "Index out of range", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            return(Cheat.Separator);
        }
Esempio n. 7
0
 private void DisplayTypeDropDown_SelectedIndexChanged(object sender, EventArgs e)
 {
     ValueBox.Type       =
         CompareBox.Type =
             Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString());
 }
Esempio n. 8
0
        public Cheat GetCheat()
        {
            var domain  = MemoryDomains[DomainDropDown.SelectedItem.ToString()];
            var address = AddressBox.ToRawInt().Value;

            if (address < domain.Size)
            {
                var watch = Watch.GenerateWatch(
                    MemoryDomains[DomainDropDown.SelectedItem.ToString()],
                    AddressBox.ToRawInt().Value,
                    GetCurrentSize(),
                    Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()),
                    BigEndianCheckBox.Checked,
                    NameBox.Text);

                Cheat.CompareType comparisonType;
                switch (CompareTypeDropDown.SelectedItem.ToString())
                {
                case "":
                    comparisonType = Cheat.CompareType.None;
                    break;

                case "=":
                    comparisonType = Cheat.CompareType.Equal;
                    break;

                case ">":
                    comparisonType = Cheat.CompareType.GreaterThan;
                    break;

                case ">=":
                    comparisonType = Cheat.CompareType.GreaterThanOrEqual;
                    break;

                case "<":
                    comparisonType = Cheat.CompareType.LessThan;
                    break;

                case "<=":
                    comparisonType = Cheat.CompareType.LessThanOrEqual;
                    break;

                case "!=":
                    comparisonType = Cheat.CompareType.NotEqual;
                    break;

                default:
                    comparisonType = Cheat.CompareType.None;
                    break;
                }

                return(new Cheat(
                           watch,
                           ValueBox.ToRawInt().Value,
                           CompareBox.ToRawInt() == null ? null : (int?)CompareBox.ToRawInt().Value,
                           true,
                           comparisonType));
            }
            else
            {
                MessageBox.Show(address + " is not a valid address for the domain " + domain.Name, "Index out of range", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(Cheat.Separator);
            }
        }