static void ExploreType(StructureTypeDescriptor structure, HashSet <TypeDescriptor> explored) { var fields = structure.Fields; foreach (var f in fields) { if (f.Type != null && f.Type.IsStructure && explored.Add(f.Type)) { ExploreType((StructureTypeDescriptor)f.Type, explored); } if (f.SubType != null && f.SubType.IsStructure && explored.Add(f.SubType)) { ExploreType((StructureTypeDescriptor)f.SubType, explored); } } }
static void ExploreType(StructureTypeDescriptor structure, HashSet<TypeDescriptor> explored) { var fields = structure.Fields; foreach (var f in fields) { if (f.Type != null && f.Type.IsStructure && explored.Add(f.Type)) ExploreType((StructureTypeDescriptor)f.Type, explored); if (f.SubType != null && f.SubType.IsStructure && explored.Add(f.SubType)) ExploreType((StructureTypeDescriptor)f.SubType, explored); } }
private static void addtoduallist(Form1 form1, StructureTypeDescriptor sd1, StructureTypeDescriptor sd2) { int rid1 = form1.dataGridView1.Rows.Add(); int rid2 = form1.dataGridView2.Rows.Add(); if (sd1 == null) { form1.dataGridView1.Rows[rid1].Cells[0].Value = "-"; form1.dataGridView1.Rows[rid1].Cells[1].Value = ""; } else { form1.dataGridView1.Rows[rid1].Cells[0].Value = sd1._Name; form1.dataGridView1.Rows[rid1].Cells[1].Value = sd1.Fields.Length.ToString(); form1.dataGridView1.Rows[rid1].Cells[2].Value = sd1.CustomName; } if (sd2 == null) { form1.dataGridView2.Rows[rid2].Cells[0].Value = "-"; form1.dataGridView2.Rows[rid2].Cells[1].Value = ""; } else { form1.dataGridView2.Rows[rid2].Cells[0].Value = sd2._Name; form1.dataGridView2.Rows[rid2].Cells[1].Value = sd2.Fields.Length.ToString(); form1.dataGridView1.Rows[rid2].Cells[2].Value = sd2.CustomName; } var ltlv = new ListToLView(sd2, sd1, rid1, rid2); if ((sd1 != null) & (sd2 != null)) ltlv.compactivility = comparefields(sd1.Fields, sd2.Fields); listToLView.Add(ltlv); }
public ListToLView(StructureTypeDescriptor _old_item, StructureTypeDescriptor _new_item, int _old_litem, int _new_litem) { this.old_item = _old_item; this.new_item = _new_item; this.old_litem = _old_litem; this.new_litem = _new_litem; }
public static void tofieldlist(StructureTypeDescriptor sd1, DataGridView dgv, bool sortbyoffset) { dgv.Rows.Clear(); if (sd1 == null) return; var fields_ = ((StructureTypeDescriptor)sd1).Fields; if (sortbyoffset) { fields_ = ((StructureTypeDescriptor)sd1).Fields.OrderBy(w => { return w.Offset; }).ToArray(); } foreach (var fielditem in fields_) { if (fielditem == null) continue; string[] values = new string[2] { fielditem.Name, fielditem.GetFieldSignature(), }; dgv.Rows.Add(values); } }