C# Class GuaranteedRate.Sextant.Config.JsonEncompassConfig

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

Public Methods

Method 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

Method Description
JsonEncompassConfig ( string configText ) : System

Method Details

GetConfigGroup() public method

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

GetKeys() public method

Returns all keys in the json config.
public GetKeys ( ) : ICollection
return ICollection

GetValue() public method

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
return bool

GetValue() public method

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
return string

Init() public method

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

Init() public method

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")
return bool

Init() public method

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.
return bool

Init() public method

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

JsonEncompassConfig() public method

Default constructor.
public JsonEncompassConfig ( ) : System
return System

Reload() public method

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

Reload() public method

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"
return bool