public XxSchemaExport(XxChildrenMode childrenMode = XxChildrenMode.Zero, params Type[] childTypes) { ChildTypes = childTypes; ChildrenMode = childrenMode; }
private ComplexType ParseComplexType(Type type, XxSchemaExport ca) { var properties = type.GetProperties(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.SetProperty | BindingFlags.Public); var attributes = new List <Attribute>(); var allPropertiesBindable = type.GetCustomAttribute <XxSchemaBindable>()?.Bindable ?? false; foreach (var property in properties) { if (property.GetSetMethod() == null) { continue; } if (property.GetCustomAttribute <XxSchemaIgnore>() != null) { continue; } bool bindable = allPropertiesBindable; var bindableAttr = property.GetCustomAttribute <XxSchemaBindable>(); if (bindableAttr != null) { bindable = bindableAttr.Bindable; } var st = FindSimpleType(property.PropertyType, bindable); attributes.Add(new Attribute { Bindable = bindable, Name = property.Name, Type = st }); } XxChildrenMode childrenMode = type.IsAbstract ? XxChildrenMode.Zero : ca?.ChildrenMode ?? XxChildrenMode.Zero; ComplexType[] childTypes = null; if (childrenMode != XxChildrenMode.Zero && ca?.ChildTypes?.Length > 0) { childTypes = new ComplexType[ca.ChildTypes.Length]; for (var idx = 0; idx < childTypes.Length; ++idx) { childTypes[idx] = FindComplexType(ca.ChildTypes[idx]); } } GetInfo(type, false, out var @namespace, out var name); var ct = new ComplexType { Attributes = attributes.ToArray(), Name = name, Type = type, ChildrenMode = childrenMode, ChildrenTypes = childTypes, Namespace = @namespace, BaseType = FindComplexType(type.BaseType) }; complexTypes.Add(ct); return(ct); }