-
-
Notifications
You must be signed in to change notification settings - Fork 53
Warp Object
Warp object is a representative of the tool and serves to provide access to values & functions outside the scope of Exe and System objects.
- Properties
- [Encryption functions]
- File loaders
- Display functions
- [Patch state functions]
- [Messaging functions]
- Message Control functions
Property name | Description |
---|---|
Warp.Path |
Current running directory |
Warp.Version |
Current version of the tool |
Warp.TestMode |
Boolean to indicate whether running from Test Bench or not |
Warp.SrcExe |
Path to the source exe. DO NOT MODIFY THIS IN SCRIPTS
|
Warp.TgtExe |
Path to the target exe. DO NOT MODIFY THIS IN SCRIPTS
|
Warp.SelCount |
No of selected patches. |
Warp.TestDir |
Only in Test Bench. Current Test Directory from which the exe files have been listed. |
Warp.ExtnSelCount |
Only in Test Bench. No of selected extensions. |
Warp.ExeSelCount |
Only in Test Bench. No of selected test exe files. |
These functions allow you to use encrypted QJS code in your patches & extensions.
Encrypts the specified QJS code statements using the password & return the hex string result.
Please note that the code will not be validated with the engine at this point, so ensure you are using proper QJS code
Syntax:
Warp.Encrypt(code, pass)
Argument | Description |
---|---|
code |
The QJS statements (provided as a string) to be encrypted. |
pass |
The password to use for encryption. |
*Returns: The encryption result as a hex string.
Executes a block of encrypted code (provided as a hex string) and returns the result
Syntax:
Warp.Execute(hexstring, pass)
Argument | Description |
---|---|
hexstring |
The encrypted code which needs to be executed in the QJS engine. This can be either 1 string or an array of hex strings which will get auto-concatenated. |
pass |
The password which was used for encryption |
Returns: The result of the execution (could very well be undefined as well).
Executes a block of encrypted code (provided as a hex string) and assigns the result to the specified global variable.
The variable name itself can serve as the password. This would be useful for encrypting entire functions.
Syntax:
Warp.Define(varName, hexstring, [pass])
Argument | Description |
---|---|
varName |
The global variable name to assign the result to. |
hexstring |
The encrypted code which needs to be executed in the QJS engine. This can be either 1 string or an array of hex strings which will get auto-concatenated. |
pass |
Optional password which was used for encryption. If not provided, varName is assumed to be the password. |
Returns:
true
if successfully assigned a value elsefalse
. If the result of the execution isundefined
, it will not be assigned.
Encrypts the specified QJS file into a .ejs
file using the specified password.
Please note that the code will not be validated with the engine at this point, so ensure you are using proper QJS code
WARP loads EJS
files the same way as it loads QJS
files (except that it is encrypted), so you can just drop them in any of the folders where you would place QJS
files.
Syntax:
Warp.EncryptFile(qjsFile, pass, [dstFile])
Argument | Description |
---|---|
qjsFile |
The source QJS file to be encrypted. Please use either .qjs or .qsrc suffix for clarity. |
pass |
The password to use for encryption. |
dstFile |
Optional file path for the encrypted EJS output. If not provided, qjsFile itself is used with the suffix changed from .qjs/.qsrc to .ejs
|
Returns:
true
if successfully encrypted elsefalse
.
Loads the specified YAML file, converts the Node hierarchy into equivalent JS hierarchy and returns the result.
Syntax:
Warp.LoadYaml(path)
Argument | Description |
---|---|
path |
The file to be loaded. Any relative paths will be relative to the WARP folder. |
Returns:
the root object/array if successful elsefalse
.
If any error occurs during the loading process, a message pops up.
Loads the specified QJS file and returns its result.
Syntax:
Warp.LoadQJS(path)
Argument | Description |
---|---|
path |
The file to be loaded. Any relative paths will be relative to the WARP folder. |
Returns: the result of the last evaluated expression from the file.
Loads the specified encrypted EJS file and returns its result.
Syntax:
Warp.LoadEJS(path)
Argument | Description |
---|---|
path |
The file to be loaded. Any relative paths will be relative to the WARP folder. |
Returns: the result of the last evaluated expression from the file.
Loads the specified 'exe' file into the Exe Object. Only available in Test Bench since it is only required there.
DO NOT USE THIS WITHIN A PATCH FUNCTION
Syntax:
Warp.LoadExe(path)
Argument | Description |
---|---|
path |
The file to be loaded. Any relative paths will be relative to the WARP folder. |
Returns:
true
if successful elsefalse
.
If any error occurs during the loading process, a message pops up.
Displays the specified file/directory using the default application assigned in the OS.
Only available for the GUIs i.e. Main GUI & Test Bench. You can run it from Console but it won't do anything.
Syntax:
Warp.Show(path)
Argument | Description |
---|---|
path |
The file/directory to be opened/displayed. Any relative paths will be relative to the WARP folder. |
Displays the specified file/directory inside it's parent directory using the file browser.
Warp.ShowInDir(path)
Argument | Description |
---|---|
path |
The file/directory to be displayed. Any relative paths will be relative to the WARP folder. |
These functions pertain to the selected
state of patches.
Retrieves the selected
state of the specified patch.
Syntax:
Warp.GetPatchState(name)
Argument | Description |
---|---|
name |
The name of the patch which we want to know about (a.k.a the function name). Remember this is not the title which gets displayed |
Returns:
true
if selected elsefalse
.
Sets the selected
state of the specified patch. Mostly used for deselecting conflicting patches.
Does nothing if the new state boolean matches the existing value of selected
.
Syntax:
Warp.SetPatchState(name, state)
Argument | Description |
---|---|
name |
The name of the patch which we want to modify (a.k.a the function name). Remember this is not the title which gets displayed |
{ state
|
The new boolean selected state |
Returns:
true
if successfully set the state elsefalse
.
These functions are used for displaying message boxes explicitly from patches & extensions.
Used for informing user about something generic.
Syntax:
Warp.InformUser(title, msg)
Argument | Description |
---|---|
title |
The title to use for the Message Box. |
msg |
The message to be displayed. |
Used for warning user about some action.
Syntax:
Warp.WarnUser(title, msg)
Argument | Description |
---|---|
title |
The title to use for the Message Box. |
msg |
The message to be displayed. |
Controls the visibility of messages coming from scripts inside Script Window and Log file.
Blocks any messages from going to Script Window or Log file using a password to lock access. This includes reports about changes staged.
As a fail-safe, once the patch function completes, all messages are automatically re-allowed.
Syntax:
Warp.BlockMsgs(pass, [inform])
Argument | Description |
---|---|
pass |
The password to use for locking access to messages. |
inform |
Optional boolean to indicate whether the user should be informed that the block has happened. Default is false . |
Returns:
true
if successfully blocked elsefalse
.
Undoes a blockage made by BlockMsgs function. The password need to match with the one used while calling BlockMsgs.
Syntax:
Warp.AllowMsgs(pass, [inform])
Argument | Description |
---|---|
pass |
The password which was used for locking access to messages. |
inform |
Optional boolean to indicate whether the user should be informed that the block has been removed. Default is false . |
Returns:
true
if successfully unblocked elsefalse
.