From 0dac803a79b3b62617483960fed6434e65a81e65 Mon Sep 17 00:00:00 2001 From: Sebastien LEBRETON Date: Mon, 14 Jul 2014 21:32:17 +0200 Subject: [PATCH] Verbatim strings for constant & argument editors. --- .gitignore | 1 + ChangeLog | 6 +++--- Controls/Definition/ConstantEditor.cs | 11 ++++++++++- .../Definition/CustomAttributeArgumentEditor.cs | 15 +++++++++++++-- Forms/InstructionForm.cs | 3 +-- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 8d9808e0..0230dc01 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ obj /*.user /*.DotSettings /*.suo +/Plugins/Reflexil.Reflector/*.user diff --git a/ChangeLog b/ChangeLog index 4fa4e672..910b15e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,10 @@ //////////////////////////////////////////////////////////////////////////////// -// v1.8 - ??/??/2014 /////////////////////////////////////////////////////////// +// v1.8 - 14/07/2014 /////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// news: - - Added verbatim string operand type in the instruction editor so that you - can use special chars like \n, \t... + - Added verbatim string operand type in the instruction/constant/argument + editor so that you can use special chars like \n, \t... upgrades: - Support for Microsoft SDK v7.1A, v8.0A, v8.1A. diff --git a/Controls/Definition/ConstantEditor.cs b/Controls/Definition/ConstantEditor.cs index 6a16fbe6..688b1370 100644 --- a/Controls/Definition/ConstantEditor.cs +++ b/Controls/Definition/ConstantEditor.cs @@ -22,6 +22,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #region " Imports " using System; using System.Windows.Forms; +using Controls.Primitive; using Mono.Cecil; #endregion @@ -82,6 +83,7 @@ public void ReadStateFrom(IConstantProvider item) { ConstantTypes.SelectedItem = editor; editor.SelectedOperand = item.Constant; + return; } } } @@ -108,7 +110,14 @@ public ConstantEditor() ConstantTypes.Items.Add(new LongEditor()); ConstantTypes.Items.Add(new SingleEditor()); ConstantTypes.Items.Add(new DoubleEditor()); - ConstantTypes.Items.Add(new StringEditor()); + + var stringEditor = new StringEditor(); + var verbatimStringEditor = new VerbatimStringEditor(); + var bridge = new GenericOperandEditorBridge(stringEditor, verbatimStringEditor); + Disposed += delegate { bridge.Dispose(); }; + + ConstantTypes.Items.Add(stringEditor); + ConstantTypes.Items.Add(verbatimStringEditor); ConstantTypes.SelectedIndex = 0; } diff --git a/Controls/Definition/CustomAttributeArgumentEditor.cs b/Controls/Definition/CustomAttributeArgumentEditor.cs index f3027dc8..b186771f 100644 --- a/Controls/Definition/CustomAttributeArgumentEditor.cs +++ b/Controls/Definition/CustomAttributeArgumentEditor.cs @@ -24,6 +24,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System.Collections.Generic; using System.Linq; using System.Windows.Forms; +using Controls.Primitive; using Mono.Cecil; using System.Collections; #endregion @@ -120,6 +121,7 @@ public CustomAttributeArgument SelectedArgument { ArgumentTypes.SelectedItem = xeditor; xeditor.SelectedOperands = values; + return; } } @@ -127,6 +129,7 @@ public CustomAttributeArgument SelectedArgument { ArgumentTypes.SelectedItem = editor; editor.SelectedOperand = value.Value; + return; } } } @@ -207,8 +210,16 @@ public CustomAttributeArgumentEditor() ArgumentTypes.Items.Add(new LongEditor()); ArgumentTypes.Items.Add(new SingleEditor()); ArgumentTypes.Items.Add(new DoubleEditor()); - ArgumentTypes.Items.Add(new StringEditor()); - ArgumentTypes.Items.Add(new TypeReferenceEditor()); + + var stringEditor = new StringEditor(); + var verbatimStringEditor = new VerbatimStringEditor(); + var bridge = new GenericOperandEditorBridge(stringEditor, verbatimStringEditor); + Disposed += delegate { bridge.Dispose(); }; + + ArgumentTypes.Items.Add(stringEditor); + ArgumentTypes.Items.Add(verbatimStringEditor); + + ArgumentTypes.Items.Add(new TypeReferenceEditor()); ArgumentTypes.SelectedIndex = 0; } diff --git a/Forms/InstructionForm.cs b/Forms/InstructionForm.cs index 1ec453df..c1283f40 100644 --- a/Forms/InstructionForm.cs +++ b/Forms/InstructionForm.cs @@ -89,11 +89,10 @@ public void FillControls(MethodDefinition mdef) Operands.Items.Add(new SingleEditor()); Operands.Items.Add(new DoubleEditor()); - var stringEditor = new StringEditor(); var verbatimStringEditor = new VerbatimStringEditor(); var bridge = new GenericOperandEditorBridge(stringEditor, verbatimStringEditor); - FormClosed += delegate { bridge.Dispose(); }; + Disposed += delegate { bridge.Dispose(); }; Operands.Items.Add(stringEditor); Operands.Items.Add(verbatimStringEditor);