From 751002111b88213e59b7254bac9955e716441614 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 4 Oct 2008 14:24:20 +0000 Subject: [PATCH] Allow setting integers to hex numbers. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3583 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/TreeModel/ValueNode.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs index 6787ebb4ca..ed4adb0f31 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Windows.Forms; using Debugger.Expressions; @@ -68,7 +69,7 @@ namespace Debugger.AddIn.TreeModel canSetText = false; if (val.Type.IsInteger) { - canSetText = + canSetText = (val.Expression is LocalVariableIdentifierExpression) || (val.Expression is ParameterIdentifierExpression) || (val.Expression is ArrayIndexerExpression) || @@ -139,7 +140,17 @@ namespace Debugger.AddIn.TreeModel Value val = null; try { val = this.Expression.Evaluate(WindowsDebugger.DebuggedProcess.SelectedStackFrame); - val.PrimitiveValue = newText; + if (val.Type.IsInteger && newText.StartsWith("0x")) { + try { + val.PrimitiveValue = long.Parse(newText.Substring(2), NumberStyles.HexNumber); + } catch (FormatException) { + throw new NotSupportedException(); + } catch (OverflowException) { + throw new NotSupportedException(); + } + } else { + val.PrimitiveValue = newText; + } this.Text = newText; return true; } catch (NotSupportedException) {