-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathExamplePlugin.Commands.cs
58 lines (51 loc) · 1.21 KB
/
ExamplePlugin.Commands.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using Dotx64Dbg;
using System;
public partial class ExamplePlugin
{
// Works at any given time.
[Command("Test1")]
void MyCommand(string[] args)
{
Console.WriteLine($"Hello World: {args[0]}");
}
// Works only when the debugger is active.
[Command("Test2", DebugOnly = true)]
void MyCommand2(string[] args)
{
Console.WriteLine("Debugger active, lets go!");
}
// Allows to return a status
[Command("Test3")]
bool MyCommand3(string[] args)
{
Console.WriteLine("Oh no");
return false; // Indicates failure.
}
[Command("SetStatusText")]
void SetStatusBarText(string[] args)
{
UI.StatusBar.Text = args[1] ?? "";
}
[Command("Selection")]
void PrintSelection(string[] args)
{
var sel = Dotx64Dbg.UI.Disassembly.GetSelection();
if (sel == null)
{
Console.WriteLine("No selection");
return;
}
Console.WriteLine($"Selection Start: {sel.Start:X}, End: {sel.End:X}");
}
[Command("CmdNoArgs")]
void NoArgsCmd()
{
Console.WriteLine("Yup");
}
[Command("CmdNoArgs2")]
bool NoArgsCmd2()
{
Console.WriteLine("Yup");
return false;
}
}