script_resource_file_utils.h File Reference

Go to the source code of this file.

Functions

ScripterExport bool  LocateScriptResourceFile (const MCHAR *scriptFileName, MSTR &resourceFileName)
  Locates the resource file for the specified script file name.
ScripterExport HashTable *  LoadScriptResourceFile (const MCHAR *resourceFileName)
  Loads the specified resource file.
ScripterExport TSTR  GetSystemLocaleName (bool user_default_locale)
  Returns the system's localization language and country name.
ScripterExport TSTR  GetMaxLocaleName ()
  Returns Max's localization language and country name.

Function Documentation

ScripterExport bool LocateScriptResourceFile ( const MCHAR *  scriptFileName,
MSTR resourceFileName 
)

Locates the resource file for the specified script file name.

The filename portion of the resource file name is the script file name plus a ".res" extension ([script.res] = <scriptname>.res). The resource file is looked for in the following locations, in the order given:

  • The directory the script file is in ([scriptdir]\[script.res])
  • A subdirectory of the directory the script file is in, where the subdirectory name is the localization name (en-US, fr-FR, ja-JP, etc.) ([scriptdir]<lang>\[script.res])
  • IFF script is in install tree, the localized shadow directory under the install directory ([installdir]<lang>\[shadow tree]\[script.res])
  • The en-US subdirectory of the directory the script file is in ([scriptdir]-US\[script.res])
  • IFF script is in install tree, the english shadow directory under the install directory ([installdir]-US\[shadow tree]\[script.res])
    Parameters:
    [in] scriptFileName - The fully qualified script file name
    [out] resourceFileName - The resource file name if found
    Returns:
    True if the resource file name was located.
ScripterExport HashTable* LoadScriptResourceFile ( const MCHAR *  resourceFileName )

Loads the specified resource file.

Each line in the resource file consists of the resource id and the resource value. This creates and returns a HashTable where the resource id is the key and the resource value is the value. If the resource file does not exist, NULL will be returned.

Parameters:
resourceFileName - The fully qualified resource file name
Returns:
Pointer to HashTable containing the resource id/resource value pairs, or NULL if the resource file doesn't exist. Note: this function will throw a MAXScriptException if an error occurs while processing the resource file
ScripterExport TSTR GetSystemLocaleName ( bool  user_default_locale )

Returns the system's localization language and country name.

The system's localization language and country name are determined by querying the system for its ISO languange and country locale names.

Parameters:
[in] user_default_locale - If true, default locale for the user is returned. If false, default locale for the system is returned.
Returns:
The system's 2-letter localization language and country names in the form <language>-<country>, for example, 'en-US'.
ScripterExport TSTR GetMaxLocaleName ( )

Returns Max's localization language and country name.

Max's localization language and country name are determined by querying Max for its language id and returning the appropriate ISO language and country locale name.

Returns:
Max's 2-letter localization language and country names in the form <language>-<country>, for example, 'en-US'. Note: the return value will be one of the following: "ja-JP", "zh-CN", "ko-KR", "de-DE", "fr-FR", "en-US".