Пример #1
0
        public static string GetEventFromAttr(CsAttributes pList, FactoryExpressionCreator pCreator)
        {
            addImports(pList, pCreator);

            List <AttributeItem> vals = GetAttributeValue(pList, EVENT_ATTRIBUTE, pCreator);

            if (vals.Count == 0)
            {
                return(null);
            }

            return(vals[0].Parameters.Count == 0 ? null : (string)vals[0].Parameters[0]);
        }
Пример #2
0
        private static void addImports(CsAttributes pList, FactoryExpressionCreator pCreator)
        {
            if (pList == null)
            {
                return;
            }

            List <AttributeItem> vals = GetAttributeValue(pList, NAMESPACE_ATTRIBUTE, pCreator);

            if (vals.Count == 0 || vals[0].Parameters.Count == 0)
            {
                return;
            }

            ImportStatementList.AddImport((string)vals[0].Parameters[0]);
        }
Пример #3
0
        public static bool HasAttribute(CsAttributes pList, string pAttrName)
        {
            if (pList == null)
            {
                return(false);
            }

            if (pList.sections == null || pList.sections.Count == 0)
            {
                return(false);
            }

            return((from section in pList.sections
                    from attribute in section.attribute_list
                    select HasAttribute(attribute.entities, pAttrName)).Any(pVal => pVal));
        }
Пример #4
0
        public static List <AttributeItem> GetAttributeValue(CsAttributes pList, string pAttrName, FactoryExpressionCreator pCreator)
        {
            if (pList == null || pList.sections == null || pList.sections.Count == 0)
            {
                return(new List <AttributeItem>());
            }

            return
                (pList.sections.SelectMany(
                     pSection =>
                     pSection.attribute_list.Select(
                         pAttribute =>
                         pAttribute.entities == null
                                                                                                ? getAttributeValue(pAttribute, pAttrName, pCreator)
                                                                                                : GetAttributeValue(pAttribute.entities, pAttrName)).Where
                         (pVal => pVal != null)).FirstOrDefault());
        }
Пример #5
0
 public static bool IsClassDefinedAsObject(CsAttributes pList)
 {
     return(HasAttribute(pList, AS_OBJECT));
 }
Пример #6
0
		public static string GetEventFromAttr(CsAttributes pList, FactoryExpressionCreator pCreator) {
			addImports(pList, pCreator);

			List<AttributeItem> vals = GetAttributeValue(pList, EVENT_ATTRIBUTE, pCreator);
			if (vals.Count == 0) {
				return null;
			}

			return vals[0].Parameters.Count == 0 ? null : (string)vals[0].Parameters[0];
		}
Пример #7
0
		public static bool HasAttribute(CsAttributes pList, string pAttrName) {
			if (pList == null) {
				return false;
			}

			if (pList.sections == null || pList.sections.Count == 0) {
				return false;
			}

			return (from section in pList.sections
			        from attribute in section.attribute_list
			        select HasAttribute(attribute.entities, pAttrName)).Any(pVal => pVal);
		}
Пример #8
0
		public static List<AttributeItem> GetAttributeValue(CsAttributes pList, string pAttrName, FactoryExpressionCreator pCreator) {
			if (pList == null || pList.sections == null || pList.sections.Count == 0) {
				return new List<AttributeItem>();
			}

			return
				pList.sections.SelectMany(
				                          pSection =>
				                          pSection.attribute_list.Select(
				                                                         pAttribute =>
				                                                         pAttribute.entities == null
				                                                         	? getAttributeValue(pAttribute, pAttrName, pCreator)
				                                                         	: GetAttributeValue(pAttribute.entities, pAttrName)).Where
				                          	(pVal => pVal != null)).FirstOrDefault();
		}
Пример #9
0
		private static void addImports(CsAttributes pList, FactoryExpressionCreator pCreator) {
			if (pList == null) {
				return;
			}

			List<AttributeItem> vals = GetAttributeValue(pList, NAMESPACE_ATTRIBUTE, pCreator);
			if (vals.Count == 0 || vals[0].Parameters.Count == 0) {
				return;
			}

			ImportStatementList.AddImport((string)vals[0].Parameters[0]);
		}
Пример #10
0
		public static bool IsClassDefinedAsObject(CsAttributes pList) {
			return HasAttribute(pList, AS_OBJECT);
		}