Skip to content
Snippets Groups Projects
Commit 5ac02fa4 authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

Change Module.Init api: Remove ConfigParser

ConfigParser is available via ConfigSection.
parent 11fcd08b
Branches
No related tags found
No related merge requests found
......@@ -89,14 +89,14 @@ namespace i3csstatus {
interface Module
{
IEnumerable<Element> Get();
void Init(StatusBar _bar, ConfigParser config, ConfigSection section);
void Init(StatusBar _bar, ConfigSection section);
}
[ModuleName("constant")]
class ModuleConstant: Module
{
string text;
Color color;
public void Init(StatusBar _bar, ConfigParser config, ConfigSection section)
public void Init(StatusBar _bar, ConfigSection section)
{
text = section.Mandatory("text");
color = section?["color"]?.AsColor() ?? System.Drawing.ColorTranslator.FromHtml("white");
......@@ -113,7 +113,7 @@ namespace i3csstatus {
InnerStatusBar ifNotFound;
InnerStatusBar ifReadError;
Parser parser;
public void Init(StatusBar _bar, ConfigParser config, ConfigSection section)
public void Init(StatusBar _bar, ConfigSection section)
{
path = section.Mandatory("path").AsPath();
ifNotFound = new InnerStatusBar(_bar, section.Optional("not_found_handler")?.AsConfig() ??
......@@ -166,7 +166,7 @@ text = ERR
int scheudleIn_ms;
bool pipeError = false;
Parser parser;
public void Init(StatusBar _bar, ConfigParser config, ConfigSection section)
public void Init(StatusBar _bar, ConfigSection section)
{
bar = _bar;
path = section.Mandatory("path").AsPath();
......@@ -258,7 +258,7 @@ text = ERR
int maxOld_ms;
int showOld_ms;
int timeout_ms;
public void Init(StatusBar _bar, ConfigParser config, ConfigSection section)
public void Init(StatusBar _bar, ConfigSection section)
{
bar = _bar;
url = section.Mandatory("url").AsString();
......@@ -429,7 +429,7 @@ text = ERR
}
}
}
public void Init(StatusBar _bar, ConfigParser config, ConfigSection section)
public void Init(StatusBar _bar, ConfigSection section)
{
name = section["name"];
configuration = section.Optional("config")?.AsString();
......@@ -480,7 +480,7 @@ text = ERR
if(constructor == null)
throw new Exception($"Missing constructor of {type} module");
Module module = (Module) constructor.Invoke(new object[]{});
module.Init(this, p, s);
module.Init(this, s);
modules.Add(module);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment