Package ghidra.app.script
Class GhidraScriptInfoManager
java.lang.Object
ghidra.app.script.GhidraScriptInfoManager
A utility class for managing script directories and ScriptInfo objects.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
alreadyExists
(String scriptName) Looks through all of the currentScriptInfo
s to see if one already exists with the given name.void
clear ScriptInfo metadata cached by GhidraScriptUtilboolean
containsMetadata
(ResourceFile scriptFile) Returns true if a ScriptInfo object exists for the specified script file.void
dispose()
clear stored metadatafindScriptInfoByName
(String scriptName) Uses the given name to find a matching script.getExistingScriptInfo
(ResourceFile script) GetScriptInfo
forscript
under the assumption that it's already managed.getExistingScriptInfo
(String scriptName) Returns the existing script info for the given name.getScriptInfo
(ResourceFile scriptFile) Returns the script info object for the specified script file, construct a new one if necessary.get all scriptsvoid
Updates every known script's duplicate value.void
removeMetadata
(ResourceFile scriptFile) Removes the ScriptInfo object for the specified file
-
Constructor Details
-
GhidraScriptInfoManager
public GhidraScriptInfoManager()
-
-
Method Details
-
dispose
public void dispose()clear stored metadata -
clearMetadata
public void clearMetadata()clear ScriptInfo metadata cached by GhidraScriptUtil -
removeMetadata
Removes the ScriptInfo object for the specified file- Parameters:
scriptFile
- the script file
-
getScriptInfoIterable
get all scripts- Returns:
- an iterable over all script info objects
-
getScriptInfo
Returns the script info object for the specified script file, construct a new one if necessary.Only call this method if you expect to be creating ScriptInfo objects. Prefer getExistingScriptInfo instead.
- Parameters:
scriptFile
- the script file- Returns:
- the script info object for the specified script file
-
containsMetadata
Returns true if a ScriptInfo object exists for the specified script file.- Parameters:
scriptFile
- the script file- Returns:
- true if a ScriptInfo object exists
-
getExistingScriptInfo
GetScriptInfo
forscript
under the assumption that it's already managed.- Parameters:
script
- the script- Returns:
- info or null if the assumption was wrong. If null is returned, an error dialog is shown
-
getExistingScriptInfo
Returns the existing script info for the given name. The script environment limits scripts such that names are unique. If this method returns a non-null value, then the name given name is taken.- Parameters:
scriptName
- the name of the script for which to get a ScriptInfo- Returns:
- a ScriptInfo matching the given name; null if no script by that name is known to the script manager
-
alreadyExists
Looks through all of the currentScriptInfo
s to see if one already exists with the given name.- Parameters:
scriptName
- The name to check- Returns:
- true if the name is not taken by an existing
ScriptInfo
.
-
refreshDuplicates
public void refreshDuplicates()Updates every known script's duplicate value. -
findScriptInfoByName
Uses the given name to find a matching script. This method only works because of the limitation that all script names in Ghidra must be unique. If the given name has multiple script matches, then a warning will be logged.- Parameters:
scriptName
- The name for which to find a script- Returns:
- The ScriptInfo that has the given name
-