added amb919 - GetExtensionFileStatus()
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401425
This commit is contained in:
parent
5a16141bcf
commit
38a8e8ac80
@ -41,6 +41,7 @@
|
|||||||
#include "TimerSys.h"
|
#include "TimerSys.h"
|
||||||
#include "ForwardSys.h"
|
#include "ForwardSys.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
#include "ExtensionSys.h"
|
||||||
|
|
||||||
#if defined PLATFORM_WINDOWS
|
#if defined PLATFORM_WINDOWS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -549,6 +550,33 @@ static cell_t LogToFileEx(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t GetExtensionFileStatus(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
char *str;
|
||||||
|
pContext->LocalToString(params[1], &str);
|
||||||
|
|
||||||
|
IExtension *pExtension = g_Extensions.FindExtensionByFile(str);
|
||||||
|
|
||||||
|
if (!pExtension)
|
||||||
|
{
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pExtension->IsLoaded())
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *error;
|
||||||
|
pContext->LocalToString(params[2], &error);
|
||||||
|
if (!pExtension->IsRunning(error, params[3]))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
REGISTER_NATIVES(coreNatives)
|
REGISTER_NATIVES(coreNatives)
|
||||||
{
|
{
|
||||||
{"AutoExecConfig", AutoExecConfig},
|
{"AutoExecConfig", AutoExecConfig},
|
||||||
@ -570,5 +598,7 @@ REGISTER_NATIVES(coreNatives)
|
|||||||
{"LogAction", sm_LogAction},
|
{"LogAction", sm_LogAction},
|
||||||
{"LogToFile", LogToFile},
|
{"LogToFile", LogToFile},
|
||||||
{"LogToFileEx", LogToFileEx},
|
{"LogToFileEx", LogToFileEx},
|
||||||
|
{"GetExtensionFileStatus", GetExtensionFileStatus},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -452,6 +452,19 @@ native RegPluginLibrary(const String:name[]);
|
|||||||
*/
|
*/
|
||||||
native bool:LibraryExists(const String:name[]);
|
native bool:LibraryExists(const String:name[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the status of an extension, by filename.
|
||||||
|
*
|
||||||
|
* @param name Extension name (like "sdktools.ext").
|
||||||
|
* @param error Optional error message buffer.
|
||||||
|
* @param maxlength Length of optional error message buffer.
|
||||||
|
* @return -2 if the extension was not found.
|
||||||
|
* -1 if the extension was found but failed to load.
|
||||||
|
* 0 if the extension loaded but reported an error.
|
||||||
|
* 1 if the extension is running without error.
|
||||||
|
*/
|
||||||
|
native GetExtensionFileStatus(const String:name[], String:error[]="", maxlength=0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after a library (plugin) is added that the
|
* Called after a library (plugin) is added that the
|
||||||
* current plugin references optionally.
|
* current plugin references optionally.
|
||||||
@ -470,3 +483,4 @@ forward OnLibraryRemoved(const String:name[]);
|
|||||||
|
|
||||||
#include <helpers>
|
#include <helpers>
|
||||||
#include <entity>
|
#include <entity>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user