| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- namespace EEMSUIClient.Services;
- public class ConfigService(LocalFilePathInfo localFile,
- ConfigPath configPath,
- RunningData running,
- AddressInfo address)
- {
- public bool SaveDirectoryInfo()
- {
- return JsonHelper.WriteFile(configPath.FolderInfoFilePath, localFile);
- }
- public bool LoadDirectoryInfo()
- {
- if (!JsonHelper.ReadFile(configPath.FolderInfoFilePath, out LocalFilePathInfo? folder) || folder is null)
- return false;
- folder.Adapt(localFile);
- return true;
- }
- public bool SaveDeviceInfo()
- {
- return JsonHelper.WriteFile(configPath.DeviceInfoFilePath, running.DeviceInfo);
- }
- public bool LoadDeviceInfo()
- {
- if (!JsonHelper.ReadFile(configPath.DeviceInfoFilePath, out DeviceInfo? device) || device is null)
- return false;
- device.Adapt(running.DeviceInfo);
- return true;
- }
- public bool SaveConnectionInfo()
- {
- return JsonHelper.WriteFile(configPath.IPAddressFilePath, address);
- }
- public bool LoadConnectionInfo()
- {
- if (!JsonHelper.ReadFile(configPath.IPAddressFilePath, out AddressInfo? addressInfo) || addressInfo is null)
- return false;
- addressInfo.Adapt(address);
- return true;
- }
- }
|