[성현모] DeviceManager, Factory 리팩토링, DIO, Scanner 추가

This commit is contained in:
SHM
2026-03-09 14:21:39 +09:00
parent 2c2c94f6fa
commit 4db0c87735
17 changed files with 352 additions and 35 deletions

View File

@ -0,0 +1,52 @@
using eCIAv2.Library.Config;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace eCIAv2.Library.Services
{
public class ConfigService
{
public string ConfigPath { get; private set; } = string.Empty;
public eCIAConfig Config = new eCIAConfig();
public eCIAConfig LoadConfig(string configPath)
{
ConfigPath = configPath;
if(File.Exists(configPath) == true)
{
var configJson = File.ReadAllText(ConfigPath);
Config = JsonConvert.DeserializeObject<eCIAConfig>(configJson);
LogXnet.WriteLine($"Config read Success.", LogXLabel.INFO);
return Config;
}
LogXnet.WriteLine($"Config not exist.", LogXLabel.Error);
LogXnet.WriteLine($"ConfigPath:{ConfigPath}", LogXLabel.Error);
return null;
}
public eCIAConfig GetConfig()
{
return Config;
}
public eCIAChConfig GetConfigByCh(int ch)
{
if(Config?.Configs?.TryGetValue(ch, out var config) == true)
{
return config;
}
LogXnet.WriteLine($"Config CH {ch} not exist.", LogXLabel.Error);
return null;
}
}
}