public DataFragment EncodeString(int address, string str) { DataFragment df = new DataFragment(); try { df = encoder(address, str); } catch(Exception) { MessageBox.Show("Error converting string \"" + str + "\" to type " + Name, "Conversion Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return df; }
internal void ApplyEdit(DataFragment data) { if(data.Length > 0) { Array.Copy(data.Data, 0, fileBytes, data.Address / 8, data.Length); NavigateToAddress(); } }
internal bool Search(DataFragment toSearch) { byte[] target = new byte[toSearch.Length]; Array.Copy(toSearch.Data, target, toSearch.Length); int idx = StartingIndex(fileBytes, target); if(idx >= 0) { NavigateToAddress(idx * 8); } return idx >= 0; }
public string DecodeToString(DataFragment target) { return decoder(target); }
private void goButton_Click(object sender, EventArgs e) { ToSearch = (dtComboBox.Items[dtComboBox.SelectedIndex] as DataType).EncodeString(0, valueTextBox.Text); }
private void SelectedAddressInspector_DataChanged(DataFragment data) { hexView.ApplyEdit(data); selectedAddressInspector.Target = hexView.GetSelectedData(); }