WolvenKit Scripting
Public Member Functions | List of all members
AppScriptFunctions Class Reference

TODO More...

Inheritance diagram for AppScriptFunctions:
ScriptFunctions

Public Member Functions

void SuspendFileWatcher (bool suspend)
 Turn on/off updates to the project tree, useful for when making lots of changes to the project structure. More...
 
virtual void SaveToProject (string path, CR2WFile cr2w)
 Add the specified cr2w file to the project from the game archives. More...
 
virtual void SaveToProject (string path, IGameFile gameFile)
 Add the specified gameFile file to the project from the game archives. More...
 
virtual void SaveToRaw (string path, string content)
 Save the specified text to the specified path in the raw folder More...
 
virtual void SaveToResources (string path, string content)
 Save the specified text to the specified path in the resources folder More...
 
virtual ? string LoadFromResources (string path)
 Loads the content of a text file from resources More...
 
virtual ? object LoadGameFileFromProject (string path, string type)
 Loads the specified game file from the project files rather than game archives. More...
 
virtual ? object LoadRawJsonFromProject (string path, string type)
 Loads the specified json file from the project raw files rather than game archives. More...
 
List< string > GetProjectFiles (string folderType)
 Retrieves a list of files from the project More...
 
void ExportFiles (IList fileList, ScriptObject? defaultSettings=null)
 Exports a list of files as you would with the export tool. More...
 
virtual ? object GetFileFromProject (string path, OpenAs openAs)
 Loads a file from the project using either a file path or hash More...
 
virtual ? object GetFileFromProject (ulong hash, OpenAs openAs)
 Loads a file from the project using either a file path or hash More...
 
virtual ? object GetFile (string path, OpenAs openAs)
 Loads a file from the project or archive (in this order) using either a file path or hash More...
 
virtual ? object GetFile (ulong hash, OpenAs openAs)
 Loads a file from the project or archive (in this order) using either a file path or hash More...
 
virtual bool FileExistsInProject (string path)
 Check if file exists in the project More...
 
virtual bool FileExistsInProject (ulong hash)
 Check if file exists in the project More...
 
virtual bool FileExists (string path)
 Check if file exists in either the game archives or the project More...
 
virtual bool FileExists (ulong hash)
 Check if file exists in either the game archives or the project More...
 
virtual bool FileExistsInRaw (string filepath)
 Check if file exists in the project Raw folder More...
 
virtual IEnumerable GetRecords ()
 Loads all records as TweakDBID paths. More...
 
virtual IEnumerable GetFlats ()
 Loads all flats as TweakDBID paths. More...
 
virtual IEnumerable GetQueries ()
 Loads all queries as TweakDBID paths. More...
 
virtual IEnumerable GetGroupTags ()
 Loads all group tags as TweakDBID paths. More...
 
virtual ? string GetRecord (string path)
 Loads a record by its TweakDBID path. More...
 
virtual ? string GetFlat (string path)
 Loads a flat by its TweakDBID path. More...
 
virtual IEnumerable GetQuery (string path)
 Loads flats of a query by its TweakDBID path. More...
 
virtual ? byte GetGroupTag (string path)
 Loads a group tag by its TweakDBID path. More...
 
virtual bool HasTDBID (string path)
 Whether TweakDBID path exists as a flat or a record? More...
 
virtual ? string GetTDBIDPath (ulong key)
 Tries to get TweakDBID path from its hash. More...
 
virtual WMessageBoxResult ShowMessageBox (string text, string caption, WMessageBoxImage image, WMessageBoxButtons buttons)
 Displays a message box More...
 
virtual void Extract (string path)
 Extracts a file from the base archive and adds it to the project More...
 
virtual ? ScriptDocumentWrapper GetActiveDocument ()
 Gets the current active document from the docking manager More...
 
virtual ? IList< ScriptDocumentWrapperGetDocuments ()
 Gets all documents from the docking manager More...
 
