namespace IStation.Service { /// /// /// public partial class ScheduleConfig { private readonly string _filePath = Path.Combine( Settings.ParasHelper.LocalFile.DataFolderDirectory, Settings.ParasHelper.LocalFile.ScheduleConfigFile); private Model.ChScheduleConfig _model = null; /// /// /// /// public Model.ChScheduleConfig Get() { if (_model == null) { if (!File.Exists(_filePath)) return default; var json = File.ReadAllText(_filePath); _model = JsonHelper.Json2Object(json); } return _model; } /// /// 获取一输水 /// public Model.ScheduleConfig GetStation1() { var config = Get(); return config?.Station1; } /// /// 获取二输水 /// public Model.ScheduleConfig GetStation2() { var config = Get(); return config?.Station2; } /// /// 保存 /// /// /// public bool Save(Model.ChScheduleConfig model) { _model = model; if (model == null) return false; var json = JsonHelper.Object2Json(model); File.WriteAllText(_filePath, json); return true; } } }