Exemplo n.º 1
0
        private void PopulateTypeDropdown()
        {
            DisplayTypeDropDown.Items.Clear();
            switch (SizeDropDown.SelectedIndex)
            {
            default:
            case 0:
                foreach (DisplayType t in ByteWatch.ValidTypes)
                {
                    DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
                }

                break;

            case 1:
                foreach (DisplayType t in WordWatch.ValidTypes)
                {
                    DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
                }

                break;

            case 2:
                foreach (DisplayType t in DWordWatch.ValidTypes)
                {
                    DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
                }

                break;
            }

            DisplayTypeDropDown.SelectedItem = DisplayTypeDropDown.Items[0];
        }
Exemplo n.º 2
0
        private void SetDisplayTypes()
        {
            string oldType = DisplayTypeDropDown.Text;

            DisplayTypeDropDown.Items.Clear();
            switch (SizeDropDown.SelectedIndex)
            {
            default:
            case 0:
                foreach (DisplayType t in ByteWatch.ValidTypes)
                {
                    DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
                }
                break;

            case 1:
                foreach (DisplayType t in WordWatch.ValidTypes)
                {
                    DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
                }
                break;

            case 2:
                foreach (DisplayType t in DWordWatch.ValidTypes)
                {
                    DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
                }
                break;
            }

            DisplayTypeDropDown.SelectedItem = DisplayTypeDropDown.Items.Contains(oldType)
                                ? oldType
                                : DisplayTypeDropDown.Items[0];
        }
Exemplo n.º 3
0
		private void HardSetDisplayTypeDropDown(Common.DisplayType type)
		{
			foreach (var item in DisplayTypeDropdown.Items)
			{
				if (Watch.DisplayTypeToString(type) == item.ToString())
				{
					DisplayTypeDropdown.SelectedItem = item;
				}
			}
		}
Exemplo n.º 4
0
        private void RamPoke_Load(object sender, EventArgs e)
        {
            _watchList = _watchList.Where(x => !x.IsSeparator).ToList();             // Weed out separators just in case

            if (_watchList.Count == 0)
            {
                ValueBox.Enabled = false;
                return;
            }

            if (InitialLocation.X > 0 || InitialLocation.Y > 0)
            {
                Location = InitialLocation;
            }

            if (_watchList.Count > 1)
            {
                bool hasMixedSizes  = _watchList.Select(x => x.Size).Distinct().Count() > 1;
                bool hasMixedTypes  = _watchList.Select(x => x.Type).Distinct().Count() > 1;
                bool hasMixedEndian = _watchList.Select(x => x.BigEndian).Distinct().Count() > 1;

                if (hasMixedSizes || hasMixedTypes || hasMixedEndian)
                {
                    UnSupportedConfiguration();
                }
            }

            AddressBox.SetHexProperties(_watchList[0].Domain.Size);
            if (_watchList.Count < 10)             // Hack in case an asburd amount of addresses is picked, this can get slow and create a too long string
            {
                AddressBox.Text = _watchList
                                  .Select(a => a.AddressString)
                                  .Distinct()
                                  .Aggregate((addrStr, nextStr) => addrStr + ("," + nextStr));
            }
            else
            {
                AddressBox.Text = _watchList
                                  .Take(10)
                                  .Select(a => a.AddressString)
                                  .Distinct()
                                  .Aggregate((addrStr, nextStr) => addrStr + ("," + nextStr));
            }

            ValueBox.ByteSize = _watchList[0].Size;
            ValueBox.Type     = _watchList[0].Type;

            ValueHexLabel.Text    = _watchList[0].Type == DisplayType.Hex ? "0x" : string.Empty;
            ValueBox.Text         = _watchList[0].ValueString.Replace(" ", string.Empty);
            DomainLabel.Text      = _watchList[0].Domain.Name;
            SizeLabel.Text        = _watchList[0].Size.ToString();
            DisplayTypeLabel.Text = Watch.DisplayTypeToString(_watchList[0].Type);
            BigEndianLabel.Text   = _watchList[0].BigEndian ? "Big Endian" : "Little Endian";
            SetTitle();
        }
