private void ConfigureXmlFileContentItem(xmlfilecontent_item xmlFileContentItem, IEnumerable<String> xPathResult) { var completeFilepath = this.GetCompleteFilepath(xmlFileContentItem); xmlFileContentItem.filepath = OvalHelper.CreateItemEntityWithStringValue(completeFilepath); xmlFileContentItem.path = OvalHelper.CreateItemEntityWithStringValue(Path.GetDirectoryName(completeFilepath)); xmlFileContentItem.filename = OvalHelper.CreateItemEntityWithStringValue(Path.GetFileName(completeFilepath)); xmlFileContentItem.value_of = new EntityItemAnySimpleType[xPathResult.Count()]; for (int i = 0; i < xPathResult.Count(); i++) xmlFileContentItem.value_of[i] = OvalHelper.CreateEntityItemAnyTypeWithValue(xPathResult.ElementAt(i)); }
private bool IsFilePathDefined(xmlfilecontent_item xmlFileContentItem) { var filepathEntity = xmlFileContentItem.filepath; return ((filepathEntity != null) && (!string.IsNullOrEmpty(filepathEntity.Value))); }
private string GetCompleteFilepath(xmlfilecontent_item xmlFileContentItem) { if (IsFilePathDefined(xmlFileContentItem)) return xmlFileContentItem.filepath.Value; else return Path.Combine(xmlFileContentItem.path.Value, xmlFileContentItem.filename.Value); }