Exemple #1
0
        public void loadEntry(object sender, EventArgs e)
        {
            int srcEntry   = 0;
            int entryAddr2 = entryAddr;

            if (sender != null)
            {
                ListView lv = ((ListView)sender);
                if (lv.SelectedIndices.Count != 1)
                {
                    return;
                }
                srcEntry   = sl.sItems[lv.SelectedIndices[0]];              //sortList[lv.SelectedIndices[0]];
                entryAddr2 = baseAddr + srcEntry * entryLen;

                //I want copy/paste entire entries functionality! Yay!
                if (entryAddr != 0)                 //Ensuring that there is an item to copy. Also prevents CtrL+Shift form load bug because an item is selected on form load.
                {
                    if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                    {
                        if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                        {
                            for (int i = 0; i < entryLen; i++)
                            {
                                buf[entryAddr2 + i] = buf[entryAddr + i];
                            }
                        }
                    }
                }
                if (entryLen != 0)                 // Entry length is "0" for text editor at present.
                {
                    cntAddr.Text = (0x8000000 | entryAddr2).ToString("X8");
                }
            }
            else
            {
                entryAddr = baseAddr;
            }
            //int ind = ((ListBox)pnl.Controls[0]).SelectedIndex;
            //int addr = 0xEDACC + ind * 0x1C;
            //pnl.Controls[1].Text = (0x8000000 | addr).ToString("X8");
            for (int i = 0; i < nuds.Count; i++)
            {
                nuds[i].addr  = nuds[i].addr - entryAddr + entryAddr2;
                nuds[i].Value = Bits.getBits(nuds[i].buf, nuds[i].addr, nuds[i].bits);                 //nuds[i].getData();
            }
            for (int i = 0; i < butls.Count; i++)
            {
                butls[i].addr = butls[i].addr - entryAddr + entryAddr2;
                butls[i].Text = Bits.getTextShort(butls[i].txt, butls[i].items[Bits.getBits(butls[i].buf, butls[i].addr, butls[i].bits)]);
                //butls[i].itemsL[Bits.getBits(butls[i].buf, butls[i].addr, butls[i].bits)].ToString();
                //butls[i].Text = Bits.getTextLong(txt, Bits.getBits(butls[i].buf, butls[i].addr, butls[i].bits));
            }
            for (int i = 0; i < dtbs.Count; i++)
            {
                dtbs[i].theIndex = dtbs[i].baseIndex + srcEntry;
                dtbs[i].tbx.Text = Bits.getTextLong(dtbs[i].txt, dtbs[i].theIndex);
            }
            entryAddr = entryAddr2;
            //for (int i = 0; i < ctrls.Count; i++)
            //{
            //	if (ctrls[i].GetType() == typeof(ComboBox))
            //	{
            //		((ComboBox)ctrls[i]).SelectedIndex = Bits.getBits(buf, entryAddr + offsets[i], bits[i]);
            //	}
            //	if (ctrls[i].GetType() == typeof(ButtonL))
            //	{
            //		((ButtonL)ctrls[i]).Text = itemsL[i][Bits.getBits(buf, entryAddr + offsets[i], bits[i])].ToString();
            //	}
            //	if (ctrls[i].GetType() == typeof(TextBox))
            //	{
            //		((TextBox)ctrls[i]).Text = Bits.getTextLong(txt, theIndex + srcEntry);
            //	}
            //}
        }