using Yw.Model; namespace Yw.WinFrmUI { /// /// 构件信息拓展 /// public static class HydroParterInfoExtensions { /// /// 匹配 /// public static HydroSourceInfo Matching(this List allSourceList, List flags) { if (allSourceList == null || allSourceList.Count < 1) { return default; } allSourceList.ForEach(x => { if (x.Flags == null) { x.Flags = new List(); } }); var sourceList = allSourceList.OrderBy(x => x.Flags.Distinct().Count()).ToList(); return sourceList.Find(x => x.Flags.ContainsC(flags)); } /// /// 匹配 /// public static HydroNodeInfo Matching(this List allNodeList, List flags) { if (allNodeList == null || allNodeList.Count < 1) { return default; } allNodeList.ForEach(x => { if (x.Flags == null) { x.Flags = new List(); } }); var nodeList = allNodeList.OrderBy(x => x.Flags.Distinct().Count()).ToList(); return nodeList.Find(x => x.Flags.ContainsC(flags)); } /// /// 匹配 /// public static HydroLinkInfo Matching(this List allLinkList, List flags) { if (allLinkList == null || allLinkList.Count < 1) { return default; } allLinkList.ForEach(x => { if (x.Flags == null) { x.Flags = new List(); } }); var linkList = allLinkList.OrderBy(x => x.Flags.Distinct().Count()).ToList(); return linkList.Find(x => x.Flags.ContainsC(flags)); } } }