diff --git a/PBRHex Setup/PBRHex Setup.vdproj b/PBRHex Setup/PBRHex Setup.vdproj index b636496..0f7196a 100644 --- a/PBRHex Setup/PBRHex Setup.vdproj +++ b/PBRHex Setup/PBRHex Setup.vdproj @@ -3141,15 +3141,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:PBRHex" - "ProductCode" = "8:{343B4450-5F9D-4AF3-8DA0-3FA3A1F3B6F6}" - "PackageCode" = "8:{0BEE662A-A756-4A71-8FF2-A623EBB38CC8}" + "ProductCode" = "8:{D34F3B6D-8EB0-46F0-8DAE-4F4D73C5BCAD}" + "PackageCode" = "8:{6C8B60FD-8849-47DA-ABB5-EE8281838E8A}" "UpgradeCode" = "8:{D48A0932-A217-4C66-91CB-5BF77D165DBB}" "AspNetVersion" = "8:2.0.50727.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:FALSE" - "ProductVersion" = "8:1.1.0" + "ProductVersion" = "8:1.1.1" "Manufacturer" = "8:PBRHex" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:" @@ -3629,7 +3629,7 @@ { "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_FFFCF4EE22884D0D8F8380EC9CCA4EDD" { - "SourcePath" = "8:..\\PBRHex\\obj\\Release\\PBRHex.exe" + "SourcePath" = "8:" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_5092C41DA61F4D24B1B9ADB71B4CCD91" diff --git a/PBRHex/CodeEditorWindow.cs b/PBRHex/CodeEditorWindow.cs index ac2d6e9..b1b00f8 100644 --- a/PBRHex/CodeEditorWindow.cs +++ b/PBRHex/CodeEditorWindow.cs @@ -58,7 +58,7 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch (keyData) { case Keys.Control | Keys.G: var input = new HexInputDialog("Enter address:"); - if (input.ShowDialog() == DialogResult.OK) { + if (input.ShowDialog() == DialogResult.OK && input.Response != null) { uint addr = (uint)input.Response; if (!IsAddressInbounds(addr)) new AlertDialog("Address out of bounds.").ShowDialog(); diff --git a/PBRHex/Dialogs/HexInputDialog.cs b/PBRHex/Dialogs/HexInputDialog.cs index b81d491..fcc617a 100644 --- a/PBRHex/Dialogs/HexInputDialog.cs +++ b/PBRHex/Dialogs/HexInputDialog.cs @@ -9,12 +9,17 @@ public partial class HexInputDialog : Form { public readonly string Prompt; public string Default { get; set; } - public int Response - { + public int? Response + { get { - if(decimalRadioButton.Checked) - return int.Parse(textBox1.Text); - return HexUtils.HexToInt(textBox1.Text); + try { + if (decimalRadioButton.Checked) + return int.Parse(textBox1.Text); + return HexUtils.HexToInt(textBox1.Text); + } catch { + new AlertDialog("Invalid input.").ShowDialog(); + return null; + } } } diff --git a/PBRHex/HexEditor/HexEditorWindow.cs b/PBRHex/HexEditor/HexEditorWindow.cs index 9444084..1f6cb05 100644 --- a/PBRHex/HexEditor/HexEditorWindow.cs +++ b/PBRHex/HexEditor/HexEditorWindow.cs @@ -356,8 +356,9 @@ private bool PromptFillRange(out byte[] bytes) { { Default = "00" }; - if(input.ShowDialog() == DialogResult.OK) { - if(input.Response < 0 || input.Response > 0xff) { + if(input.ShowDialog() == DialogResult.OK && input.Response != null) { + int value = (int)input.Response; + if(value < 0 || value > 0xff) { new AlertDialog( "Invalid fill value." ).ShowDialog(); return false; } @@ -368,7 +369,7 @@ private bool PromptFillRange(out byte[] bytes) { bytes = new byte[size]; for(int i = 0; i < size; i++) { if(IsCellSelected(address + i)) - bytes[i] = (byte)input.Response; + bytes[i] = (byte)value; else bytes[i] = range[i]; } @@ -385,8 +386,10 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { return true; case Keys.Control | Keys.G: var input = new HexInputDialog( "Enter address:" ); - if(input.ShowDialog() == DialogResult.OK) - GoTo(input.Response, true); + if (input.ShowDialog() == DialogResult.OK && input.Response != null) { + int address = (int)input.Response; + GoTo(address, true); + } return true; case Keys.Control | Keys.S: Save(); diff --git a/PBRHex/StringEditor.cs b/PBRHex/StringEditor.cs index 21af029..46b0353 100644 --- a/PBRHex/StringEditor.cs +++ b/PBRHex/StringEditor.cs @@ -54,8 +54,8 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch(keyData) { case Keys.Control | Keys.G: var input = new HexInputDialog("Enter string ID:"); - if(input.ShowDialog() == DialogResult.OK) - GoTo(input.Response); + if(input.ShowDialog() == DialogResult.OK && input.Response != null) + GoTo((int)input.Response); return true; case Keys.Control | Keys.S: Save();