virtual bool OpenDocument (string path)
 Opens a file in WolvenKit More...
 
virtual void OpenDocument (IGameFile gameFile)
 Opens an archive game file More...
 
virtual ? string ExportGeometryCacheEntry (string sectorHashStr, string entryHashStr)
 Exports an geometry_cache entry More...
 
virtual ? object CreateInstanceAsJSON (string className)
 Creates a new instance of the given class, and returns it converted to a JSON string More...
 
virtual ? ulong HashString (string data, string method)
 Returns the hashcode for a given string More...
 
- Public Member Functions inherited from ScriptFunctions
virtual IEnumerable GetArchiveFiles ()
 Gets a list of the files available in the game archives Note to myself: Don't use IEnumerable<T> More...
 
virtual ? IGameFile GetFileFromBase (string path)
 DEPRECATED: Please use GetFileFromArchive(path, OpenAs.GameFile) Loads a file from the base archives using either a file path or hash More...
 
virtual ? IGameFile GetFileFromBase (ulong hash)
 DEPRECATED: Please use GetFileFromArchive(hash, OpenAs.GameFile) Loads a file from the base archives using either a file path or hash More...
 
virtual ? string GameFileToJson (IGameFile gameFile)
 Creates a json representation of the specifed game file. More...
 
virtual ? CR2WFile JsonToCR2W (string json)
 Creates a CR2W game file from a json More...
 
virtual string ChangeExtension (string path, string extension)
 Changes the extension of the provided string path More...
 
virtual ? object GetFileFromArchive (string path, OpenAs openAs)
 Loads a file from the base archives using either a file path or hash More...
 
virtual ? object GetFileFromArchive (ulong hash, OpenAs openAs)
 Loads a file from the base archives using either a file path or hash More...
 
virtual bool FileExistsInArchive (string path)
 Check if file exists in the game archives More...
 
virtual bool FileExistsInArchive (ulong hash)
 Check if file exists in the game archives More...
 
virtual string YamlToJson (string yamlText)
 Converts a YAML string to a JSON string More...
 
virtual string JsonToYaml (string jsonText)
 Converts a JSON string to a YAML string More...
 

Detailed Description

TODO

Member Function Documentation

◆ CreateInstanceAsJSON()

virtual ? object AppScriptFunctions.CreateInstanceAsJSON ( string  className)
virtual

Creates a new instance of the given class, and returns it converted to a JSON string

Parameters
classNameName of the class
Returns

◆ ExportFiles()

void AppScriptFunctions.ExportFiles ( IList  fileList,
ScriptObject?  defaultSettings = null 
)

Exports a list of files as you would with the export tool.

Parameters
fileList
defaultSettings
blocking

◆ ExportGeometryCacheEntry()

virtual ? string AppScriptFunctions.ExportGeometryCacheEntry ( string  sectorHashStr,
string  entryHashStr 
)
virtual

Exports an geometry_cache entry

Parameters
sectorHashStrSector hash as string
entryHashStrEntry hash as string
Returns
Exceptions
Exception

◆ Extract()

virtual void AppScriptFunctions.Extract ( string  path)
virtual

Extracts a file from the base archive and adds it to the project

Parameters
pathPath of the game file

◆ FileExists() [1/2]

virtual bool AppScriptFunctions.FileExists ( string  path)
virtual

Check if file exists in either the game archives or the project

Parameters
pathfile path to check
Returns

◆ FileExists() [2/2]

virtual bool AppScriptFunctions.FileExists ( ulong  hash)
virtual

Check if file exists in either the game archives or the project

Parameters
hashhash value to be checked
Returns

◆ FileExistsInProject() [1/2]

virtual bool AppScriptFunctions.FileExistsInProject ( string  path)
virtual

Check if file exists in the project

Parameters
pathfile path to check
Returns

◆ FileExistsInProject() [2/2]

