Skip to content

Commit 2a8688a

Browse files
Update NewScripting.cs
1 parent dd7fc74 commit 2a8688a

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

Flames/Modules/Compiling/New/NewScripting.cs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public static class IScripting
3838
{
3939
#if F_DOTNET
4040
public const string COMMANDS_DLL_DIR = "extra/commands/dll/";
41-
public static string CommandPath(string name) { return COMMANDS_DLL_DIR + "Cmd" + name + ".dll"; }
41+
public static string CommandPath(string name)
42+
{
43+
return COMMANDS_DLL_DIR + "Cmd" + name + ".dll";
44+
}
4245
#endif
4346
public static string GetExePath(string path)
4447
{
@@ -127,19 +130,27 @@ public static Assembly LoadAssembly(string path)
127130
return Assembly.Load(data);
128131
}
129132
#if F_DOTNET
130-
public static void AutoloadCommands() {
131-
string[] files = FileIO.TryGetFiles(COMMANDS_DLL_DIR, "*.dll");
133+
public static void AutoloadCommands()
134+
{
135+
string[] files = AtomicIO.TryGetFiles(COMMANDS_DLL_DIR, "*.dll");
132136
if (files == null) return;
133137

134-
foreach (string path in files) { AutoloadCommands(path); }
138+
foreach (string path in files)
139+
{
140+
AutoloadCommands(path);
141+
}
135142
}
136143

137-
static void AutoloadCommands(string path) {
144+
public static void AutoloadCommands(string path)
145+
{
138146
List<Command> cmds;
139147

140-
try {
148+
try
149+
{
141150
cmds = LoadCommands(path);
142-
} catch (Exception ex) {
151+
}
152+
catch (Exception ex)
153+
{
143154
Logger.LogError("Error loading commands from " + path, ex);
144155
return;
145156
}
@@ -149,7 +160,8 @@ static void AutoloadCommands(string path) {
149160
}
150161

151162
/// <summary> Loads and registers all the commands from the given .dll path </summary>
152-
public static List<Command> LoadCommands(string path) {
163+
public static List<Command> LoadCommands(string path)
164+
{
153165
Assembly lib = LoadAssembly(path);
154166
List<Command> commands = LoadTypes<Command>(lib);
155167

0 commit comments

Comments
 (0)