Exemplo n.º 5
0
 private void SetTypeSelected(Common.DisplayType type)
 {
     foreach (var item in DisplayTypeDropDown.Items)
     {
         if (item.ToString() == Watch.DisplayTypeToString(type))
         {
             DisplayTypeDropDown.SelectedItem = item;
             return;
         }
     }
 }
Exemplo n.º 6
0
        private void CheatListView_QueryItemText(int index, int column, out string text)
        {
            text = string.Empty;
            if (index >= Global.CheatList.Count || Global.CheatList[index].IsSeparator)
            {
                return;
            }

            var columnName = CheatListView.Columns[column].Name;

            switch (columnName)
            {
            case NAME:
                text = Global.CheatList[index].Name;
                break;

            case ADDRESS:
                text = Global.CheatList[index].AddressStr;
                break;

            case VALUE:
                text = Global.CheatList[index].ValueStr;
                break;

            case COMPARE:
                text = Global.CheatList[index].CompareStr;
                break;

            case ON:
                text = Global.CheatList[index].Enabled ? "*" : string.Empty;
                break;

            case DOMAIN:
                text = Global.CheatList[index].Domain.Name;
                break;

            case SIZE:
                text = Global.CheatList[index].Size.ToString();
                break;

            case ENDIAN:
                text = (Global.CheatList[index].BigEndian ?? false) ? "Big" : "Little";
                break;

            case TYPE:
                text = Watch.DisplayTypeToString(Global.CheatList[index].Type);
                break;
            }
        }
Exemplo n.º 7
0
        private void RamPoke_Load(object sender, EventArgs e)
        {
            if (_watchList.Count == 0)
            {
                ValueBox.Enabled = false;
                return;
            }

            if (InitialLocation.X > 0 || InitialLocation.Y > 0)
            {
                Location = InitialLocation;
            }

            if (_watchList.Count > 1)
            {
                bool hasMixedSizes  = _watchList.Select(x => x.Size).Distinct().Count() > 1;
                bool hasMixedTypes  = _watchList.Select(x => x.Type).Distinct().Count() > 1;
                bool hasMixedEndian = _watchList.Select(x => x.BigEndian).Distinct().Count() > 1;

                if (hasMixedSizes || hasMixedTypes || hasMixedEndian)
                {
                    UnSupportedConfiguration();
                }
            }

            AddressBox.SetHexProperties(_watchList[0].Domain.Size);
            AddressBox.Text = (_watchList.Count > 10 ? _watchList.Take(10) : _watchList)             // Hack in case an absurd amount of addresses are picked, this can be slow and create too long of a string
                              .Select(a => a.AddressString)
                              .Distinct()
                              .Aggregate((addrStr, nextStr) => $"{addrStr},{nextStr}");

            ValueBox.ByteSize = _watchList[0].Size;
            ValueBox.Type     = _watchList[0].Type;

            ValueHexLabel.Text    = _watchList[0].Type == WatchDisplayType.Hex ? "0x" : "";
            ValueBox.Text         = _watchList[0].ValueString.Replace(" ", "");
            DomainLabel.Text      = _watchList[0].Domain.Name;
            SizeLabel.Text        = _watchList[0].Size.ToString();
            DisplayTypeLabel.Text = Watch.DisplayTypeToString(_watchList[0].Type);
            BigEndianLabel.Text   = _watchList[0].BigEndian ? "Big Endian" : "Little Endian";
            SetTitle();
        }
