public static Grp Group(params object[] args) { Grp grp = new Grp(); for (int ndx = 0; ndx < args.Length; ndx++) { object prm = args[ndx]; if (prm is string) { grp.Add((string)prm); } else if (prm is Lit) { grp.Add((Lit)prm); } else if (prm is Grp) { grp = new Grp(grp.Union((Grp)prm)); } else if (prm is Func <Lit, int, bool> ) { grp.Add(Lit.LitDict.Values.Where((Func <Lit, int, bool>)prm)); } } return(grp); }
public static void Load(XElement root) { XElement xpN = root.Element("Groups"); foreach (XElement cur in xpN.Elements("Group")) { Grp grp = new Grp((string)cur.Attribute(@"nm")); foreach (XElement xpngl in cur.Elements("Lite")) { grp.Add((string)xpngl.Attribute(@"nm")); } } }
public static void Build(XElement vu, string Name, Lit[] LitArray) { XElement grps = vu.Element("Groups"); if (grps != null) { foreach (XElement xgrp in grps.Elements("Group")) { Grp grp = new Grp(((string)xgrp.Attribute("nm")).Replace("$", Name)); if (xgrp.Attribute("row") != null) { int rw = (int)xgrp.Attribute("row"); grp.AddRange(from l in LitArray where l.Row == rw select l); } else if (xgrp.Attribute("col") != null) { int cl = (int)xgrp.Attribute("col"); grp.AddRange(from l in LitArray where l.Column == cl select l); } } } }