Show/Hide Toolbars

Inventu Viewer+ Single Signon Server Extension

Manages complex text expressions currently used in a number of actions including PutScreen and SetField.

 

Contains Three classes:  TextExp, LitExp and VarExp

 

TextExp Class

 

A text expression is identified by matching single or double quotes and can include a backslash (\) to enable inclusion of a quote without terminating the text string parsing.

 

Field/variable values can be included without concatenation using the common Mustache/Handlebars syntax of double curly-braces ({{varname}}).

 

The Constructor takes the whole text expression as a parameter and compiles it into a list of LitExp and VarExp objects, each of which is either a simple text string or a field name reference.  The Exec method then evaluates the list and returns a whole string, concatenating variables from the active dictionary.

 

public string Exec(HostScreen oScreen, Dictionary<string, object> connectInfo)

 

Using a simple StringBuilder concatenation runs through the list of expressions to create the return string.

LitExp Class

A very simple class that contains a simple text value that is returned with the GetText method

 

virtual public string GetText(HostScreen oScreen, Dictionary<string, object> connectInfo)

 

VarExp Class

Another simple class that inherits from LitExp so that the TextExp class can just maintain a list of TextExp objects and call the GetText in each one.  Instead of holding a simple text value to return, the VarExp class contains a Field/variable name--it overrides GetText and returns the value found in the connectInfo dictionary.  If the Field name is not found it returns an empty string.