Exemplo n.º 8
0
        private void CheatListView_QueryItemText(int index, RollColumn column, out string text, ref int offsetX, ref int offsetY)
        {
            text = "";
            if (index >= MainForm.CheatList.Count || MainForm.CheatList[index].IsSeparator)
            {
                return;
            }

            var columnName = column.Name;

            switch (columnName)
            {
            case NameColumn:
                text = MainForm.CheatList[index].Name;
                break;

            case AddressColumn:
                text = MainForm.CheatList[index].AddressStr;
                break;

            case ValueColumn:
                text = MainForm.CheatList[index].ValueStr;
                break;

            case CompareColumn:
                text = MainForm.CheatList[index].CompareStr;
                break;

            case OnColumn:
                text = MainForm.CheatList[index].Enabled ? "*" : "";
                break;

            case DomainColumn:
                text = MainForm.CheatList[index].Domain.Name;
                break;

            case SizeColumn:
                text = MainForm.CheatList[index].Size.ToString();
                break;

            case EndianColumn:
                text = (MainForm.CheatList[index].BigEndian ?? false) ? "Big" : "Little";
                break;

            case TypeColumn:
                text = Watch.DisplayTypeToString(MainForm.CheatList[index].Type);
                break;

            case ComparisonTypeColumn:
                text = MainForm.CheatList[index].ComparisonType switch
                {
                    Cheat.CompareType.None => "",
                    Cheat.CompareType.Equal => "=",
                    Cheat.CompareType.GreaterThan => ">",
                    Cheat.CompareType.GreaterThanOrEqual => ">=",
                    Cheat.CompareType.LessThan => "<",
                    Cheat.CompareType.LessThanOrEqual => "<=",
                    Cheat.CompareType.NotEqual => "!=",
                    _ => ""
                };

                break;
            }
        }
Exemplo n.º 9
0
        private void RamWatchNewWatch_Load(object sender, EventArgs e)
        {
            if (InitialLocation.X > 0 || InitialLocation.Y > 0)
            {
                Location = InitialLocation;
            }
            _loading = false;
            SetAddressBoxProperties();

            switch (_mode)
            {
            default:
            case Mode.New:
                SizeDropDown.SelectedItem = SizeDropDown.Items[0];
                break;

            case Mode.Duplicate:
            case Mode.Edit:
                switch (_watchList[0].Size)
                {
                case Watch.WatchSize.Byte:
                    SizeDropDown.SelectedItem = SizeDropDown.Items[0];
                    break;

                case Watch.WatchSize.Word:
                    SizeDropDown.SelectedItem = SizeDropDown.Items[1];
                    break;

                case Watch.WatchSize.DWord:
                    SizeDropDown.SelectedItem = SizeDropDown.Items[2];
                    break;
                }

                var index = DisplayTypeDropDown.Items.IndexOf(Watch.DisplayTypeToString(_watchList[0].Type));
                DisplayTypeDropDown.SelectedItem = DisplayTypeDropDown.Items[index];

                if (_watchList.Count > 1)
                {
                    NotesBox.Enabled = false;
                    NotesBox.Text    = String.Empty;

                    AddressBox.Enabled = false;
                    AddressBox.Text    = _watchList.Select(a => a.AddressString).Aggregate((addrStr, nextStr) => addrStr + ("," + nextStr));

                    BigEndianCheckBox.ThreeState = true;

                    if (_watchList.Select(s => s.Size).Distinct().Count() > 1)
                    {
                        DisplayTypeDropDown.Enabled = false;
                    }
                }
                else
                {
                    NotesBox.Text = _watchList[0].Notes;
                    AddressBox.SetFromRawInt(_watchList[0].Address ?? 0);
                }

                SetBigEndianCheckBox();
                DomainDropDown.Enabled = false;
                break;
            }
        }
