|
1 | 1 | --- |
2 | 2 | title: Execute C# Code |
3 | 3 | description: Sub-action for writing advanced custom actions with C# code |
| 4 | +parameters: |
| 5 | + - name: Name |
| 6 | + type: Text |
| 7 | + description: | |
| 8 | + Optionally set a descriptive name for your C# sub-action. |
| 9 | +
|
| 10 | + ::tip |
| 11 | + `Name` is required if you would like to share custom methods with the [Execute C# Method](/api/sub-actions/core/csharp/execute-csharp-method) sub-action. |
| 12 | + :: |
| 13 | + - name: Description |
| 14 | + type: Text |
| 15 | + description: Optionally set a longer description detailing what your C# sub-action does. |
| 16 | + - name: Precompile on Application Start |
| 17 | + type: Toggle |
| 18 | + default: false |
| 19 | + description: By ticking this, your code will be automatically compiled when you start Streamer.bot so it is ready to go, instead of the first time the sub-action is executed. |
| 20 | + - name: Delayed Start |
| 21 | + type: Toggle |
| 22 | + default: false |
| 23 | + description: | |
| 24 | + When `Precompile on Application Start`{color=primary} is enabled, delay compilation until later in the startup routine. |
| 25 | +
|
| 26 | + ::tip |
| 27 | + This is useful if you are **implementing UI** within your C# sub-action. |
| 28 | + :: |
| 29 | + - name: Save Result to Variable |
| 30 | + type: Toggle |
| 31 | + default: false |
| 32 | + description: | |
| 33 | + Save the `bool`{lang=cs} result of the `Execute()`{lang=cs} method |
| 34 | +
|
| 35 | + ::warning |
| 36 | + **This changes the default behavior of the sub-action** |
| 37 | + <br> |
| 38 | + By default, a method returning `false`{lang=cs} will simply stop execution of the entire action. |
| 39 | + <br> |
| 40 | + Enabling this option allows you to collect the result and also continue execution **regardless of the return value**. |
| 41 | + :: |
| 42 | + - name: Variable Name |
| 43 | + type: Text |
| 44 | + description: When `Save Result to Variable`{color=primary} is enabled, define the name of the resulting variable. |
4 | 45 | --- |
5 | 46 |
|
6 | | -::callout{icon=i-mdi-bookmark color=green to=/guide/csharp} |
7 | | -Learn more about custom code actions at [Guide > C# Code Actions](/api/csharp) |
8 | | -:: |
9 | | - |
10 | | -::callout{icon=i-mdi-bookmark color=green to=/api/csharp} |
11 | | -Explore all available C# methods at [API References > C# Methods](/api/csharp) |
12 | | -:: |
13 | | - |
14 | | -## Views |
15 | | -### Compiling Log |
16 | | -Shows some general information based on what buttons you've pressed, this will show any compiler errors, and general information when trying to find references |
17 | | - |
18 | | -### References |
19 | | -List the references required for compiling your code. |
20 | | - |
21 | | -::tip{color=amber} |
22 | | -You can :shortcut{value=Right-Click} within the pane if you need to add specific references |
23 | | -:: |
24 | | - |
25 | | -## Configuration |
26 | | -Configuration options available under the `Settings` tab are outlined below: |
27 | | - |
28 | | -::field-group |
29 | | - ::field{name=Name type=Text} |
30 | | - Optionally set a descriptive name for your C# sub-action. |
31 | | - |
32 | | - ::tip{color=amber} |
33 | | - `Name` is required if you would like to execute custom methods with the [Execute C# Method](/api/sub-actions/core/csharp/execute-csharp-method) sub-action. |
34 | | - :: |
35 | | - :: |
36 | | - |
37 | | - ::field{name=Description type=Text} |
38 | | - Optionally set a longer description detailing what your C# sub-action does. |
39 | | - :: |
40 | | - |
41 | | - ::field{name="Keep Instance Active" type=Toggle} |
42 | | - By ticking this option, your code will be kept alive for the lifetime of the Streamer.bot application. |
43 | | - |
44 | | - This will allow you to **preserve data between calls** to this sub-action. |
45 | | - |
46 | | - ::tip |
47 | | - As of Streamer.bot v0.2.3, this option has been removed and is enabled by default. |
48 | | - :: |
49 | | - :: |
50 | | - |
51 | | - ::field{name="Precompile on Application Start" type=Toggle} |
52 | | - By ticking this, your code will be automatically compiled when you start Streamer.bot so it is ready to go, instead of the first time the sub-action is executed. |
53 | | - :: |
54 | | - |
55 | | - ::field{name="Delayed Start" type=Toggle} |
56 | | - When `Precompile on Application Start` is enabled, delay compilation until later in the startup routine. |
57 | | - |
58 | | - This is useful if you are **implementing UI** within your C# sub-action. |
59 | | - :: |
60 | | - |
61 | | - ::field{name="Save Result to Variable" type=Toggle} |
62 | | - Save the `bool` result of the `Execute()` method |
63 | | - |
64 | | - ::tip{color=amber} |
65 | | - Returning `false` without this option enabled will simply stop execution of the entire action. Enabling this option allows you to collect the result and also continue execution regardless of the return value. |
66 | | - :: |
67 | | - :: |
68 | | - |
69 | | - ::field{name="Variable Name" type=Text} |
70 | | - When `Save Result to Variable` is enabled, enter the name for the resulting variable here. |
71 | | - :: |
72 | | -:: |
73 | | - |
74 | | -## Actions |
75 | | - |
76 | | -::field-group |
77 | | - ::field{name="Format Document" type=Button} |
78 | | - Automatically format your code with proper indentation |
79 | | - :: |
80 | | - |
81 | | - ::field{name="Find Refs" type=Button} |
82 | | - Attempt to automatically find some common references based on your `using` directives. |
83 | | - :: |
84 | | - |
85 | | - ::field{name="Compile" type=Button} |
86 | | - Test the compilation of your code and check for errors. |
87 | | - |
88 | | - ::callout{icon=i-mdi-alert color=amber} |
89 | | - This will also remove any references that are currently unused. |
90 | | - If your code is stil in-progress, it could end up removing a reference that is actually needed. |
91 | | - :: |
92 | | - :: |
93 | | - |
94 | | - ::field{name="Save and Compile" type=Button} |
95 | | - This will save your changes, and pre-compile the code so it's ready to go the first time the action is hit |
96 | | - :: |
97 | | - |
98 | | - ::field{name="Ok" type=Button} |
99 | | - Save your changes |
100 | | - :: |
101 | | - |
102 | | - ::field{name="Cancel" type=Button} |
103 | | - Discard your changes |
104 | | - :: |
105 | | -:: |
| 47 | +:read-more{to=/api/csharp/guide} |
0 commit comments