lixiaojun
2025-04-09 9aa8106d88fc3070498493e2819922f7ac31746e
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using Yw.Model;
 
namespace Yw.WinFrmUI
{
    /// <summary>
    /// 构件信息拓展
    /// </summary>
    public static class HydroParterInfoExtensions
    {
        /// <summary>
        /// 匹配
        /// </summary>
        public static HydroSourceInfo Matching(this List<HydroSourceInfo> allSourceList, List<string> flags)
        {
            if (allSourceList == null || allSourceList.Count < 1)
            {
                return default;
            }
            allSourceList.ForEach(x =>
            {
                if (x.Flags == null)
                {
                    x.Flags = new List<string>();
                }
            });
            var sourceList = allSourceList.OrderBy(x => x.Flags.Distinct().Count()).ToList();
            return sourceList.Find(x => x.Flags.ContainsC(flags));
        }
 
        /// <summary>
        /// 匹配
        /// </summary>
        public static HydroNodeInfo Matching(this List<HydroNodeInfo> allNodeList, List<string> flags)
        {
            if (allNodeList == null || allNodeList.Count < 1)
            {
                return default;
            }
            allNodeList.ForEach(x =>
            {
                if (x.Flags == null)
                {
                    x.Flags = new List<string>();
                }
            });
            var nodeList = allNodeList.OrderBy(x => x.Flags.Distinct().Count()).ToList();
            return nodeList.Find(x => x.Flags.ContainsC(flags));
        }
 
        /// <summary>
        /// 匹配
        /// </summary>
        public static HydroLinkInfo Matching(this List<HydroLinkInfo> allLinkList, List<string> flags)
        {
            if (allLinkList == null || allLinkList.Count < 1)
            {
                return default;
            }
            allLinkList.ForEach(x =>
            {
                if (x.Flags == null)
                {
                    x.Flags = new List<string>();
                }
            });
            var linkList = allLinkList.OrderBy(x => x.Flags.Distinct().Count()).ToList();
            return linkList.Find(x => x.Flags.ContainsC(flags));
        }
 
 
    }
}