namespace IStation.Service
{
///
///
///
public partial class Scada
{
Model.Scada _model = null;
readonly string _filePath = Path.Combine(Settings.ParasHelper.LocalFile.DataFolderDirectory, Settings.ParasHelper.LocalFile.ScadaFile);
///
/// 获取
///
public Model.Scada Get()
{
if (_model == null)
{
if (!File.Exists(_filePath))
return default;
var json = File.ReadAllText(_filePath);
_model = JsonHelper.Json2Object(json);
}
return _model;
}
///
/// 保存
///
///
///
public bool Save(Model.Scada model)
{
_model = model;
if (model == null)
return false;
var json = JsonHelper.Object2Json(model);
File.WriteAllText(_filePath, json);
return true;
}
}
}