/// <summary> /// Finds the project content files. /// </summary> /// <param name="projectFile">The project file.</param> /// <returns>Project content file</returns> private FileInfo FindProjectContentFiles(FileInfo projectFile) { FileInfo projectContentFile = null; foreach (ItemGroupType itemFromAGroup in m_project.ItemGroup) { if ((itemFromAGroup.Items != null) && (itemFromAGroup.Items.Length == 1) && (itemFromAGroup.Items[0].Include.Contains(".content"))) { projectContentFile = IOHelpers.CreateAndNormalizeFileInfo(projectFile.Directory.ToString(), itemFromAGroup.Items[0].Include); if (!projectContentFile.Exists) { return(null); } } } return(projectContentFile); }
/// <summary> /// Finds the library files. /// </summary> /// <param name="projectFile">The project file data.</param> /// <returns>List of all library files</returns> private List <FileInfo> FindLibraryFiles(FileInfo projectFile) { List <FileInfo> allDocumentationSources = new List <FileInfo>(); foreach (var itemFromAGroup in m_project.PropertyGroup[0].Items) { if ((itemFromAGroup is PropertyGroupTypePropertyDocumentationSources) && (itemFromAGroup as PropertyGroupTypePropertyDocumentationSources).DocumentationSource != null) { foreach (PropertyGroupTypePropertyDocumentationSourcesDocumentationSource ds in (itemFromAGroup as PropertyGroupTypePropertyDocumentationSources).DocumentationSource) { if (ds.sourceFile.ToLower().Contains("xml")) { allDocumentationSources.Add(IOHelpers.CreateAndNormalizeFileInfo(projectFile.Directory.ToString(), ds.sourceFile)); } } } } return(allDocumentationSources); }
/// <summary> /// Finds the images. /// </summary> /// <param name="projectFile">The FileInfo of project file.</param> /// <returns>All images</returns> private Dictionary <string, Image> FindImages(FileInfo projectFile) { Dictionary <string, Image> allImages = new Dictionary <string, Image>(); foreach (ItemGroupType itemFromAGroup in m_project.ItemGroup) { if ((itemFromAGroup.Items == null) || (itemFromAGroup.Items.Length == 0) || !(itemFromAGroup.Items[0] is ItemDefinitionGroupTypeItemImage)) { continue; } ItemDefinitionGroupTypeItemImage imageFromAGroup; for (int ix = 0; ix < itemFromAGroup.Items.Length; ix++) { imageFromAGroup = (ItemDefinitionGroupTypeItemImage)itemFromAGroup.Items[ix]; if (imageFromAGroup != null) { Image image = new Image(); image.ImageName = imageFromAGroup.Include; image.ImageAlternateText = imageFromAGroup.AlternateText; if (!IOHelpers.IsGuid(imageFromAGroup.ImageId)) { MessageBox.Show("GUID of the Image: " + image.ImageName + " is invalid", "Invalid GUID!", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else { image.ImageGuid = new Guid(imageFromAGroup.ImageId); if (allImages.ContainsKey(image.ImageGuid.ToString())) { MessageBox.Show("The GUID :" + image.ImageGuid.ToString() + " of the image " + image.ImageName + " is doubled. The image with doubled GUID cannot be added to the list ", "GUID doubled!", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else { allImages.Add(image.ImageGuid.ToString(), image); } } } } } return(allImages); }
/// <summary> /// Finds the maml files. /// </summary> /// <param name="projectFile">The project file data.</param> /// <returns>List of all MAML files</returns> private List <FileInfo> FindMamlFiles(FileInfo projectFile) { List <FileInfo> allTopicsFiles = new List <FileInfo>(); for (int ix = 0; ix < m_project.PropertyGroup[0].Items.Length; ix++) { foreach (ItemGroupType itemFromAGroup in m_project.ItemGroup) { if (itemFromAGroup.Items[0].GetType().ToString() == "HelpAssistant.HPFT.ItemGroupTypeItemNone") { foreach (ItemGroupTypeItemNone itemNone in itemFromAGroup.Items) { if (itemNone.Include != null) { allTopicsFiles.Add(IOHelpers.CreateAndNormalizeFileInfo(projectFile.Directory.ToString(), itemNone.Include)); } } return(allTopicsFiles); } } } return(allTopicsFiles); }