| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Linq; |
| | | |
| | | namespace HMI.Core.Manager |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取通用参数 |
| | | /// </summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <returns></returns> |
| | | public static ParameterData GetCommonParameterByName(string name) |
| | | { |
| | | string path = PathHelper.ParameterDataPath; |
| | | if (!File.Exists(path)) return null; |
| | | List<ParameterData> datas = XmlHelper.DeserializeFromXml<List<ParameterData>>(path); |
| | | return datas.FirstOrDefault(d => d.Name == name); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 保存通用参数 |
| | | /// </summary> |
| | | /// <param name="datas"></param> |
| | |
| | | XmlHelper.SerializeToXml(path, datas); |
| | | } |
| | | |
| | | public static string GetCommonParameterValue(string path, string name) |
| | | { |
| | | if (!File.Exists(path)) return null; |
| | | List<ParameterData> datas = XmlHelper.DeserializeFromXml<List<ParameterData>>(path); |
| | | ParameterData data = datas.FirstOrDefault(d => d.Name == name); |
| | | if (data == null) return null; |
| | | return data.Value; |
| | | } |
| | | } |
| | | } |