C# Class GuaranteedRate.Sextant.Config.JsonEncompassConfig

provides a simple config fild parser for JSON files. Defaults to ASCII encoding
Inheritance: IEncompassConfig
Afficher le fichier Open project: Guaranteed-Rate/GuaranteedRate.Sextant Class Usage Examples

Méthodes publiques

Méthode Description
GetConfigGroup ( string key ) : IEncompassConfig

Returns a sub-section of the config.

GetKeys ( ) : ICollection

Returns all keys in the json config.

GetValue ( string key, bool defaultVal ) : bool

Returns the value of the given key

GetValue ( string key, string defaultVal = null ) : string

Returns the value of the given key

Init ( Session session ) : bool

Initializes the config from a default "sextant.json" file.

Init ( Session session, string configPath ) : bool

Initializes the config from this file.

Init ( Session session, string configPath, Encoding encoding ) : bool

Initializes the config from this file.

Init ( string configAsString ) : bool

Loads the config from the given string. Useful for testing.

JsonEncompassConfig ( ) : System

Default constructor.

Reload ( Session session ) : bool

Reloads the config from a default "sextant.json" file.

Reload ( Session session, string configPath ) : bool

Reloads the config file

Private Methods

Méthode Description
JsonEncompassConfig ( string configText ) : System

Method Details

GetConfigGroup() public méthode

Returns a sub-section of the config.
public GetConfigGroup ( string key ) : IEncompassConfig
key string Json key of the section you want.
Résultat IEncompassConfig

GetKeys() public méthode

Returns all keys in the json config.
public GetKeys ( ) : ICollection
Résultat ICollection

GetValue() public méthode

Returns the value of the given key
public GetValue ( string key, bool defaultVal ) : bool
key string Full path to the key(e.g. "MyKey" or "Keys[0].MySubKey")
defaultVal bool Default value if the key is null
Résultat bool

GetValue() public méthode

Returns the value of the given key
public GetValue ( string key, string defaultVal = null ) : string
key string Full path to the key(e.g. "MyKey" or "Keys[0].MySubKey")
defaultVal string Default value if the key is null
Résultat string

Init() public méthode

Initializes the config from a default "sextant.json" file.
public Init ( Session session ) : bool
session Session Current Encompass session
Résultat bool

Init() public méthode

Initializes the config from this file.
public Init ( Session session, string configPath ) : bool
session Session Current Encompass session
configPath string Name of the config file (e.g. "myconfig.json")
Résultat bool

Init() public méthode

Initializes the config from this file.
public Init ( Session session, string configPath, Encoding encoding ) : bool
session Session Current Encompass session
configPath string Name of the config file (e.g. "myconfig.json")
encoding System.Text.Encoding Encoding of the file.
Résultat bool

Init() public méthode

Loads the config from the given string. Useful for testing.
public Init ( string configAsString ) : bool
configAsString string The json string
Résultat bool

JsonEncompassConfig() public méthode

Default constructor.
public JsonEncompassConfig ( ) : System
Résultat System

Reload() public méthode

Reloads the config from a default "sextant.json" file.
public Reload ( Session session ) : bool
session Session Current Encompass session
Résultat bool

Reload() public méthode

Reloads the config file
public Reload ( Session session, string configPath ) : bool
session Session Current Encompass session
configPath string Name of the config file e.g. "foo.json"
Résultat bool