virtual bool AppScriptFunctions.FileExistsInProject ( ulong  hash)
virtual

Check if file exists in the project

Parameters
hashhash value to be checked
Returns

◆ FileExistsInRaw()

virtual bool AppScriptFunctions.FileExistsInRaw ( string  filepath)
virtual

Check if file exists in the project Raw folder

Parameters
filepathrelative filepath to be checked
Returns

◆ GetActiveDocument()

virtual ? ScriptDocumentWrapper AppScriptFunctions.GetActiveDocument ( )
virtual

Gets the current active document from the docking manager

Returns

◆ GetDocuments()

virtual ? IList<ScriptDocumentWrapper> AppScriptFunctions.GetDocuments ( )
virtual

Gets all documents from the docking manager

Returns

◆ GetFile() [1/2]

virtual ? object AppScriptFunctions.GetFile ( string  path,
OpenAs  openAs 
)
virtual

Loads a file from the project or archive (in this order) using either a file path or hash

Parameters
pathThe path of the file to retrieve
openAsThe output format (OpenAs.GameFile, OpenAs.CR2W or OpenAs.Json)
Returns

◆ GetFile() [2/2]

virtual ? object AppScriptFunctions.GetFile ( ulong  hash,
OpenAs  openAs 
)
virtual

Loads a file from the project or archive (in this order) using either a file path or hash

Parameters
hashThe hash of the file to retrieve
openAsThe output format (OpenAs.GameFile, OpenAs.CR2W or OpenAs.Json)
Returns

◆ GetFileFromProject() [1/2]

virtual ? object AppScriptFunctions.GetFileFromProject ( string  path,
OpenAs  openAs 
)
virtual

Loads a file from the project using either a file path or hash

Parameters
pathThe path of the file to retrieve
openAsThe output format (OpenAs.GameFile, OpenAs.CR2W or OpenAs.Json)
Returns

◆ GetFileFromProject() [2/2]

virtual ? object AppScriptFunctions.GetFileFromProject ( ulong  hash,
OpenAs  openAs 
)
virtual

Loads a file from the project using either a file path or hash

Parameters
hashThe hash of the file to retrieve
openAsThe output format (OpenAs.GameFile, OpenAs.CR2W or OpenAs.Json)
Returns

◆ GetFlat()

virtual ? string AppScriptFunctions.GetFlat ( string  path)
virtual

Loads a flat by its TweakDBID path.

Returns
flat as a JSON string, null when not found

◆ GetFlats()

virtual IEnumerable AppScriptFunctions.GetFlats ( )
virtual

Loads all flats as TweakDBID paths.

Returns

◆ GetGroupTag()

virtual ? byte AppScriptFunctions.GetGroupTag ( string  path)
virtual

Loads a group tag by its TweakDBID path.

Returns
flat as a JSON string, null when not found

◆ GetGroupTags()

virtual IEnumerable AppScriptFunctions.GetGroupTags ( )
virtual

Loads all group tags as TweakDBID paths.

Returns

◆ GetProjectFiles()

List<string> AppScriptFunctions.GetProjectFiles ( string  folderType)

Retrieves a list of files from the project

Parameters
folderTypestring parameter folderType = "archive" or "raw"
Returns

◆ GetQueries()

virtual IEnumerable AppScriptFunctions.GetQueries ( )
virtual

Loads all queries as TweakDBID paths.

Returns

◆ GetQuery()

virtual IEnumerable AppScriptFunctions.GetQuery ( string  path)
virtual

Loads flats of a query by its TweakDBID path.

Returns
a list of flats as TweakDBID paths, empty when not found

◆ GetRecord()

virtual ? string AppScriptFunctions.GetRecord ( string  path)
virtual

Loads a record by its TweakDBID path.

Parameters
path
Returns
record as a JSON string, null when not found

◆ GetRecords()

virtual IEnumerable AppScriptFunctions.GetRecords ( )
virtual

Loads all records as TweakDBID paths.

