C# Класс GuaranteedRate.Sextant.Config.JsonEncompassConfig

provides a simple config fild parser for JSON files. Defaults to ASCII encoding
Наследование: IEncompassConfig
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
JsonEncompassConfig ( string configText ) : System

Описание методов

GetConfigGroup() публичный Метод

Returns a sub-section of the config.
public GetConfigGroup ( string key ) : IEncompassConfig
key string Json key of the section you want.
Результат IEncompassConfig

GetKeys() публичный Метод

Returns all keys in the json config.
public GetKeys ( ) : ICollection
Результат ICollection

GetValue() публичный Метод

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
Результат bool

GetValue() публичный Метод

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
Результат string

Init() публичный Метод

Initializes the config from a default "sextant.json" file.
public Init ( Session session ) : bool
session Session Current Encompass session
Результат bool

Init() публичный Метод

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")
Результат bool

Init() публичный Метод

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.
Результат bool

Init() публичный Метод

Loads the config from the given string. Useful for testing.
public Init ( string configAsString ) : bool
configAsString string The json string
Результат bool

JsonEncompassConfig() публичный Метод

Default constructor.
public JsonEncompassConfig ( ) : System
Результат System

Reload() публичный Метод

Reloads the config from a default "sextant.json" file.
public Reload ( Session session ) : bool
session Session Current Encompass session
Результат bool

Reload() публичный Метод

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"
Результат bool