alielie
2025-03-13 ba6207f52db76ab47cd6534de0cf1712674ff179
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using HMI.Core.Util;
using HMI.ParameterManage.Entity;
using System.Collections.Generic;
using System.IO;
 
namespace HMI.ParameterManage.Util
{
    public class ParameterManager
    {
        public static List<ProductData> GetProducts()
        {
            string path = Path.Combine(ParameterManage.FileFolder, "Product.setting");
            if (!File.Exists(path)) return new List<ProductData>();
            List<ProductData> datas = XmlHelper.DeserializeFromXml<List<ProductData>>(path);
            return datas;
        }
 
        public static List<ParameterData> GetParametersByProductName(string productName)
        {
            string path = Path.Combine(ParameterManage.FileFolder, "Parameter", $"Parameter_{productName}.setting");
            if (!File.Exists(path)) return new List<ParameterData>();
            List<ParameterData> datas = XmlHelper.DeserializeFromXml<List<ParameterData>>(path);
            return datas;
        }
    }
}