Returns

◆ GetTDBIDPath()

virtual ? string AppScriptFunctions.GetTDBIDPath ( ulong  key)
virtual

Tries to get TweakDBID path from its hash.

Parameters
key
Returns
path of the hash, null when undefined

◆ HashString()

virtual ? ulong AppScriptFunctions.HashString ( string  data,
string  method 
)
virtual

Returns the hashcode for a given string

Parameters
dataString to be hashed
methodHash method to use. Can be "fnv1a64" or "default" (Uses the String objects built in hash function)
Returns

◆ HasTDBID()

virtual bool AppScriptFunctions.HasTDBID ( string  path)
virtual

Whether TweakDBID path exists as a flat or a record?

Parameters
path
Returns

◆ LoadFromResources()

virtual ? string AppScriptFunctions.LoadFromResources ( string  path)
virtual

Loads the content of a text file from resources

Parameters
pathThe relative path of the text file
Returns
The content or null

◆ LoadGameFileFromProject()

virtual ? object AppScriptFunctions.LoadGameFileFromProject ( string  path,
string  type 
)
virtual

Loads the specified game file from the project files rather than game archives.

Parameters
pathThe file to open for reading
typeThe type of the object which is returned. Can be "cr2w" or "json"
Returns

◆ LoadRawJsonFromProject()

virtual ? object AppScriptFunctions.LoadRawJsonFromProject ( string  path,
string  type 
)
virtual

Loads the specified json file from the project raw files rather than game archives.

Parameters
pathThe file to open for reading
typeThe type of the object which is returned. Can be "cr2w" or "json"
Returns

◆ OpenDocument() [1/2]

virtual void AppScriptFunctions.OpenDocument ( IGameFile  gameFile)
virtual

Opens an archive game file

Parameters
gameFileThe game file to open

◆ OpenDocument() [2/2]

virtual bool AppScriptFunctions.OpenDocument ( string  path)
virtual

Opens a file in WolvenKit

Parameters
pathPath to the file
Returns
Returns true if the file was opened, otherwise it returns false

◆ SaveToProject() [1/2]

virtual void AppScriptFunctions.SaveToProject ( string  path,
CR2WFile  cr2w 
)
virtual

Add the specified cr2w file to the project from the game archives.

Parameters
pathThe file to write to
cr2wFile to be saved

◆ SaveToProject() [2/2]

virtual void AppScriptFunctions.SaveToProject ( string  path,
IGameFile  gameFile 
)
virtual

Add the specified gameFile file to the project from the game archives.

Parameters
pathThe file to write to
gameFileFile to be saved

◆ SaveToRaw()

virtual void AppScriptFunctions.SaveToRaw ( string  path,
string  content 
)
virtual

Save the specified text to the specified path in the raw folder

Parameters
pathThe file to write to
contentThe string to write to the file

◆ SaveToResources()

virtual void AppScriptFunctions.SaveToResources ( string  path,
string  content 
)
virtual

Save the specified text to the specified path in the resources folder

Parameters
pathThe file to write to
contentThe string to write to the file

◆ ShowMessageBox()

virtual WMessageBoxResult AppScriptFunctions.ShowMessageBox ( string  text,
string  caption,
WMessageBoxImage  image,
WMessageBoxButtons  buttons 
)
virtual

Displays a message box

Parameters
textA string that specifies the text to display.
captionA string that specifies the title bar caption to display.
imageA WMessageBoxImage value that specifies the icon to display.
buttonsA WMessageBoxButtons value that specifies which buttons to display.
Returns
A WMessageBoxResult value that specifies the result the message box button that was clicked by the user returned.

◆ SuspendFileWatcher()

void AppScriptFunctions.SuspendFileWatcher ( bool  suspend)

Turn on/off updates to the project tree, useful for when making lots of changes to the project structure.

Parameters
suspendbool for if updates are suspended

The documentation for this class was generated from the following file: