Ejemplo n.º 1
0
 private void CreateFileObjectsWithFilePath(xmlfilecontent_object objectType,
     string[] filepaths, string[] xpaths, List<ObjectType> xmlFileObjects)
 {
     foreach (string filepath in filepaths)
         foreach (string xpath in xpaths)
             xmlFileObjects.Add(this.CreateObjectTypeFrom(objectType, filepath, null, null, xpath));
 }
Ejemplo n.º 2
0
        private xmlfilecontent_object CreateFileObject(
            EntitySimpleBaseType filePath, EntitySimpleBaseType fileName, EntitySimpleBaseType path, EntitySimpleBaseType xpath)
        {
            var newXmlFileContentObject = new xmlfilecontent_object();
            EntitySimpleBaseType[] items;
            xmlfilecontent_ItemsChoices[] itemChoices;
            if (filePath == null)
            {
                items = new EntitySimpleBaseType[4];
                itemChoices = new xmlfilecontent_ItemsChoices[3];
                itemChoices[0] = xmlfilecontent_ItemsChoices.path;
                itemChoices[1] = xmlfilecontent_ItemsChoices.filename;
                itemChoices[2] = xmlfilecontent_ItemsChoices.xpath;
                items[0] = path;
                items[1] = fileName;
                items[2] = xpath;
            }
            else
            {
                items = new EntitySimpleBaseType[3];
                itemChoices = new xmlfilecontent_ItemsChoices[2];
                itemChoices[0] = xmlfilecontent_ItemsChoices.filepath;
                itemChoices[1] = xmlfilecontent_ItemsChoices.xpath;
                items[0] = filePath;
                items[1] = xpath;
            }

            newXmlFileContentObject.Items = items;
            newXmlFileContentObject.XmlfilecontentItemsElementName = itemChoices;

            return newXmlFileContentObject;
        }
Ejemplo n.º 3
0
 private void CreateFileObjectsWithoutFilePath(xmlfilecontent_object objectType,
     string[] paths, string[] fileNamesOrFilePaths, string[] xpaths, List<ObjectType> xmlFileObjects)
 {
     foreach (string path in paths)
         foreach (string fileName in fileNamesOrFilePaths)
             foreach (string xpath in xpaths)
                 xmlFileObjects.Add(this.CreateObjectTypeFrom(objectType, null, fileName, path, xpath));
 }
Ejemplo n.º 4
0
        public IEnumerable<ObjectType> CreateXmlFileContentObjects(xmlfilecontent_object objectType,
            string[] filepaths, string[] filenames, string[] paths, string[] xpaths)
        {
            var objects = new List<ObjectType>();
            if (!objectType.IsFilePathDefined())
                this.CreateFileObjectsWithoutFilePath(objectType, filenames, paths, xpaths, objects);
            else
                this.CreateFileObjectsWithFilePath(objectType, filepaths, xpaths, objects);

            return objects;
        }
        private bool MustCheckIfFileExists(xmlfilecontent_object xmlFileContentObject)
        {
            var allObjectEntities = xmlFileContentObject.GetAllObjectEntities();
            EntitySimpleBaseType filepathEntity = null;
            allObjectEntities.TryGetValue(xmlfilecontent_ItemsChoices.filepath.ToString(), out filepathEntity);
            if (filepathEntity != null)
                return filepathEntity.var_check.Equals(CheckEnumeration.all);

            EntitySimpleBaseType pathEntity = null;
            EntitySimpleBaseType filenameEntity = null;
            allObjectEntities.TryGetValue(xmlfilecontent_ItemsChoices.path.ToString(), out pathEntity);
            allObjectEntities.TryGetValue(xmlfilecontent_ItemsChoices.filename.ToString(), out filenameEntity);
            return (((pathEntity != null) && string.IsNullOrWhiteSpace(pathEntity.var_ref) && pathEntity.var_check.Equals(CheckEnumeration.all)) ||
                    ((filenameEntity != null) && string.IsNullOrWhiteSpace(filenameEntity.var_ref) && filenameEntity.var_check.Equals(CheckEnumeration.all)));
        }
