private TextHighliter ReportType(string type, int beVerbose, string indentationHeader = "") { var tarr = type.Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries); type = tarr[tarr.Length - 1]; TextHighliter sb = new TextHighliter(); IfcType ot = IfcMetaData.IfcType(type.ToUpper()); if (ot != null) { sb.Append( string.Format(indentationHeader + "=== {0}", ot.Name), Brushes.Blue ); sb.AppendFormat(indentationHeader + "Namespace: {0}", ot.Type.Namespace); // sb.AppendFormat(indentationHeader + "Xbim Type Id: {0}", ot.TypeId); sb.DefaultBrush = Brushes.DarkOrange; List<string> supertypes = new List<string>(); var iterSuper = ot.IfcSuperType; while (iterSuper != null) { supertypes.Add(iterSuper.Name); iterSuper = iterSuper.IfcSuperType; } if (ot.IfcSuperType != null) sb.AppendFormat(indentationHeader + "Parents hierarchy: {0}", string.Join(" => ", supertypes.ToArray())); if (ot.IfcSubTypes.Count > 0) { if (beVerbose > 1) { sb.DefaultBrush = null; sb.AppendFormat(indentationHeader + "Subtypes tree:"); sb.DefaultBrush = Brushes.DarkOrange; ChildTree(ot, sb, indentationHeader, 0); } else { sb.DefaultBrush = null; sb.AppendFormat(indentationHeader + "Subtypes: {0}", ot.IfcSubTypes.Count); sb.DefaultBrush = Brushes.DarkOrange; foreach (var item in ot.IfcSubTypes) { sb.AppendFormat(indentationHeader + "- {0}", item); } } } if (beVerbose > 0) { if (beVerbose > 1) { var allSub = ot.NonAbstractSubTypes; sb.DefaultBrush = null; sb.AppendFormat(indentationHeader + "All non abstract subtypes: {0}", allSub.Count()); sb.DefaultBrush = Brushes.DarkOrange; foreach (var item in allSub) { sb.AppendFormat(indentationHeader + "- {0}", item.Name); } } sb.DefaultBrush = null; sb.AppendFormat(indentationHeader + "Interfaces: {0}", ot.Type.GetInterfaces().Count()); sb.DefaultBrush = Brushes.DarkOrange; foreach (var item in ot.Type.GetInterfaces()) { sb.AppendFormat(indentationHeader + "- {0}", item.Name); } sb.DefaultBrush = null; // sb.DefaultBrush = Brushes.DimGray; sb.AppendFormat(indentationHeader + "Properties: {0}", ot.IfcProperties.Count()); sb.DefaultBrush = null; Brush[] brushArray = new Brush[] { Brushes.DimGray, Brushes.DarkGray, Brushes.DimGray }; foreach (var item in ot.IfcProperties.Values) { var topParent = ot.IfcSuperType; string sTopParent = ""; while (topParent != null && topParent.IfcProperties.Where(x => x.Value.PropertyInfo.Name == item.PropertyInfo.Name).Count() > 0) { sTopParent = " \tfrom: " + topParent.ToString(); topParent = topParent.IfcSuperType; } sb.AppendSpans( new string[] { indentationHeader + "- " + item.PropertyInfo.Name + "\t\t", CleanPropertyName(item.PropertyInfo.PropertyType.FullName), sTopParent }, brushArray); // sb.AppendFormat(\t{1}{2}", , , ); } sb.AppendFormat(indentationHeader + "Inverses: {0}", ot.IfcInverses.Count()); foreach (var item in ot.IfcInverses) { var topParent = ot.IfcSuperType; string sTopParent = ""; while (topParent != null && topParent.IfcInverses.Where(x => x.PropertyInfo.Name == item.PropertyInfo.Name).Count() > 0) { sTopParent = " \tfrom: " + topParent.ToString(); topParent = topParent.IfcSuperType; } //sb.AppendFormat(indentationHeader + "- {0}\t{1}{2}", item.PropertyInfo.Name, CleanPropertyName(item.PropertyInfo.PropertyType.FullName), sTopParent); sb.AppendSpans( new string[] { indentationHeader + "- " + item.PropertyInfo.Name + "\t\t", CleanPropertyName(item.PropertyInfo.PropertyType.FullName), sTopParent }, brushArray); } } sb.DefaultBrush = null; sb.AppendFormat(""); } else { // test to see if it's a select type... Module ifcModule2 = typeof(IfcMaterialSelect).Module; var SelectType = ifcModule2.GetTypes().Where( t => t.Name.Contains(type) ).FirstOrDefault(); if (SelectType != null) { sb.AppendFormat("=== {0} is a Select type", type); Module ifcModule = typeof(IfcActor).Module; IEnumerable<Type> SelectSubTypes = ifcModule.GetTypes().Where( t => t.GetInterfaces().Contains(SelectType) ); // CommontIF sets up the infrastructure to check for common interfaces shared by the select type elements Type[] CommontIF = null; foreach (var item in SelectSubTypes) { if (CommontIF == null) CommontIF = item.GetInterfaces(); else { var chk = item.GetInterfaces(); for (int i = 0; i < CommontIF.Length; i++) { if (!chk.Contains(CommontIF[i])) { CommontIF[i] = null; } } } } Type[] ExistingIF = SelectType.GetInterfaces(); sb.AppendFormat(indentationHeader + "Interfaces: {0}", ExistingIF.Length); foreach (var item in ExistingIF) { sb.AppendFormat(indentationHeader + "- {0}", item.Name); } // need to remove implemented interfaces from the ones shared for (int i = 0; i < CommontIF.Length; i++) { if (CommontIF[i] == SelectType) CommontIF[i] = null; if (ExistingIF.Contains(CommontIF[i])) { CommontIF[i] = null; } } foreach (var item in CommontIF) { if (item != null) sb.AppendFormat(indentationHeader + "Missing Common Interface: {0}", item.Name); } if (beVerbose == 1) { foreach (var item in SelectSubTypes) { sb.Append(ReportType(item.Name, beVerbose, indentationHeader + " ")); } } sb.AppendFormat(""); } } return sb; }