private void RenameToolStripMenuItem_Click(object sender, EventArgs e) { using (DialogBoxTextEntry dialog = new DialogBoxTextEntry()) { dialog.Text = "Choose a name"; dialog.textBox1.Text = listView1.FocusedItem.SubItems[2].Text; dialog.button1.Text = "Confirm"; if (dialog.ShowDialog() == DialogResult.OK) { int count = listView1.SelectedItems.Count; for (int i = 0; i < count; i++) { int entryIndex = int.Parse(listView1.SelectedItems[i].SubItems[0].Text); if (entryIndex == 0) { continue; } cpuFile.ChangeEntryName(int.Parse(listView1.SelectedItems[i].Text), dialog.textBox1.Text); } cpuFile.Reload(); RefreshCpuEntryList(true); button3.Enabled = true; } } }
private void ChangeParentToolStripMenuItem_Click(object sender, EventArgs e) { int entryIndex = int.Parse(listView1.FocusedItem.SubItems[0].Text); using (DialogBoxTextEntry dialog = new DialogBoxTextEntry()) { dialog.Text = "Choose a parent ID"; Node node = cpuFile[entryIndex] as Node; if (node.parent.Count > 0) { dialog.textBox1.Text = (cpuFile[entryIndex] as Node).parent[0].id.ToString("X8"); } dialog.button1.Text = "Confirm"; if (dialog.ShowDialog() == DialogResult.OK) { if (ParseHexString(dialog.textBox1.Text, out uint id)) { int count = listView1.SelectedItems.Count; for (int i = 0; i < count; i++) { entryIndex = int.Parse(listView1.SelectedItems[i].SubItems[0].Text); if (entryIndex == 0) { continue; } cpuFile.ChangeParentID(entryIndex, id); } cpuFile.Reload(); RefreshDetailsText(); button3.Enabled = true; } } } }
private void IDSearch(EntryType entryType) { using (DialogBoxTextEntry dialog = new DialogBoxTextEntry()) { dialog.Text = string.Format("Enter a {0} ID", entryType); dialog.button1.Text = "Search"; if (dialog.ShowDialog() == DialogResult.OK) { if (!ParseHexString(dialog.textBox1.Text, out uint id)) { MessageBox.Show("Invalid ID!\nYou must enter a 32bit hex number.", "Invalid ID!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SelectAssetByID(id, entryType); } } }