Minor cleanup
This commit is contained in:
@@ -99,10 +99,11 @@ namespace
|
|||||||
bool Inited = false;
|
bool Inited = false;
|
||||||
Array<CommandData> Commands;
|
Array<CommandData> Commands;
|
||||||
|
|
||||||
void OnBinaryModuleLoaded(BinaryModule* module)
|
void FindDebugCommands(BinaryModule* module)
|
||||||
{
|
{
|
||||||
if (module == GetBinaryModuleCorlib())
|
if (module == GetBinaryModuleCorlib())
|
||||||
return;
|
return;
|
||||||
|
PROFILE_CPU();
|
||||||
|
|
||||||
#if USE_CSHARP
|
#if USE_CSHARP
|
||||||
if (auto* managedModule = dynamic_cast<ManagedBinaryModule*>(module))
|
if (auto* managedModule = dynamic_cast<ManagedBinaryModule*>(module))
|
||||||
@@ -200,9 +201,9 @@ namespace
|
|||||||
const auto& modules = BinaryModule::GetModules();
|
const auto& modules = BinaryModule::GetModules();
|
||||||
for (BinaryModule* module : modules)
|
for (BinaryModule* module : modules)
|
||||||
{
|
{
|
||||||
OnBinaryModuleLoaded(module);
|
FindDebugCommands(module);
|
||||||
}
|
}
|
||||||
Scripting::BinaryModuleLoaded.Bind(&OnBinaryModuleLoaded);
|
Scripting::BinaryModuleLoaded.Bind(&FindDebugCommands);
|
||||||
Scripting::ScriptsReloading.Bind(&OnScriptsReloading);
|
Scripting::ScriptsReloading.Bind(&OnScriptsReloading);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,7 +220,7 @@ public:
|
|||||||
{
|
{
|
||||||
// Cleanup
|
// Cleanup
|
||||||
ScopeLock lock(Locker);
|
ScopeLock lock(Locker);
|
||||||
Scripting::BinaryModuleLoaded.Unbind(&OnBinaryModuleLoaded);
|
Scripting::BinaryModuleLoaded.Unbind(&FindDebugCommands);
|
||||||
Scripting::ScriptsReloading.Unbind(&OnScriptsReloading);
|
Scripting::ScriptsReloading.Unbind(&OnScriptsReloading);
|
||||||
Commands.Clear();
|
Commands.Clear();
|
||||||
Inited = true;
|
Inited = true;
|
||||||
@@ -252,12 +253,12 @@ void DebugCommands::Execute(StringView command)
|
|||||||
InitCommands();
|
InitCommands();
|
||||||
|
|
||||||
// Find command to run
|
// Find command to run
|
||||||
for (const CommandData& command : Commands)
|
for (const CommandData& cmd : Commands)
|
||||||
{
|
{
|
||||||
if (name.Length() == command.Name.Length() &&
|
if (name.Length() == cmd.Name.Length() &&
|
||||||
StringUtils::CompareIgnoreCase(name.Get(), command.Name.Get(), name.Length()) == 0)
|
StringUtils::CompareIgnoreCase(name.Get(), cmd.Name.Get(), name.Length()) == 0)
|
||||||
{
|
{
|
||||||
command.Invoke(args);
|
cmd.Invoke(args);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ API_CLASS(static) class FLAXENGINE_API DebugCommands
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Executees the command.
|
/// Executes the command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="command">The command line (optionally with arguments).</param>
|
/// <param name="command">The command line (optionally with arguments).</param>
|
||||||
API_FUNCTION() static void Execute(StringView command);
|
API_FUNCTION() static void Execute(StringView command);
|
||||||
|
|||||||
Reference in New Issue
Block a user