Ejemplo n.º 1
0
        public Type MemberTypeToAttributeType(ScriptMemberType memberType)
        {
            switch (memberType)
            {
            case ScriptMemberType.Class:
                return(_classAttributeType);

            case ScriptMemberType.Constructor:
                return(_constructorAttributeType);

            case ScriptMemberType.GlobalContext:
                return(_globalContextAttributeType);

            case ScriptMemberType.Method:
                return(_methodAttributeType);

            case ScriptMemberType.Property:
                return(_propAttributeType);

            case ScriptMemberType.SystemEnum:
                return(_systemEnumAttribute);

            case ScriptMemberType.EnumerationType:
                return(_enumerationTypeAttribute);

            case ScriptMemberType.EnumerationValue:
                return(_systemValue);

            case ScriptMemberType.EnumItem:
                return(_enumValue);

            default:
                throw new ArgumentException("Unsupported member type");
            }
        }
Ejemplo n.º 2
0
        public CustomAttributeData GetMarkup(Type type, ScriptMemberType markupElement)
        {
            var attributeType = _assemblyLoader.MemberTypeToAttributeType(markupElement);
            var result        = type.GetCustomAttributesData().FirstOrDefault(attr => attr.AttributeType == attributeType);

            return(result);
        }
Ejemplo n.º 3
0
        public Type[] GetMarkedTypes(ScriptMemberType markupElement)
        {
            var attributeType = _assemblyLoader.MemberTypeToAttributeType(markupElement);
            var types         = new List <Type>();

            foreach (var t in AllTypes)
            {
                try
                {
                    var attr = t.GetCustomAttributesData();
                    foreach (var currentAttr in attr)
                    {
                        if (currentAttr.AttributeType == attributeType)
                        {
                            types.Add(t);
                        }
                    }
                }
                catch (FileNotFoundException)
                {
                    Console.WriteLine($"Skipping type {t} due to load error");
                }
            }

            return(types.ToArray());
        }
        public Type[] GetMarkedTypes(ScriptMemberType markupElement)
        {
            var attributeType = _assemblyLoader.MemberTypeToAttributeType(markupElement);
            var types         = AllTypes.Where(x => x.GetCustomAttributesData()
                                               .FirstOrDefault(attr => attr.AttributeType == attributeType) != null);

            return(types.ToArray());
        }
Ejemplo n.º 5
0
        public CustomAttributeData GetMarkup(MemberInfo member, ScriptMemberType markupElement)
        {
            var type = _assemblyLoader.MemberTypeToAttributeType(markupElement);

            return(member.GetCustomAttributesData().FirstOrDefault(attr => attr.AttributeType == type));
        }
Ejemplo n.º 6
0
        private void AddEnumsDescriptionJSON(Type sysEnum, DocumentBlocks textBlocks, ScriptMemberType sysType)
        {
            var attrib = _library.GetMarkup(sysEnum, sysType);

            string name, alias;

            GetNameAndAlias(attrib, sysEnum.Name, out name, out alias);

            var childElement = new XElement(name);

            childElement.Add(new XElement("name", name));
            childElement.Add(new XElement("name_en", alias));

            AppendXmlDocsJSON(childElement, "T:" + sysEnum.FullName);

            AddValues(sysEnum, childElement);

            var JSONNode = JSon.XmlToJSON(childElement.ToString());

            textBlocks.TextEnumsDescription.Append(JSONNode.Substring(1, JSONNode.Length - 2) + ",");
        }