Exemplo n.º 10
0
        private void SetDisplayTypes()
        {
            DisplayTypeDropDown.Items.Clear();
            switch (SizeDropDown.SelectedIndex)
            {
            default:
            case 0:
                DisplayTypeDropDown.Items.AddRange(ByteWatch.ValidTypes.ConvertAll(e => Watch.DisplayTypeToString(e)).ToArray());
                break;

            case 1:
                DisplayTypeDropDown.Items.AddRange(WordWatch.ValidTypes.ConvertAll(e => Watch.DisplayTypeToString(e)).ToArray());
                break;

            case 2:
                DisplayTypeDropDown.Items.AddRange(DWordWatch.ValidTypes.ConvertAll(e => Watch.DisplayTypeToString(e)).ToArray());
                break;
            }

            DisplayTypeDropDown.SelectedItem = DisplayTypeDropDown.Items[0];
        }
Exemplo n.º 11
0
        private void CheatListView_QueryItemText(int index, InputRoll.RollColumn column, out string text, ref int offsetX, ref int offsetY)
        {
            text = "";
            if (index >= Global.CheatList.Count || Global.CheatList[index].IsSeparator)
            {
                return;
            }

            var columnName = column.Name;

            switch (columnName)
            {
            case NameColumn:
                text = Global.CheatList[index].Name;
                break;

            case AddressColumn:
                text = Global.CheatList[index].AddressStr;
                break;

            case ValueColumn:
                text = Global.CheatList[index].ValueStr;
                break;

            case CompareColumn:
                text = Global.CheatList[index].CompareStr;
                break;

            case OnColumn:
                text = Global.CheatList[index].Enabled ? "*" : "";
                break;

            case DomainColumn:
                text = Global.CheatList[index].Domain.Name;
                break;

            case SizeColumn:
                text = Global.CheatList[index].Size.ToString();
                break;

            case EndianColumn:
                text = (Global.CheatList[index].BigEndian ?? false) ? "Big" : "Little";
                break;

            case TypeColumn:
                text = Watch.DisplayTypeToString(Global.CheatList[index].Type);
                break;

            case ComparisonTypeColumn:
                switch (Global.CheatList[index].ComparisonType)
                {
                case Cheat.CompareType.None:
                    text = "";
                    break;

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

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

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

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

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

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

                default:
                    text = "";
                    break;
                }

                break;
            }
        }
        private void RamWatchNewWatch_Load(object sender, EventArgs e)
        {
            if (InitialLocation.X > 0 || InitialLocation.Y > 0)
            {
                Location = InitialLocation;
            }

            _loading = false;
            SetAddressBoxProperties();

            switch (_mode)
            {
            default:
            case Mode.New:
                SizeDropDown.SelectedItem = MemoryDomains.First().WordSize switch
                {
                    1 => SizeDropDown.Items[0],
                    2 => SizeDropDown.Items[1],
                    4 => SizeDropDown.Items[2],
                    _ => SizeDropDown.Items[0]
                };
                break;

            case Mode.Duplicate:
            case Mode.Edit:
                SizeDropDown.SelectedItem = Watches[0].Size switch
                {
                    WatchSize.Byte => SizeDropDown.Items[0],
                    WatchSize.Word => SizeDropDown.Items[1],
                    WatchSize.DWord => SizeDropDown.Items[2],
                    _ => SizeDropDown.SelectedItem
                };

                var index = DisplayTypeDropDown.Items.IndexOf(Watch.DisplayTypeToString(Watches[0].Type));
                DisplayTypeDropDown.SelectedItem = DisplayTypeDropDown.Items[index];

                if (Watches.Count > 1)
                {
                    NotesBox.Enabled = false;
                    NotesBox.Text    = "";

                    AddressBox.Enabled = false;
                    AddressBox.Text    = Watches.Select(a => a.AddressString).Aggregate((addrStr, nextStr) => $"{addrStr},{nextStr}");

                    BigEndianCheckBox.ThreeState = true;

                    if (Watches.Select(s => s.Size).Distinct().Count() > 1)
                    {
                        DisplayTypeDropDown.Enabled = false;
                    }
                }
                else
                {
                    NotesBox.Text = Watches[0].Notes;
                    AddressBox.SetFromLong(Watches[0].Address);
                }

                SetBigEndianCheckBox();
                DomainDropDown.Enabled = false;
                break;
            }
        }