public static Property CreatePropertyObject(PropertyInfo propInfo, out Dictionary<string, Structure> structures) { structures = new Dictionary<string, Structure>(); Property result = new VSPlugin.Property(); string itemsType = ""; Structure structure = null; // we need to verify if we have a structure in this property StructureAttribute structureAttribute = propInfo.GetCustomAttribute<StructureAttribute>(); if (structureAttribute != null) result.Type = structureAttribute.Type; else result.Type = Utility.HandleProperty(propInfo, out itemsType, out structure); if (!string.IsNullOrEmpty(itemsType)) { result.Items = new ArraySchema(); result.Items.Type = itemsType; } if (structure != null) structures.Add(propInfo.PropertyType.Name, structure); PropertyAttribute propAttrib = propInfo.GetCustomAttribute<PropertyAttribute>(); if (propAttrib == null) return result; result.Description = propAttrib.Description; result.Required = propAttrib.Required; result.Readonly = propAttrib.ReadOnly; result.Final = propAttrib.Final; result.Encrypted = propAttrib.Encrypted; result.Unit = propAttrib.Unit; result.Default = propAttrib.Default; result.Format = propAttrib.Format; result.Pattern = propAttrib.Pattern; result.Title = propAttrib.Title; result.Headline = propAttrib.Headline; result.MinLength = propAttrib.MinLength; result.MaxLength = propAttrib.MaxLength; result.MinItems = propAttrib.MinItems; result.MaxItems = propAttrib.MaxItems; result.UniqueItems = propAttrib.UniqueItems; result.EnumValues = propAttrib.Enum; result.EnumTitles = propAttrib.EnumTitles; result.Access = Access.GetAccess(propInfo); return result; }
public static Property CreatePropertyObject(PropertyInfo propInfo, out Dictionary <string, Structure> structures) { structures = new Dictionary <string, Structure>(); Property result = new VSPlugin.Property(); string itemsType = ""; Structure structure = null; // we need to verify if we have a structure in this property StructureAttribute structureAttribute = propInfo.GetCustomAttribute <StructureAttribute>(); if (structureAttribute != null) { result.Type = structureAttribute.Type; } else { result.Type = Utility.HandleProperty(propInfo, out itemsType, out structure); } if (!string.IsNullOrEmpty(itemsType)) { result.Items = new ArraySchema(); result.Items.Type = itemsType; } if (structure != null) { structures.Add(propInfo.PropertyType.Name, structure); } PropertyAttribute propAttrib = propInfo.GetCustomAttribute <PropertyAttribute>(); if (propAttrib == null) { return(result); } result.Description = propAttrib.Description; result.Required = propAttrib.Required; result.Readonly = propAttrib.ReadOnly; result.Final = propAttrib.Final; result.Encrypted = propAttrib.Encrypted; result.Unit = propAttrib.Unit; result.Default = propAttrib.Default; result.Format = propAttrib.Format; result.Pattern = propAttrib.Pattern; result.Title = propAttrib.Title; result.Headline = propAttrib.Headline; result.MinLength = propAttrib.MinLength; result.MaxLength = propAttrib.MaxLength; result.MinItems = propAttrib.MinItems; result.MaxItems = propAttrib.MaxItems; result.UniqueItems = propAttrib.UniqueItems; result.EnumValues = propAttrib.Enum; result.EnumTitles = propAttrib.EnumTitles; result.Access = Access.GetAccess(propInfo); return(result); }