private void Button_Scan_Start_Click(object sender, EventArgs e) { UInt64 FirstAddress; UInt64 LastAddress; if (!CheckSyntax.Address(TextBox_EndAddress.Text) || !CheckSyntax.Address(TextBox_StartAddress.Text)) { MessageBox.Show("Address range must be in hexadecimal format.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } FirstAddress = Conversions.Conversions.HexToUInt64(TextBox_StartAddress.Text); LastAddress = Conversions.Conversions.HexToUInt64(TextBox_EndAddress.Text); if ((FirstAddress < 0 || FirstAddress > SystemMaxAddress) || (LastAddress < 0 || LastAddress > SystemMaxAddress)) { MessageBox.Show("Addresses must be between 0 and " + SystemMaxAddress.ToString() + ".", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (LastAddress < FirstAddress) { MessageBox.Show("Invalid address range. Swapping values and attempting to proceed anyways.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); UInt64 Temp = FirstAddress; FirstAddress = LastAddress; LastAddress = Temp; } if (CheckBox_OptimizeScan.Checked && !RadioButton_LastDigits.Checked) { while (FirstAddress % NUD_OptimizeScan.Value != 0) { FirstAddress++; } while (LastAddress % NUD_OptimizeScan.Value != 0) { LastAddress--; } if ((FirstAddress < 0 || FirstAddress > SystemMaxAddress) || (LastAddress < 0 || LastAddress > SystemMaxAddress)) { MessageBox.Show("Specified allignment results in invalid address range.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (!ScanButtonShared(false, FirstAddress, LastAddress)) { return; } TextBox_StartAddress.Enabled = false; TextBox_EndAddress.Enabled = false; ComboBox_DataType.Enabled = false; Button_Scan_Start.Enabled = false; Canceled = false; Button_Scan_Abort.Enabled = true; ListView_Address.Items.Clear(); ShowSecondScanOptions(); }
private void acceptButton_Click(object sender, EventArgs e) { string ValueString = AddressTextBox.Text; //If not hex we can just convert address to an int and use it if (!IsHexCB.Checked) { //Check if address is a valid non-hex integer if (CheckSyntax.Int32Value(ValueString, IsHexCB.Checked)) { //Convert to a hex string Address = Convert.ToUInt64(ValueString); } else //Wasn't a valid integer { MessageBox.Show("Invalid address format.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); failed = true; } } //Check if hex string is valid else if (CheckSyntax.Address(ValueString)) { //Valid: proceed to convert it to an int Address = Conversions.HexToUInt64(AddressTextBox.Text); } else //Nope, they screwed up { MessageBox.Show("Invalid address format.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); failed = true; } }
private void Button_Accept_Click(object sender, EventArgs e) { string ValueString = TextBox_Address.Text; if (!CheckBox_IsHex.Checked) { if (CheckSyntax.Int32Value(ValueString, CheckBox_IsHex.Checked)) { Address = Convert.ToUInt64(ValueString); } else { MessageBox.Show("Invalid address format.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); failed = true; } } else if (CheckSyntax.Address(ValueString)) { Address = Conversions.Conversions.HexToUInt64(TextBox_Address.Text); } else { MessageBox.Show("Invalid address format.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); failed = true; } }
private void acceptButton_Click(object sender, EventArgs e) { if (IsHexCB.Checked == true) { if (!CheckSyntax.Address(AddressTextBox.Text)) { MessageBox.Show("Invalid address format.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Address = AddressTextBox.Text; } else { if (!CheckSyntax.Int32Value(AddressTextBox.Text, false)) { MessageBox.Show("Invalid address format.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Address = Conversions.ToHex(AddressTextBox.Text); } if (DescriptionTextBox.Text == "") { Description = "No Description"; } else { Description = DescriptionTextBox.Text; } switch (ValueTypeComboBox.SelectedIndex) { case 0: ScanType = ScanDataType.Binary; break; case 1: ScanType = ScanDataType.Byte; break; case 2: ScanType = ScanDataType.Int16; break; case 3: ScanType = ScanDataType.Int32; break; case 4: ScanType = ScanDataType.Int64; break; case 5: ScanType = ScanDataType.Single; break; case 6: ScanType = ScanDataType.Double; break; case 7: ScanType = ScanDataType.Text; break; case 8: ScanType = ScanDataType.AOB; break; case 9: ScanType = ScanDataType.All; break; } this.Close(); }