private void lvEntries_SelectedIndexChanged(object sender, EventArgs e) { if (lvEntries.SelectedItems == null || lvEntries.SelectedItems.Count <= 0) { ClearSelected(); return; } SelectedEntry = lvEntries.SelectedItems[0]; PS3Registry.SettingDataEntry entry = (PS3Registry.SettingDataEntry)SelectedEntry.Tag; txtID.Text = entry.Checksum.ToString("X4"); txtSetting.Text = entry.FileNameEntry.Setting; txtFlags.Text = entry.Flags.ToString("X4"); txtHeaderValue.Text = entry.FileNameEntry.Value.ToString("X2"); cmdSave.Enabled = true; txtValue.Text = entry.ValueString; }
private void cmdSave_Click(object sender, EventArgs e) { if (SelectedEntry == null) { ClearSelected(); return; } PS3Registry.SettingDataEntry entry = (PS3Registry.SettingDataEntry)SelectedEntry.Tag; ushort checksum; ushort flags; byte hvalue; try { checksum = UInt16.Parse(txtID.Text, NumberStyles.HexNumber); flags = UInt16.Parse(txtFlags.Text, NumberStyles.HexNumber); hvalue = byte.Parse(txtHeaderValue.Text, NumberStyles.HexNumber); } catch { MessageBox.Show("Invalid input!", "PS3 Multi Tool"); return; } try { entry.ValueString = txtValue.Text; } catch { MessageBox.Show("Invalid setting value!", "PS3 Multi Tool"); return; } entry.Checksum = checksum; entry.Flags = flags; entry.FileNameEntry.Value = hvalue; SelectedEntry.Text = string.Format("0x{0:X4}", entry.Checksum); SelectedEntry.SubItems[1].Text = entry.FileNameEntry.Setting; SelectedEntry.SubItems[2].Text = entry.ValueString; SelectedEntry.SubItems[3].Text = string.Format("0x{0:X2}", entry.FileNameEntry.Value); SelectedEntry.SubItems[4].Text = string.Format("0x{0:X4}", entry.Flags); }