@@ -23,9 +23,9 @@ public static void Draw()
23
23
24
24
DrawButtons ( ) ;
25
25
26
- foreach ( var bother in P . Config . CustomBothers . ToList ( ) )
26
+ foreach ( var bother in P . Config . CustomCallbacks . ToList ( ) )
27
27
{
28
- using var id = ImRaii . PushId ( P . Config . CustomBothers . IndexOf ( bother ) ) ;
28
+ using var id = ImRaii . PushId ( P . Config . CustomCallbacks . IndexOf ( bother ) ) ;
29
29
var name = bother . Addon ;
30
30
if ( ImGui . InputText ( "Addon Name" , ref name , 50 , ImGuiInputTextFlags . EnterReturnsTrue ) )
31
31
{
@@ -34,18 +34,18 @@ public static void Draw()
34
34
ToggleCustomBothers ( ) ;
35
35
}
36
36
37
- var args = string . Join ( " " , bother . CallbackParams ) ;
37
+ var args = bother . CallbackParams ;
38
38
if ( ImGui . InputText ( "Parameters" , ref args , 150 , ImGuiInputTextFlags . EnterReturnsTrue ) )
39
39
{
40
- bother . CallbackParams = ParseArgs ( args ) ;
40
+ bother . CallbackParams = args ;
41
41
P . Config . Save ( ) ;
42
42
ToggleCustomBothers ( ) ;
43
43
}
44
44
45
45
ImGui . SameLine ( ) ;
46
- if ( ImGuiEx . IconButton ( FontAwesomeIcon . Trash , "Remove Entry" , id : $ "Delete##{ P . Config . CustomBothers . IndexOf ( bother ) } ") )
46
+ if ( ImGuiEx . IconButton ( FontAwesomeIcon . Trash , "Remove Entry" , id : $ "Delete##{ P . Config . CustomCallbacks . IndexOf ( bother ) } ") )
47
47
{
48
- P . Config . CustomBothers . Remove ( bother ) ;
48
+ P . Config . CustomCallbacks . Remove ( bother ) ;
49
49
P . Config . Save ( ) ;
50
50
ToggleCustomBothers ( ) ;
51
51
}
@@ -60,10 +60,10 @@ public static void DrawButtons()
60
60
61
61
if ( ImGuiEx . IconButton ( FontAwesomeIcon . Plus , "Add new entry" ) )
62
62
{
63
- P . Config . CustomBothers . Add ( new CustomBother
63
+ P . Config . CustomCallbacks . Add ( new CustomBother
64
64
{
65
65
Addon = "AddonName" ,
66
- CallbackParams = [ - 1 ]
66
+ CallbackParams = "-1"
67
67
} ) ;
68
68
P . Config . Save ( ) ;
69
69
}
@@ -101,45 +101,4 @@ private static void ToggleCustomBothers()
101
101
}
102
102
}
103
103
}
104
-
105
- private static object [ ] ParseArgs ( string args )
106
- {
107
- var rawValues = args . Split ( ' ' ) ;
108
- var valueArgs = new List < object > ( ) ;
109
-
110
- var current = "" ;
111
- var inQuotes = false ;
112
-
113
- for ( var i = 0 ; i < rawValues . Length ; i ++ )
114
- {
115
- if ( ! inQuotes )
116
- {
117
- if ( rawValues [ i ] . StartsWith ( '\" ' ) )
118
- {
119
- inQuotes = true ;
120
- current = rawValues [ i ] . TrimStart ( '"' ) ;
121
- }
122
- else
123
- {
124
- if ( int . TryParse ( rawValues [ i ] , out var iValue ) ) valueArgs . Add ( iValue ) ;
125
- else if ( uint . TryParse ( rawValues [ i ] . TrimEnd ( 'U' , 'u' ) , out var uValue ) ) valueArgs . Add ( uValue ) ;
126
- else if ( bool . TryParse ( rawValues [ i ] , out var bValue ) ) valueArgs . Add ( bValue ) ;
127
- else valueArgs . Add ( rawValues [ i ] ) ;
128
- }
129
- }
130
- else
131
- {
132
- if ( rawValues [ i ] . EndsWith ( '\" ' ) )
133
- {
134
- inQuotes = false ;
135
- current += " " + rawValues [ i ] . TrimEnd ( '"' ) ;
136
- valueArgs . Add ( current ) ;
137
- current = "" ;
138
- }
139
- else
140
- current += " " + rawValues [ i ] ;
141
- }
142
- }
143
- return [ .. valueArgs ] ;
144
- }
145
104
}
0 commit comments