public IEnumerable<ObjectType> CreateFileObjects(textfilecontent_object fileContentObject, IEnumerable<string> fileNames, IEnumerable<string> lines, IEnumerable<string> paths)
        {
            List<ObjectType> fileContentObjects = new List<ObjectType>();
            foreach (string fileName in fileNames)
                foreach (string line in lines)
                    foreach (string path in paths)
                        fileContentObjects.Add(this.CreateObjectTypeFrom(fileContentObject,fileName,line,path));

            return fileContentObjects;
        }
        public IEnumerable<ItemType> ProcessOperation(textfilecontent_object fileContentObject)
        {
            List<ItemType> itemTypes = new List<ItemType>();
            Dictionary<string, EntityObjectStringType> fileEntities = FileContentOvalHelper.GetFileContentEntitiesFromObjectType(fileContentObject);
            
            IEnumerable<string> paths = this.ProcessOperationsPaths(fileEntities);
            IEnumerable<string> fileNames = this.ProcessOperationsFileNames(fileEntities, paths);
            IEnumerable<string> lines = this.ProcessOperationsLine(fileEntities);

            return new FileContentItemTypeFactory().CreateFileItemTypesByCombinationOfEntitiesFrom(paths, fileNames, lines);
        }
     private ObjectType CreateObjectTypeFrom(textfilecontent_object fileContentObject, string fileName, string line, string path)
     {
         EntityObjectStringType pathFrom = (EntityObjectStringType)fileContentObject.GetItemValue(textfilecontent_ItemsChoices.path);
         EntityObjectStringType fileNameFrom = (EntityObjectStringType)fileContentObject.GetItemValue(textfilecontent_ItemsChoices.filename);
         EntityObjectStringType lineFrom = (EntityObjectStringType)fileContentObject.GetItemValue(textfilecontent_ItemsChoices.line);        
 
         EntityObjectStringType newPath = this.CreateObjectStringTypeFrom(pathFrom);
         newPath.Value = !string.IsNullOrEmpty(path) ? path : newPath.Value;
         EntityObjectStringType newFileName = this.CreateObjectStringTypeFrom(fileNameFrom);
         newFileName.Value = !string.IsNullOrEmpty(fileName) ? fileName : newFileName.Value;
         EntityObjectStringType newLine = this.CreateObjectStringTypeFrom(lineFrom);
         newLine.Value = !string.IsNullOrEmpty(line) ? line : newLine.Value;
         
         return this.CreateFileObject(newFileName, newLine, newPath);
     }
示例#4
0
        public static Dictionary<string, EntityObjectStringType> GetFileContentEntitiesFromObjectType(textfilecontent_object fileContentObject)
        {
            string fileNameEntityName = textfilecontent_ItemsChoices.filename.ToString();
            string lineEntityName = textfilecontent_ItemsChoices.line.ToString();
            string pathEntityName = textfilecontent_ItemsChoices.path.ToString();

            object[] allEntities = fileContentObject.Items.ToArray();
            string[] allEntityNames = fileContentObject.TextfilecontentItemsElementName.Select(i => i.ToString()).ToArray<String>();

            Dictionary<String, EntityObjectStringType> fileContentEntities = new Dictionary<string, EntityObjectStringType>();
            fileContentEntities.Add(fileNameEntityName, OvalHelper.GetEntityObjectByName(fileNameEntityName, allEntities, allEntityNames));
            fileContentEntities.Add(lineEntityName, OvalHelper.GetEntityObjectByName(lineEntityName, allEntities, allEntityNames));
            fileContentEntities.Add(pathEntityName, OvalHelper.GetEntityObjectByName(pathEntityName, allEntities, allEntityNames));

            return fileContentEntities;
        }
        private textfilecontent_object CreateFileObject(EntityObjectStringType fileName, EntityObjectStringType line, EntityObjectStringType path)
        {
            textfilecontent_object fileContentObject = new textfilecontent_object();

            var items = new List<object>();
            var itemChoices = new List<textfilecontent_ItemsChoices>();
            items.Add(fileName);
            items.Add(line);
            items.Add(path);
            itemChoices.Add(textfilecontent_ItemsChoices.filename);
            itemChoices.Add(textfilecontent_ItemsChoices.line);
            itemChoices.Add(textfilecontent_ItemsChoices.path);

            fileContentObject.Items = items.ToArray();
            fileContentObject.TextfilecontentItemsElementName = itemChoices.ToArray();
            return fileContentObject;
        }
 public IEnumerable<ObjectType> CreateObjectTypeByCombinationOfEntities(textfilecontent_object fileContentObject, IEnumerable<string> fileNames, IEnumerable<string> lines, IEnumerable<string> paths)
 {
     List<ObjectType> fileContentObjects = new List<ObjectType>();
     fileContentObjects.AddRange(this.CreateFileObjects(fileContentObject, fileNames, lines, paths));
     return fileContentObjects;
 }
 private IEnumerable<string> ProcessVariableForLine(textfilecontent_object fileContentObject)
 {
     EntityObjectStringType line = (EntityObjectStringType)fileContentObject.GetItemValue(textfilecontent_ItemsChoices.line);
     return this.processVariablesForEntity(line);
 }