Example #1
0
        public IEnumerable <EntityItemAnySimpleType> ToOvalSimpleTypeList()
        {
            if (this.Records.Count <= 0)
            {
                return new EntityItemAnySimpleType[] { new EntityItemAnySimpleType()
                                                       {
                                                           status = StatusEnumeration.doesnotexist
                                                       } }
            }
            ;

            var result = new List <EntityItemAnySimpleType>();

            foreach (var record in this.Records)
            {
                var newSimpleType = new EntityItemAnySimpleType();

                var field = record.FirstOrDefault();
                if ((field.Key == null) || (field.Value == null))
                {
                    newSimpleType.status = StatusEnumeration.doesnotexist;
                }
                else
                {
                    newSimpleType.Value = field.Value.ToString();
                }

                result.Add(newSimpleType);
            }

            return(result);
        }
        private ItemType CreateTextFileContentItemType(string filepath, string pattern, int instance, string text)
        {
            var status = StatusEnumeration.exists;
            EntityItemAnySimpleType textEntity = null;

            if (string.IsNullOrEmpty(text))
            {
                status = StatusEnumeration.doesnotexist;
            }
            else
            {
                textEntity = OvalHelper.CreateEntityItemAnyTypeWithValue(text);
            }

            return(new textfilecontent_item()
            {
                status = status,
                pattern = OvalHelper.CreateItemEntityWithStringValue(pattern),
                instance = OvalHelper.CreateItemEntityWithIntegerValue(instance.ToString()),
                filename = OvalHelper.CreateItemEntityWithStringValue(Path.GetFileName(filepath)),
                path = OvalHelper.CreateItemEntityWithStringValue(Path.GetDirectoryName(filepath)),
                filepath = OvalHelper.CreateItemEntityWithStringValue(filepath),
                text = textEntity
            });
        }
        private EntityItemAnySimpleType[] BuildSubexpresion(List <string> subExpression)
        {
            List <EntityItemAnySimpleType> items = new List <EntityItemAnySimpleType>();

            foreach (string item in subExpression)
            {
                EntityItemAnySimpleType entityItem = (EntityItemAnySimpleType)base.CreateEntityItemType(EntityItemTypes.String, item);
                items.Add(entityItem);
            }

            return(items.ToArray());
        }
Example #4
0
        public IEnumerable<EntityItemAnySimpleType> ToOvalSimpleTypeList()
        {
            if (this.Records.Count <= 0)
                return new EntityItemAnySimpleType[] { new EntityItemAnySimpleType() { status = StatusEnumeration.doesnotexist } };
            
            var result = new List<EntityItemAnySimpleType>();
            foreach (var record in this.Records)
            {
                var newSimpleType = new EntityItemAnySimpleType();
                
                var field = record.FirstOrDefault();
                if ((field.Key == null) || (field.Value == null))
                    newSimpleType.status = StatusEnumeration.doesnotexist;
                else
                    newSimpleType.Value = field.Value.ToString();

                result.Add(newSimpleType);
            }

            return result;

        }