Exemple #1
0
        internal IList <VueData> GetComponentData()
        {
            var dataList = new List <VueData>();

            foreach (var field in DecompiledType.GetFields(f => f.Accessibility.HasFlag(ICSharpCode.Decompiler.TypeSystem.Accessibility.Public) && !f.IsStatic))
            {
                dataList.Add(ToVueField(field));
            }

            var fieldProps = DeclarationSyntax
                             .DescendantNodes()
                             .OfType <PropertyDeclarationSyntax>()
                             .Where(p => !p.AccessorList.Accessors.Any(accessor => accessor.Body != null));

            foreach (var prop in fieldProps)
            {
                dataList.Add(new VueData
                {
                    Name  = prop.Identifier.ValueText,
                    Value = SystemType.GetProperty(prop.Identifier.ValueText).GetValue(_instance)
                });
            }

            return(dataList);
        }
Exemple #2
0
        internal VueData ToVueField(IProperty property)
        {
            var propertyInfo = SystemType.GetProperty(property.Name);

            return(new VueData
            {
                Name = property.Name,
                Value = propertyInfo.GetValue(_instance)
            });
        }