Settings
object is created. This object is unique to each Pnyx instance. Changes to these settings only affects the owning instance.
Settings can be changed at any state prior to process method. All changes to the Settings
object are preformed with the setSettings method.
Every parameter to the method is optional so that only the desired settings are affected.const String input = "line one\nline two"; using (Pnyx p = new Pnyx()) { p.setSettings(stdIoDefault: true); p.readString(input); p.process(); // automatically writes to STD-OUT } // outputs STD-OUT: // line one // line two
SettingsHome.settingsFactory = new SettingsHome( new Settings { stdIoDefault = true // turns on globally }); const String input = "line one\nline two"; using (Pnyx p = new Pnyx()) { p.readString(input); p.process(); // automatically writes to STD-OUT } // outputs STD-OUT: // line one // line two
Settings
from a file, database or web.config, implement ISettingsFactory
. Here is an example:
public class CustomFactory : ISettingsFactory { public Settings buildSettings() { Settings result = new Settings(); // update from DB, file, web.config, etc return result; } } SettingsHome.settingsFactory = new CustomFactory(); using (Pnyx p = new Pnyx()) { // uses custom settings }