public void ConfigureRecord(RecordStructure rec)
        {
            this.rec = rec;
            if (rec == null)
            {
                this.filterTree.Roots = null;
            }
            else
            {
                var srs = (from sr in rec.subrecords
                           let children = sr.elements.Select(se => new ColumnElement() { Checked = false, Name = se.name, Parent = null, Record = se }).ToList()
                           select new ColumnSubrecord() { Name = string.Format("{0}: {1}", sr.name, sr.desc), Checked = false, Record = sr, Children = children }).ToList();

                // fix parents after assignments
                foreach (var sr in srs)
                {
                    foreach (var se in sr.Children)
                    {
                        se.Parent = sr;
                    }
                }

                this.filterTree.Roots = srs;
            }
        }
 public void ConfigureRecord(RecordStructure rec)
 {
     this.rec = rec;
     var srs = (from sr in rec.subrecords
                let children = sr.elements.Select(se => new SearchElement() { Checked = false, Name = se.name, Parent = null, Record = se }).ToList()
                select new SearchSubrecord() { Name = sr.name, Checked = false, Record = sr, Children = children }).ToList();
     this.filterTree.Roots = srs;
 }
 internal SearchFilterAdvanced(RecordStructure rec)
     : this()
 {
     this.ConfigureRecord(rec);
 }
        public void ConfigureRecords(IEnumerable<Record> records)
        {
            var recs = records.Select(
                x => {
                    RecordStructure rs;
                    return RecordStructure.Records.TryGetValue(x.Name, out rs) ? rs : null;
                }).Distinct();

            this.rec = (recs.Count() == 1) ? recs.FirstOrDefault() : null;
            if (this.rec == null)
            {
                this.filterTree.Roots = null;
            }
            else
            {
                this.records = records;

                var srs = (from sr in this.rec.subrecords
                           let children = sr.elements.Select(se => new BatchElement() { Name = se.name, Parent = null, Record = se, Type = BatchCondElementType.Set, Checked = false }).ToList()
                           select new BatchSubrecord() { Name = string.Format("{0}: {1}", sr.name, sr.desc), Record = sr, Children = children, Checked = false, }).ToList();

                // Construct specialized editors for FormID and related headers
#if false
                {
                    var elems = new List<TESVSnip.Data.SubrecordElement>
                    {
                        new TESVSnip.Data.SubrecordElement{name = "FormID", desc = "Form ID", hexview = true, type = "uint"}, 
                        new TESVSnip.Data.SubrecordElement{name = "Flags1", desc = "Flags 1", hexview = true, type = "uint"}, 
                        new TESVSnip.Data.SubrecordElement{name = "Flags2", desc = "Flags 2", hexview = true, type = "uint"}, 
                        new TESVSnip.Data.SubrecordElement{name = "Flags3", desc = "Flags 3", hexview = true, type = "uint"}, 
                    };
                    var frmHdr = new TESVSnip.Data.Subrecord { name = "Header", desc = "Record Header", Elements = elems };
                    var hdr = new SubrecordStructure(frmHdr);
                    var hdrElems = hdr.elements.Select(se =>
                        new BatchElement { Name = se.name, Parent = null, Record = se, Type = BatchCondElementType.Set, Checked = false }
                        ).ToList();
                    srs.Insert(0, new BatchSubrecord
                    {
                        Name = string.Format("{0}: {1}", hdr.name, hdr.desc), 
                        Record = hdr, 
                        Children = hdrElems, 
                        Checked = false, 
                    });
                }
#endif

                // fix parents after assignments
                foreach (var sr in srs)
                {
                    foreach (var se in sr.Children)
                    {
                        se.Parent = sr;
                    }
                }

                this.filterTree.Roots = srs;
            }
        }
 internal RecordColumnSelect(RecordStructure rec)
     : this()
 {
     this.ConfigureRecord(rec);
 }