Ejemplo n.º 6
0
        private ObjectType CreateObjectTypeFrom(xmlfilecontent_object objectType,
            string filepath, string filename, string path, string xpath)
        {
            EntityObjectStringType filePathFrom = null;
            EntityObjectStringType pathFrom = null;
            EntityObjectStringType fileNameFrom = null;
            EntityObjectStringType newFilePath = null;
            EntityObjectStringType newPath = null;
            EntityObjectStringType newFileName = null;

            var xpathFrom = (EntityObjectStringType)objectType.GetItemValue(xmlfilecontent_ItemsChoices.xpath);
            var newTrusteeSID = this.CreateObjectStringTypeFrom(xpathFrom);
            newTrusteeSID.Value = string.IsNullOrEmpty(xpath) ? newTrusteeSID.Value : xpath;

            if (objectType.IsFilePathDefined())
            {
                filePathFrom = (EntityObjectStringType)objectType.GetItemValue(xmlfilecontent_ItemsChoices.filepath);
                newFilePath = this.CreateObjectStringTypeFrom(filePathFrom);
                newFilePath.Value = string.IsNullOrEmpty(filepath) ? newFilePath.Value : filepath;
                return this.CreateFileObject(newFilePath, null, null, newTrusteeSID);
            }
            else
            {
                pathFrom = (EntityObjectStringType)objectType.GetItemValue(xmlfilecontent_ItemsChoices.path);
                fileNameFrom = (EntityObjectStringType)objectType.GetItemValue(xmlfilecontent_ItemsChoices.filename);

                newPath = this.CreateObjectStringTypeFrom(pathFrom);
                newPath.Value = string.IsNullOrEmpty(path) ? newPath.Value : path;

                newFileName = this.CreateObjectStringTypeFrom(fileNameFrom);
                newFileName.Value = string.IsNullOrEmpty(filename) ? newFileName.Value : filename;

                return this.CreateFileObject(null, newFileName, newPath, newTrusteeSID);
            }

        }
 private IEnumerable<String> EvaluateEntity(
     xmlfilecontent_object xmlfilecontentObject, xmlfilecontent_ItemsChoices entityName)
 {
     var entity = xmlfilecontentObject.GetAllObjectEntities()[entityName.ToString()];
     return this.VariableEntityEvaluator.EvaluateVariableForEntity(entity);
 }
        private IEnumerable<ItemType> ProcessOperation(xmlfilecontent_object objectToCollect)
        {
            IEnumerable<string> processedFilenames = null;
            IEnumerable<string> processedPaths = null;

            if (objectToCollect.IsFilePathDefined())
            {
                var filepath = this.GetDictionaryWithElement(xmlfilecontent_ItemsChoices.filepath, objectToCollect.GetAllObjectEntities());
                var filePathOperationResult = this.PathOperatorEvaluator.ProcessOperationFilePath(filepath);
                processedPaths = filePathOperationResult.Paths;

                processedFilenames = new List<String>();
                foreach (var completeFilepath in filePathOperationResult.FileNames)
                    ((List<String>)processedFilenames).Add(System.IO.Path.GetFileName(completeFilepath));
            }
            else
            {
                var paths = this.GetDictionaryWithElement(xmlfilecontent_ItemsChoices.path, objectToCollect.GetAllObjectEntities());
                processedPaths =this.PathOperatorEvaluator.ProcessOperationsPaths(paths);

                var fileNames = this.GetDictionaryWithElement(xmlfilecontent_ItemsChoices.filename, objectToCollect.GetAllObjectEntities());
                processedFilenames = this.PathOperatorEvaluator.ProcessOperationFileName(fileNames, processedPaths, false);
            }

            var xPathEntity = ((EntitySimpleBaseType)objectToCollect.GetItemValue(xmlfilecontent_ItemsChoices.xpath));
            var xpaths = new string[] { xPathEntity.Value };

            if ((processedPaths == null) || (processedPaths.Count() == 0) ||
                (processedFilenames == null) || (processedFilenames.Count() == 0))
            {
                var completeFilepath = objectToCollect.GetCompleteFilepath();
                if (PathOperatorEvaluator.Platform.Equals(FamilyEnumeration.unix))
                    completeFilepath = completeFilepath.ToUnixPath();

                var newXmlFileContentItem = CreateXmlFileItem(completeFilepath, xpaths.First());
                newXmlFileContentItem.status = StatusEnumeration.doesnotexist;
                newXmlFileContentItem.filepath.status = newXmlFileContentItem.status;

                return new ItemType[] { newXmlFileContentItem };
            }

            var mustCheckIfFileExists = true; // this.MustCheckIfFileExists(objectToCollect);
            return this.CreateFileItemTypesByCombinationOfEntitiesFrom(processedPaths, processedFilenames, xpaths, mustCheckIfFileExists);
        }
Ejemplo n.º 9
0
 public IEnumerable<ObjectType> CreateObjectTypeByCombinationOfEntities(xmlfilecontent_object objectType,
     string[] filepaths, string[] filenames, string[] paths, string[] xpaths)
 {
     return this.CreateXmlFileContentObjects(objectType, filepaths, filenames, paths, xpaths);
 }