PeanutButter
|
Contract provided by the PeanutButter INI parser. More...
Public Member Functions | |||||||
void | Load (string path) | ||||||
Attempts to load the file at the given path, discarding any existing config. | |||||||
void | Load (string path, Encoding encoding) | ||||||
Attempts to load the file at the given path, discarding any existing config. | |||||||
void | Load (string path, ParseStrategies parseStrategy) | ||||||
Attempts to load the file at the given path, discarding any existing config. | |||||||
void | Load (string path, ParseStrategies parseStrategy, Encoding encoding) | ||||||
Attempts to load the file at the given path, discarding any existing config. | |||||||
void | AddSection (string section, params string[] comments) | ||||||
Add a section by name. | |||||||
IDictionary< string, string > | GetSection (string name) | ||||||
Retrieve the collection of settings for a section by section name. | |||||||
void | SetValue (string section, string key, string value) | ||||||
Sets a value by section and key. | |||||||
string | GetValue (string section, string key, string defaultValue=null) | ||||||
Get a configured value by section and key, optionally provide a fallback default value. | |||||||
bool | HasSection (string section) | ||||||
Test if a section exists by name. | |||||||
bool | HasSetting (string section, string key) | ||||||
Test if a setting exists by section and key. | |||||||
void | RemoveSection (string section) | ||||||
Remove a section by name. | |||||||
void | RenameSection (string existingName, string newName) | ||||||
Rename a section. | |||||||
void | Merge (string iniPath, MergeStrategies mergeStrategy) | ||||||
Merges in the ini config from the provided file path. | |||||||
void | Parse (string contents) | ||||||
Parses the string contents, loading as ini config. Will remove any prior config. | |||||||
void | Persist () | ||||||
Persists to the last-loaded file, excluding merged configuration, with the default encoding. | |||||||
void | Persist (Encoding encoding) | ||||||
Persists to the last-loaded file with the provided encoding. | |||||||
void | Persist (PersistStrategies persistStrategy) | ||||||
Persists to the last-loaded file with the specified merge strategy and default encoding. | |||||||
void | Persist (PersistStrategies persistStrategy, Encoding encoding) | ||||||
Persists to the last-loaded file with the specified merge strategy and encoding. | |||||||
void | Persist (string saveToPath) | ||||||
Persists to the specified path, excluding merged configuration, with the default encoding. | |||||||
void | Persist (string saveToPath, Encoding encoding) | ||||||
Persists to the specified path, excluding merged configuration, with the specified encoding. | |||||||
void | Persist (string saveToPath, PersistStrategies persistStrategy) | ||||||
Persists to the specified path with the specified strategy and default encoding. | |||||||
void | Persist (string saveToPath, PersistStrategies persistStrategy, Encoding encoding) | ||||||
Persists to the specified path with the specified strategy and the specified encoding. | |||||||
void | Persist (Stream toStream) | ||||||
Persists to the specified stream, excluding merged configuration, with the default encoding
| |||||||
void | Persist (Stream toStream, Encoding encoding) | ||||||
Persists to the specified stream, excluding merged configuration, with the provided encoding
| |||||||
void | Persist (Stream toStream, PersistStrategies persistStrategy) | ||||||
Persists to the specified stream, excluding merged configuration
| |||||||
void | Persist (Stream toStream, PersistStrategies persistStrategy, Encoding encoding) | ||||||
Persists to the specified stream, using the provided persistence strategy and the provided encoding
| |||||||
void | Reload () | ||||||
Reload config (and all merged config) from disk. | |||||||
void | Merge (IINIFile other, MergeStrategies mergeStrategy) | ||||||
Merges another ini file into this one. | |||||||
bool | RemoveValue (string section, string key) | ||||||
Removes a value from the section. | |||||||
bool | RemoveValue (string section, string key, bool removeEmptySection) | ||||||
Removes a value from the section. |
Properties | |
Encoding | DefaultEncoding [get, set] |
The default encoding to use when persisting files. You may specify an encoding at persistence time too. | |
string | SectionSeparator [get, set] |
Separate sections with any string you like. | |
bool | AppendTrailingNewLine [get, set] |
Toggle whether a new line is added at the bottom when persisted. | |
bool | WrapValueInQuotes [get, set] |
Toggle whether key values are wrapped in quote marks when persisted. | |
string | Path [get] |
Exposes the path of the loaded INIFile. | |
IDictionary< string, string > | this[string index] [get] |
Interface to treat IINIFile like a dictionary of dictionaries. | |
IEnumerable< string > | Sections [get] |
List all the currently-available sections. | |
ParseStrategies | ParseStrategy [get, set] |
Whether or not to handle escape characters in ini values When enabled (default), then the following sequences in values are supported: \ -> backslash " -> quote. | |
IEnumerable< string > | AllSections [get] |
Provides an enumeration over all section names: whether from merging or the initial load. | |
IEnumerable< string > | MergedSections [get] |
Provides an enumeration over all merged section names. | |
ILineParser | CustomLineParser [get, set] |
Provide a custom line parser if you like. |
Contract provided by the PeanutButter INI parser.
void PeanutButter.INI.IINIFile.AddSection | ( | string | section, |
params string[] | comments ) |
Add a section by name.
section | Name of the section to add |
comments | (Optional) comments for the section |
Implemented in PeanutButter.INI.INIFile.
IDictionary< string, string > PeanutButter.INI.IINIFile.GetSection | ( | string | name | ) |
Retrieve the collection of settings for a section by section name.
name |
Implemented in PeanutButter.INI.INIFile.
string PeanutButter.INI.IINIFile.GetValue | ( | string | section, |
string | key, | ||
string | defaultValue = null ) |
Get a configured value by section and key, optionally provide a fallback default value.
section | |
key | |
defaultValue |
Implemented in PeanutButter.INI.INIFile.
bool PeanutButter.INI.IINIFile.HasSection | ( | string | section | ) |
Test if a section exists by name.
section |
Implemented in PeanutButter.INI.INIFile.
bool PeanutButter.INI.IINIFile.HasSetting | ( | string | section, |
string | key ) |
Test if a setting exists by section and key.
section | |
key |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Load | ( | string | path | ) |
Attempts to load the file at the given path, discarding any existing config.
path |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Load | ( | string | path, |
Encoding | encoding ) |
Attempts to load the file at the given path, discarding any existing config.
path | |
encoding |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Load | ( | string | path, |
ParseStrategies | parseStrategy ) |
Attempts to load the file at the given path, discarding any existing config.
path | |
parseStrategy |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Load | ( | string | path, |
ParseStrategies | parseStrategy, | ||
Encoding | encoding ) |
Attempts to load the file at the given path, discarding any existing config.
path | |
parseStrategy | |
encoding |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Merge | ( | IINIFile | other, |
MergeStrategies | mergeStrategy ) |
Merges another ini file into this one.
other | other ini file |
mergeStrategy | strategy to use when encountering conflicts |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Merge | ( | string | iniPath, |
MergeStrategies | mergeStrategy ) |
Merges in the ini config from the provided file path.
iniPath | File to merge in to current config |
mergeStrategy | Strategy to pick when merging |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Parse | ( | string | contents | ) |
Parses the string contents, loading as ini config.
Will remove any prior config.
contents |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Persist | ( | ) |
Persists to the last-loaded file, excluding merged configuration, with the default encoding.
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Persist | ( | Encoding | encoding | ) |
Persists to the last-loaded file with the provided encoding.
encoding |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Persist | ( | PersistStrategies | persistStrategy | ) |
Persists to the last-loaded file with the specified merge strategy and default encoding.
persistStrategy | Strategy to employ for merged config |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Persist | ( | PersistStrategies | persistStrategy, |
Encoding | encoding ) |
Persists to the last-loaded file with the specified merge strategy and encoding.
persistStrategy | Strategy to employ for merged config |
encoding | The encoding to use for the written file |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Persist | ( | Stream | toStream | ) |
Persists to the specified stream, excluding merged configuration, with the default encoding
toStream | Stream to persist to |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Persist | ( | Stream | toStream, |
Encoding | encoding ) |
Persists to the specified stream, excluding merged configuration, with the provided encoding
toStream | Stream to persist to |
encoding | Encoding to use |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Persist | ( | Stream | toStream, |
PersistStrategies | persistStrategy ) |
Persists to the specified stream, excluding merged configuration
toStream | Stream to persist to |
persistStrategy | Strategy to employ for merged config |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Persist | ( | Stream | toStream, |
PersistStrategies | persistStrategy, | ||
Encoding | encoding ) |
Persists to the specified stream, using the provided persistence strategy and the provided encoding
toStream | Stream to persist to |
persistStrategy | Strategy to employ for merged config |
encoding | Encoding to use |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Persist | ( | string | saveToPath | ) |
Persists to the specified path, excluding merged configuration, with the default encoding.
saveToPath |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Persist | ( | string | saveToPath, |
Encoding | encoding ) |
Persists to the specified path, excluding merged configuration, with the specified encoding.
saveToPath | |
encoding | Encoding to use |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Persist | ( | string | saveToPath, |
PersistStrategies | persistStrategy ) |
Persists to the specified path with the specified strategy and default encoding.
saveToPath | File to save to |
persistStrategy | Strategy to employ for merged config |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Persist | ( | string | saveToPath, |
PersistStrategies | persistStrategy, | ||
Encoding | encoding ) |
Persists to the specified path with the specified strategy and the specified encoding.
saveToPath | File to save to |
persistStrategy | Strategy to employ for merged config |
encoding | Encoding to use when writing the file |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.Reload | ( | ) |
Reload config (and all merged config) from disk.
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.RemoveSection | ( | string | section | ) |
bool PeanutButter.INI.IINIFile.RemoveValue | ( | string | section, |
string | key ) |
Removes a value from the section.
section | Section to remove the setting from |
key | Setting to remove |
Implemented in PeanutButter.INI.INIFile.
bool PeanutButter.INI.IINIFile.RemoveValue | ( | string | section, |
string | key, | ||
bool | removeEmptySection ) |
Removes a value from the section.
section | Section to remove the setting from |
key | Setting to remove |
removeEmptySection | Whether or not to clear out empty sections |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.RenameSection | ( | string | existingName, |
string | newName ) |
Rename a section.
existingName | Name of the existing section |
newName | New name of the section that is to be renamed |
Implemented in PeanutButter.INI.INIFile.
void PeanutButter.INI.IINIFile.SetValue | ( | string | section, |
string | key, | ||
string | value ) |
Sets a value by section and key.
section | |
key | |
value |
Implemented in PeanutButter.INI.INIFile.
|
get |
Provides an enumeration over all section names: whether from merging or the initial load.
Implemented in PeanutButter.INI.INIFile.
|
getset |
Toggle whether a new line is added at the bottom when persisted.
Implemented in PeanutButter.INI.INIFile.
|
getset |
Provide a custom line parser if you like.
Implemented in PeanutButter.INI.INIFile.
|
getset |
The default encoding to use when persisting files. You may specify an encoding at persistence time too.
Implemented in PeanutButter.INI.INIFile.
|
get |
Provides an enumeration over all merged section names.
Implemented in PeanutButter.INI.INIFile.
|
getset |
Whether or not to handle escape characters in ini values When enabled (default), then the following sequences in values are supported: \ -> backslash " -> quote.
Implemented in PeanutButter.INI.INIFile.
|
get |
Exposes the path of the loaded INIFile.
Implemented in PeanutButter.INI.INIFile.
|
get |
List all the currently-available sections.
Implemented in PeanutButter.INI.INIFile.
|
getset |
Separate sections with any string you like.
Implemented in PeanutButter.INI.INIFile.
|
get |
Interface to treat IINIFile like a dictionary of dictionaries.
index |
Implemented in PeanutButter.INI.INIFile.
|
getset |
Toggle whether key values are wrapped in quote marks when persisted.
Implemented in PeanutButter.INI.INIFile.