Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Commit

Permalink
Verbatim strings for constant & argument editors.
Browse files Browse the repository at this point in the history
  • Loading branch information
sailro committed Jul 14, 2014
1 parent be8fed2 commit 0dac803
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ obj
/*.user
/*.DotSettings
/*.suo
/Plugins/Reflexil.Reflector/*.user
6 changes: 3 additions & 3 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
11 changes: 10 additions & 1 deletion Controls/Definition/ConstantEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -82,6 +83,7 @@ public void ReadStateFrom(IConstantProvider item)
{
ConstantTypes.SelectedItem = editor;
editor.SelectedOperand = item.Constant;
return;
}
}
}
Expand All @@ -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<string>(stringEditor, verbatimStringEditor);
Disposed += delegate { bridge.Dispose(); };

ConstantTypes.Items.Add(stringEditor);
ConstantTypes.Items.Add(verbatimStringEditor);

ConstantTypes.SelectedIndex = 0;
}
Expand Down
15 changes: 13 additions & 2 deletions Controls/Definition/CustomAttributeArgumentEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -120,13 +121,15 @@ public CustomAttributeArgument SelectedArgument
{
ArgumentTypes.SelectedItem = xeditor;
xeditor.SelectedOperands = values;
return;
}
}

if (editor.IsOperandHandled(value.Value))
{
ArgumentTypes.SelectedItem = editor;
editor.SelectedOperand = value.Value;
return;
}
}
}
Expand Down Expand Up @@ -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<string>(stringEditor, verbatimStringEditor);
Disposed += delegate { bridge.Dispose(); };

ArgumentTypes.Items.Add(stringEditor);
ArgumentTypes.Items.Add(verbatimStringEditor);

ArgumentTypes.Items.Add(new TypeReferenceEditor());

ArgumentTypes.SelectedIndex = 0;
}
Expand Down
3 changes: 1 addition & 2 deletions Forms/InstructionForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>(stringEditor, verbatimStringEditor);
FormClosed += delegate { bridge.Dispose(); };
Disposed += delegate { bridge.Dispose(); };

Operands.Items.Add(stringEditor);
Operands.Items.Add(verbatimStringEditor);
Expand Down

0 comments on commit 0dac803

Please sign in to comment.