コード例 #1
0
ファイル: HarshAutoStep.cs プロジェクト: vhanla/DiztinGUIsh
        private void UpdateText(TextBox selected)
        {
            Util.NumberBase noBase = radioDec.Checked ? Util.NumberBase.Decimal : Util.NumberBase.Hexadecimal;
            int             digits = noBase == Util.NumberBase.Hexadecimal && radioROM.Checked ? 6 : 0;
            int             size   = Data.GetROMSize();

            if (start < 0)
            {
                start = 0;
            }
            if (end >= size)
            {
                end = size - 1;
            }
            count = end - start;
            if (count < 0)
            {
                count = 0;
            }

            updatingText = true;
            if (selected != textStart)
            {
                textStart.Text = Util.NumberToBaseString(radioROM.Checked ? Util.ConvertPCtoSNES(start) : start, noBase, digits);
            }
            if (selected != textEnd)
            {
                textEnd.Text = Util.NumberToBaseString(radioROM.Checked ? Util.ConvertPCtoSNES(end) : end, noBase, digits);
            }
            if (selected != textCount)
            {
                textCount.Text = Util.NumberToBaseString(count, noBase, 0);
            }
            updatingText = false;
        }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: gocha/DiztinGUIsh
 private void UpdateBase(Util.NumberBase noBase)
 {
     DisplayBase = noBase;
     decimalToolStripMenuItem.Checked     = noBase == Util.NumberBase.Decimal;
     hexadecimalToolStripMenuItem.Checked = noBase == Util.NumberBase.Hexadecimal;
     binaryToolStripMenuItem.Checked      = noBase == Util.NumberBase.Binary;
     InvalidateTable();
 }
コード例 #3
0
        private void UpdateText(TextBox selected)
        {
            Util.NumberBase noBase   = radioDec.Checked ? Util.NumberBase.Decimal : Util.NumberBase.Hexadecimal;
            int             digits   = noBase == Util.NumberBase.Hexadecimal && radioROM.Checked ? 6 : 0;
            int             size     = data.GetRomSize();
            int             maxValue = property.SelectedIndex == 1 ? 0x100 : 0x10000;

            if (Start < 0)
            {
                Start = 0;
            }
            if (End >= size)
            {
                End = size - 1;
            }
            Count = End - Start;
            if (Count < 0)
            {
                Count = 0;
            }
            if (value < 0)
            {
                value = 0;
            }
            if (value >= maxValue)
            {
                value = maxValue - 1;
            }

            updatingText = true;
            if (selected != textStart)
            {
                textStart.Text = Util.NumberToBaseString(radioROM.Checked ? data.ConvertPCtoSnes(Start) : Start, noBase, digits);
            }
            if (selected != textEnd)
            {
                textEnd.Text = Util.NumberToBaseString(radioROM.Checked ? data.ConvertPCtoSnes(End) : End, noBase, digits);
            }
            if (selected != textCount)
            {
                textCount.Text = Util.NumberToBaseString(Count, noBase, 0);
            }
            if (selected != regValue)
            {
                regValue.Text = Util.NumberToBaseString(value, noBase, 0);
            }
            updatingText = false;
        }
コード例 #4
0
        private void textPC_TextChanged(object sender, EventArgs e)
        {
            if (!updatingText)
            {
                updatingText = true;

                NumberStyles    style  = radioDec.Checked ? NumberStyles.Number : NumberStyles.HexNumber;
                Util.NumberBase noBase = radioDec.Checked ? Util.NumberBase.Decimal : Util.NumberBase.Hexadecimal;
                if (int.TryParse(textPC.Text, style, null, out int offset))
                {
                    int addr = Util.ConvertPCtoSNES(offset);
                    if (addr >= 0)
                    {
                        textROM.Text = Util.NumberToBaseString(addr, noBase, 6);
                    }
                }
                updatingText = false;
            }
        }
コード例 #5
0
        private void textROM_TextChanged(object sender, EventArgs e)
        {
            if (!updatingText)
            {
                updatingText = true;

                NumberStyles    style  = radioDec.Checked ? NumberStyles.Number : NumberStyles.HexNumber;
                Util.NumberBase noBase = radioDec.Checked ? Util.NumberBase.Decimal : Util.NumberBase.Hexadecimal;
                if (int.TryParse(textROM.Text, style, null, out int address))
                {
                    int pc = Util.ConvertSNEStoPC(address);
                    if (pc >= 0 && pc < Data.GetROMSize())
                    {
                        textPC.Text = Util.NumberToBaseString(pc, noBase, 0);
                    }
                }
                updatingText = false;
            }
        }