Configuration now uses JSON. Fixed command line parsing
This commit is contained in:
+8
-8
@@ -1,29 +1,29 @@
|
||||
using IniParser.Model;
|
||||
using System;
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Barsik
|
||||
{
|
||||
class BaseMonitoringUnit
|
||||
{
|
||||
protected SectionData config;
|
||||
protected JsonElement config;
|
||||
protected RegistersContainer registers;
|
||||
|
||||
protected int baseAddress;
|
||||
|
||||
public BaseMonitoringUnit(SectionData config, RegistersContainer registers)
|
||||
public BaseMonitoringUnit(JsonElement config, RegistersContainer registers)
|
||||
{
|
||||
this.config = config;
|
||||
this.config = config.Clone();
|
||||
this.registers = registers;
|
||||
baseAddress = int.Parse(config.Keys["BaseAddress"]);
|
||||
baseAddress = config.GetProperty("BaseAddress").GetInt32();
|
||||
}
|
||||
|
||||
public virtual void Run()
|
||||
{
|
||||
}
|
||||
|
||||
public static BaseMonitoringUnit Create(SectionData config, RegistersContainer registers)
|
||||
public static BaseMonitoringUnit Create(JsonElement config, RegistersContainer registers)
|
||||
{
|
||||
var type = config.Keys["Type"];
|
||||
var type = config.GetProperty("Type").GetString();
|
||||
if (type == "Sensors")
|
||||
{
|
||||
return new SensorsMonitoringUnit(config, registers);
|
||||
|
||||
Reference in New Issue
Block a user