C# Класс ALFA.SystemInfo

This class encapsulates general system information about the game environment and configuration.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AdjustGameDifficultyLevel ( bool IncreaseDifficulty ) : void

Adjust the difficulty level of the game.

DisableWer ( ) : void

Disable error reporting for the current process.

EnableWer ( ) : void

Enable error reporting for the current process.

GetCentralVaultPath ( ) : string

Get the filesystem path to the central, shared vault. Note that the server must be using the server vault plugin for this function to work.

GetCentralVaultPathForAccount ( string AccountName ) : string

Get the remote server vault path for an account, given an account name. Note that the server must be using the server vault plugin for this function to work.

GetFirstDynamicObjectId ( CLRScriptBase Script ) : uint

Get the first object id corresponding to dynamic objects. All object ids below this object id are static objects (excluding PC objects).

GetGameInstallationDirectory ( ) : string

This method gets the directory where the game is installed. The path has a trailing path separator.

GetGameObjUpdateTime ( CLRScriptBase Script ) : int

This function gets the current GameObjUpdate interval.

GetHakDirectory ( ) : string

This routine gets the home directory hak directory for the current NWN2Server instance.

GetHomeDirectory ( ) : string

This routine gets the NWN2 "Home" directory, which is the directory name by -home on the command line, or else the user's NWN2 directory under Documents.

GetModuleDirectory ( ) : string

This routine gets the directory with the module data files for the current module. The routine only works if the server was started with -moduledir.

GetModuleResourceName ( ) : string

This routine gets the resource name of the module that was passed on the server command line. Note that if the server did not have a module argument then null is returned.

GetNWNX4IniString ( string IniFileName, string SectionName, string SettingName, string DefaultValue ) : string

Read an INI file setting from a NWNX4 plugin INI. The INI must follow the Windows INI format of [Sections] with Setting=Value . Note that some plugins, such as xp_mysql, do NOT use this format and cannot use this function. The maximum string length read from the INI file by this function is MAX_PATH.

GetNWNX4IniString ( string IniFileName, string SectionName, string SettingName, string DefaultValue, int MaxValueSize ) : string

Read an INI file setting from a NWNX4 plugin INI. The INI must follow the Windows INI format of [Sections] with Setting=Value . Note that some plugins, such as xp_mysql, do NOT use this format and cannot use this function.

GetNWNX4InstallationDirectory ( ) : string

This method gets the directory where NWNX4 is installed. The path has a trailing path separator.

GetOverrideDirectory ( ) : string

This routine gets the override directory for the current NWN2Server instance.

GetSQLConnectionSettings ( ) : SQLConnectionSettings

Get the database connection settings from the SQL plugin, e.g. for use in setting up an auxiliary database connection. Throws an exception if the settings could not be found.

GetServerUdpListener ( CLRScriptBase Script ) : IPEndPoint

This routine determines the UDP listener endpoint for the server.

GetServerVaultPathForAccount ( string AccountName ) : string

Get the local server vault path for an account, given an account name. Note that the server must be using the server vault plugin for this function to work.

GetVaultStoragePluginInUse ( ) : bool

Check whether the storage plugin for xp_ServerVault is in use, implying that the central vault path is just a cache that can be purged for purge cached character requests.

IsDynamicObject ( CLRScriptBase Script, uint ObjectId ) : bool

Check whether an object is a dynamic object, i.e. one created after module startup.

IsRunningInNWN2Server ( ) : bool

Check whether the caller is running in the context of the game server process.

IsSafeFileName ( string FileName, bool AllowSeparators = false ) : bool

Check whether a file name has dangerous characters, such as path characters or references to special device names.

LoadAssemblyFromNWNX4 ( string AssemblyName ) : Assembly

This helper method loads an assembly from the NWNX4 installation directory.

SafeDeleteFile ( string FileName ) : void

Delete a file while ignoring any exceptions that may occur.

SetAdminPassword ( CLRScriptBase Script, string Password ) : void

Change the admin password.

SetDMPassword ( CLRScriptBase Script, string Password ) : void

Change the DM password.

SetGameObjUpdateTime ( CLRScriptBase Script, int GameObjUpdateTime ) : void

This function sets the GameObjUpdate interval. The default is 200 milliseconds.

SetPlayerPassword ( CLRScriptBase Script, string Password ) : void

Change the player password.

ShutdownGameServer ( CLRScriptBase Script ) : void

Request that the game server cleanly shut down. Note that NWNX4 will restart the game server afterwards in the default ALFA configuration, so this function is usually used to restart the game server, not stop it permanently.

Приватные методы

Метод Описание
FindWindowEx ( IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow ) : IntPtr
GetDlgItem ( IntPtr hDlg, int nIDDlgItem ) : IntPtr
GetExoAppDifficultySliderWindow ( IntPtr ExoAppWindow ) : IntPtr

Get the difficulty slider window from an Exo App window.

GetExoAppWindow ( ) : IntPtr

Get the Exo main app window.

GetExtendedUdpTable ( IntPtr pUdpTable, UInt32 &pdwSize, Int32 bOrder, UInt32 ulAf, UDP_TABLE_CLASS TableClass, UInt32 Reserved ) : UInt32
GetPrivateProfileStringW ( string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, UInt32 nSize, string lpFileName ) : UInt32
GetScrollInfo ( IntPtr hwnd, int fnBar, [ lpsi ) : bool
GetWindowThreadProcessId ( IntPtr hwnd, uint &lpdwProcessId ) : uint
SendMessage ( IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam ) : IntPtr
SetScrollInfo ( IntPtr hwnd, int fnBar, [ lpsi, bool fRedraw ) : int
WerAddExcludedApplication ( string pwszExeName, int bAllUsers ) : UInt32
WerRemoveExcludedApplication ( string pwszExeName, int bAllUsers ) : UInt32

Описание методов

AdjustGameDifficultyLevel() публичный статический Метод

Adjust the difficulty level of the game.
public static AdjustGameDifficultyLevel ( bool IncreaseDifficulty ) : void
IncreaseDifficulty bool Supplies true to increase /// difficulty, else false to reduce it. Nothing happens if the game /// is already at the highest difficulty and an attempt to increase it, /// or vice versa, is made.
Результат void

DisableWer() публичный статический Метод

Disable error reporting for the current process.
public static DisableWer ( ) : void
Результат void

EnableWer() публичный статический Метод

Enable error reporting for the current process.
public static EnableWer ( ) : void
Результат void

GetCentralVaultPath() публичный статический Метод

Get the filesystem path to the central, shared vault. Note that the server must be using the server vault plugin for this function to work.
public static GetCentralVaultPath ( ) : string
Результат string

GetCentralVaultPathForAccount() публичный статический Метод

Get the remote server vault path for an account, given an account name. Note that the server must be using the server vault plugin for this function to work.
public static GetCentralVaultPathForAccount ( string AccountName ) : string
AccountName string
Результат string

GetFirstDynamicObjectId() публичный статический Метод

Get the first object id corresponding to dynamic objects. All object ids below this object id are static objects (excluding PC objects).
public static GetFirstDynamicObjectId ( CLRScriptBase Script ) : uint
Script CLRScriptFramework.CLRScriptBase Supplies the caller's script object.
Результат uint

GetGameInstallationDirectory() публичный статический Метод

This method gets the directory where the game is installed. The path has a trailing path separator.
public static GetGameInstallationDirectory ( ) : string
Результат string

GetGameObjUpdateTime() публичный статический Метод

This function gets the current GameObjUpdate interval.
public static GetGameObjUpdateTime ( CLRScriptBase Script ) : int
Script CLRScriptFramework.CLRScriptBase Supplies the caller's script object.
Результат int

GetHakDirectory() публичный статический Метод

This routine gets the home directory hak directory for the current NWN2Server instance.
public static GetHakDirectory ( ) : string
Результат string

GetHomeDirectory() публичный статический Метод

This routine gets the NWN2 "Home" directory, which is the directory name by -home on the command line, or else the user's NWN2 directory under Documents.
public static GetHomeDirectory ( ) : string
Результат string

GetModuleDirectory() публичный статический Метод

This routine gets the directory with the module data files for the current module. The routine only works if the server was started with -moduledir.
public static GetModuleDirectory ( ) : string
Результат string

GetModuleResourceName() публичный статический Метод

This routine gets the resource name of the module that was passed on the server command line. Note that if the server did not have a module argument then null is returned.
public static GetModuleResourceName ( ) : string
Результат string

GetNWNX4IniString() публичный статический Метод

Read an INI file setting from a NWNX4 plugin INI. The INI must follow the Windows INI format of [Sections] with Setting=Value . Note that some plugins, such as xp_mysql, do NOT use this format and cannot use this function. The maximum string length read from the INI file by this function is MAX_PATH.
public static GetNWNX4IniString ( string IniFileName, string SectionName, string SettingName, string DefaultValue ) : string
IniFileName string Supplies the INI file name, such as /// "AuroraServerVault.ini". The file name should not include a path /// component.
SectionName string Supplies the section name, such as /// "Settings".
SettingName string Supplies the setting name, such as /// "LocalServerVaultPath".
DefaultValue string Supplies the default value to return if /// the setting didn't exist.
Результат string

GetNWNX4IniString() публичный статический Метод

Read an INI file setting from a NWNX4 plugin INI. The INI must follow the Windows INI format of [Sections] with Setting=Value . Note that some plugins, such as xp_mysql, do NOT use this format and cannot use this function.
public static GetNWNX4IniString ( string IniFileName, string SectionName, string SettingName, string DefaultValue, int MaxValueSize ) : string
IniFileName string Supplies the INI file name, such as /// "AuroraServerVault.ini". The file name should not include a path /// component.
SectionName string Supplies the section name, such as /// "Settings".
SettingName string Supplies the setting name, such as /// "LocalServerVaultPath".
DefaultValue string Supplies the default value to return if /// the setting didn't exist.
MaxValueSize int Supplies the maximum length of the /// string value to read from the INI file. This must be at least as /// long as the DefaultValue length.
Результат string

GetNWNX4InstallationDirectory() публичный статический Метод

This method gets the directory where NWNX4 is installed. The path has a trailing path separator.
public static GetNWNX4InstallationDirectory ( ) : string
Результат string

GetOverrideDirectory() публичный статический Метод

This routine gets the override directory for the current NWN2Server instance.
public static GetOverrideDirectory ( ) : string
Результат string

GetSQLConnectionSettings() публичный статический Метод

Get the database connection settings from the SQL plugin, e.g. for use in setting up an auxiliary database connection. Throws an exception if the settings could not be found.
public static GetSQLConnectionSettings ( ) : SQLConnectionSettings
Результат SQLConnectionSettings

GetServerUdpListener() публичный статический Метод

This routine determines the UDP listener endpoint for the server.
public static GetServerUdpListener ( CLRScriptBase Script ) : IPEndPoint
Script CLRScriptFramework.CLRScriptBase Supplies the caller's script object.
Результат System.Net.IPEndPoint

GetServerVaultPathForAccount() публичный статический Метод

Get the local server vault path for an account, given an account name. Note that the server must be using the server vault plugin for this function to work.
public static GetServerVaultPathForAccount ( string AccountName ) : string
AccountName string
Результат string

GetVaultStoragePluginInUse() публичный статический Метод

Check whether the storage plugin for xp_ServerVault is in use, implying that the central vault path is just a cache that can be purged for purge cached character requests.
public static GetVaultStoragePluginInUse ( ) : bool
Результат bool

IsDynamicObject() публичный статический Метод

Check whether an object is a dynamic object, i.e. one created after module startup.
public static IsDynamicObject ( CLRScriptBase Script, uint ObjectId ) : bool
Script CLRScriptFramework.CLRScriptBase Supplies the caller's script object.
ObjectId uint Supplies the object id to check.
Результат bool

IsRunningInNWN2Server() публичный статический Метод

Check whether the caller is running in the context of the game server process.
public static IsRunningInNWN2Server ( ) : bool
Результат bool

IsSafeFileName() публичный статический Метод

Check whether a file name has dangerous characters, such as path characters or references to special device names.
public static IsSafeFileName ( string FileName, bool AllowSeparators = false ) : bool
FileName string Supplies the file name to check.
AllowSeparators bool Supplies true if separators are /// allowed.
Результат bool

LoadAssemblyFromNWNX4() публичный статический Метод

This helper method loads an assembly from the NWNX4 installation directory.
public static LoadAssemblyFromNWNX4 ( string AssemblyName ) : Assembly
AssemblyName string Supplies the DLL file name of the /// assembly to load. The assembly should be present in the NWNX4 /// installation directory.
Результат System.Reflection.Assembly

SafeDeleteFile() публичный статический Метод

Delete a file while ignoring any exceptions that may occur.
public static SafeDeleteFile ( string FileName ) : void
FileName string Supplies the name of the file to /// delete.
Результат void

SetAdminPassword() публичный статический Метод

Change the admin password.
public static SetAdminPassword ( CLRScriptBase Script, string Password ) : void
Script CLRScriptFramework.CLRScriptBase Supplies the caller's script object.
Password string Supplies the new password to set.
Результат void

SetDMPassword() публичный статический Метод

Change the DM password.
public static SetDMPassword ( CLRScriptBase Script, string Password ) : void
Script CLRScriptFramework.CLRScriptBase Supplies the caller's script object.
Password string Supplies the new password to set.
Результат void

SetGameObjUpdateTime() публичный статический Метод

This function sets the GameObjUpdate interval. The default is 200 milliseconds.
public static SetGameObjUpdateTime ( CLRScriptBase Script, int GameObjUpdateTime ) : void
Script CLRScriptFramework.CLRScriptBase Supplies the caller's script object.
GameObjUpdateTime int Supplies the new game object update /// time, in milliseconds.
Результат void

SetPlayerPassword() публичный статический Метод

Change the player password.
public static SetPlayerPassword ( CLRScriptBase Script, string Password ) : void
Script CLRScriptFramework.CLRScriptBase Supplies the caller's script object.
Password string Supplies the new password to set.
Результат void

ShutdownGameServer() публичный статический Метод

Request that the game server cleanly shut down. Note that NWNX4 will restart the game server afterwards in the default ALFA configuration, so this function is usually used to restart the game server, not stop it permanently.
public static ShutdownGameServer ( CLRScriptBase Script ) : void
Script CLRScriptFramework.CLRScriptBase Supplies the caller's script object.
Результат void