void AddHack() { frmAdd FA = new frmAdd(); FA.Text = "新增(Add)"; DialogResult DR = FA.ShowDialog(); if (DR == DialogResult.OK) { switch (FA.MSTAB.SelectedIndex) { case 0: HackType SetHT; switch (FA.comType.SelectedIndex) { case 0: SetHT = HackType._Byte; break; case 1: SetHT = HackType._2Bytes; break; default: SetHT = HackType._4Bytes; break; } AddHackList(-1, HackListView, FA.txtName.Text, Convert.ToInt32(FA.txtAddress.Text, 16), SetHT, "", 0); break; case 1: AddHackList(-1, HackListView, FA.txtName.Text, Convert.ToInt32(FA.txtAOP.Text, 16), HackType._Pointer, "", Convert.ToInt32(FA.txtOffset.Text, 16)); break; default: AddHackList(-1, HackListView, FA.txtName.Text, 0, HackType.AssemblyScript, FA.txtASM.Text, 0); break; } } }
void EditHack() { if (HackListView.SelectedItems.Count == 0) return; if (HackListView.SelectedItems[0].Checked) { MessageBox.Show("這個項目正在使用,請先取消打勾\nThe item is enabled. Please unlock the item first."); return; } frmAdd FA = new frmAdd(); FA.Text = "編輯(Edit)"; switch (HackListView.SelectedItems[0].SubItems[2].Text) { case "Auto Assemble Script": FA.MSTAB.SelectedIndex = 2; FA.txtASM.Text = HackListView.SelectedItems[0].SubItems[3].Text; break; case "4bytes Pointer": FA.MSTAB.SelectedIndex = 1; string PointerStr = HackListView.SelectedItems[0].SubItems[1].Text; FA.txtAOP.Text = PointerStr.Substring(2, 8); FA.txtOffset.Text = PointerStr.Substring(12, 4); break; default: FA.MSTAB.SelectedIndex = 0; switch (HackListView.SelectedItems[0].SubItems[2].Text) { case "_Byte": FA.comType.SelectedIndex = 0; break; case "_2Bytes": FA.comType.SelectedIndex = 1; break; default: FA.comType.SelectedIndex = 2; break; } FA.txtAddress.Text = HackListView.SelectedItems[0].SubItems[1].Text; break; } FA.txtName.Text = HackListView.SelectedItems[0].SubItems[0].Text; DialogResult DR = FA.ShowDialog(); if (DR == DialogResult.OK) { switch (FA.MSTAB.SelectedIndex) { case 0: HackType SetHT; switch (FA.comType.SelectedIndex) { case 0: SetHT = HackType._Byte; break; case 1: SetHT = HackType._2Bytes; break; default: SetHT = HackType._4Bytes; break; } AddHackList(HackListView.SelectedItems[0].Index, HackListView, FA.txtName.Text, Convert.ToInt32(FA.txtAddress.Text, 16), SetHT, "", 0); break; case 1: AddHackList(HackListView.SelectedItems[0].Index, HackListView, FA.txtName.Text, Convert.ToInt32(FA.txtAOP.Text, 16), HackType._Pointer, "", Convert.ToInt32(FA.txtOffset.Text, 16)); break; default: AddHackList(HackListView.SelectedItems[0].Index, HackListView, FA.txtName.Text, 0, HackType.AssemblyScript, FA.txtASM.Text, 0); break; } HackListView.SelectedItems[0].Remove(); } }
void EditHack() { if (HackListView.SelectedItems.Count == 0) { return; } if (HackListView.SelectedItems[0].Checked) { MessageBox.Show("這個項目正在使用,請先取消打勾\nThe item is enabled. Please unlock the item first."); return; } frmAdd FA = new frmAdd(); FA.Text = "編輯(Edit)"; switch (HackListView.SelectedItems[0].SubItems[2].Text) { case "Auto Assemble Script": FA.MSTAB.SelectedIndex = 2; FA.txtASM.Text = HackListView.SelectedItems[0].SubItems[3].Text; break; case "4bytes Pointer": FA.MSTAB.SelectedIndex = 1; string PointerStr = HackListView.SelectedItems[0].SubItems[1].Text; FA.txtAOP.Text = PointerStr.Substring(2, 8); FA.txtOffset.Text = PointerStr.Substring(12, 4); break; default: FA.MSTAB.SelectedIndex = 0; switch (HackListView.SelectedItems[0].SubItems[2].Text) { case "_Byte": FA.comType.SelectedIndex = 0; break; case "_2Bytes": FA.comType.SelectedIndex = 1; break; default: FA.comType.SelectedIndex = 2; break; } FA.txtAddress.Text = HackListView.SelectedItems[0].SubItems[1].Text; break; } FA.txtName.Text = HackListView.SelectedItems[0].SubItems[0].Text; DialogResult DR = FA.ShowDialog(); if (DR == DialogResult.OK) { switch (FA.MSTAB.SelectedIndex) { case 0: HackType SetHT; switch (FA.comType.SelectedIndex) { case 0: SetHT = HackType._Byte; break; case 1: SetHT = HackType._2Bytes; break; default: SetHT = HackType._4Bytes; break; } AddHackList(HackListView.SelectedItems[0].Index, HackListView, FA.txtName.Text, Convert.ToInt32(FA.txtAddress.Text, 16), SetHT, "", 0); break; case 1: AddHackList(HackListView.SelectedItems[0].Index, HackListView, FA.txtName.Text, Convert.ToInt32(FA.txtAOP.Text, 16), HackType._Pointer, "", Convert.ToInt32(FA.txtOffset.Text, 16)); break; default: AddHackList(HackListView.SelectedItems[0].Index, HackListView, FA.txtName.Text, 0, HackType.AssemblyScript, FA.txtASM.Text, 0); break; } HackListView.SelectedItems[0].Remove(); } }