Beispiel #1
0
        /// <summary>
        /// Creates the list of topics.
        /// </summary>
        /// <param name="projectPath">The project path.</param>
        /// <returns></returns>
        public static SortedDictionary <string, HelpEntity> CreateListOfTopics(string projectPath)
        {
            SortedDictionary <string, HelpEntity> onlyTopics  = new SortedDictionary <string, HelpEntity>();
            SortedDictionary <Guid, string>       topicsNames = new SortedDictionary <Guid, string>();
            ProjectAnalyzer pa = new ProjectAnalyzer(projectPath);

            if (pa.M_Project == null)
            {
                MessageBox.Show("Deserialization of the project failed !", "Deserialization failed!", MessageBoxButton.OK, MessageBoxImage.Error);
                return(null);
            }
            try
            {
                topicsNames = ProjectContentAnalyzer.GetTopicsNames(pa.ProjectContentFile);
            }
            catch (Exception contentException)
            {
                throw (new Exception("Exception appears in Content analyzer: " + contentException +
                                     " Check if: \n - all topics are correctly added to the project \n - GUIDS are unique \n - check if the content file has correct structure"));
            }
            TopicsAnalyzer.GetAllTopics(onlyTopics, pa.AllMamlFiles, topicsNames);
            return(onlyTopics);
        }
Beispiel #2
0
        /// <summary>
        /// Creates the list of all elements.
        /// </summary>
        /// <param name="projectPath">The project path.</param>
        /// <param name="externalLinksFileInfo">The external links file info.</param>
        /// <returns></returns>
        public static SortedDictionary <string, HelpEntity> CreateListOfAllElements(string projectPath, FileInfo externalLinksFileInfo)
        {
            SortedDictionary <string, HelpEntity> allElements = new SortedDictionary <string, HelpEntity>();
            SortedDictionary <Guid, string>       topicsNames = new SortedDictionary <Guid, string>();

            ExternalLinkAnalyzer.GetAllExternalLinks(allElements, externalLinksFileInfo);
            ProjectAnalyzer pa = new ProjectAnalyzer(projectPath);

            if (pa.M_Project == null)
            {
                MessageBox.Show("Deserialization of the project failed !", "Deserialization failed!", MessageBoxButton.OK, MessageBoxImage.Error);
                return(null);
            }
            try
            {
                topicsNames = ProjectContentAnalyzer.GetTopicsNames(pa.ProjectContentFile);
            }
            catch (Exception contentException)
            {
                MessageBox.Show("Exception appears in content analyzer: " + contentException +
                                " Check if: \n - all topics are correctly added to the project \n - GUIDS are unique \n - check if the content file has correct structure", "Analyze failed!", MessageBoxButton.OK, MessageBoxImage.Error);
                return(null);
            }
            try
            {
                ImageAnalyzer.GetAllImages(allElements, pa.AllImages);
            }
            catch (Exception imageException)
            {
                MessageBox.Show("Exception appears in Image analyzer: " + imageException +
                                " Check if: \n - all images are correctly added to the project \n - the build action is set to Image \n - GUIDS are unique", "Analyze failed!", MessageBoxButton.OK, MessageBoxImage.Error);
                return(null);
            }
            try
            {
                TokenAnalyzer.GetAllTokens(allElements, pa.TokensFile);
            }
            catch (Exception tokenException)
            {
                MessageBox.Show("Exception appears in Token analyzer: " + tokenException +
                                " Check if: \n - all tokens are correctly added to the project \n - tokens names are unique \n - token is added \"as token\"", "Analyze failed!", MessageBoxButton.OK, MessageBoxImage.Error);
                return(null);
            }
            try
            {
                LibraryAnalyzer.GetAllLibraryLinks(allElements, pa.AllLibraryFiles);
            }
            catch (Exception libraryException)
            {
                MessageBox.Show("Exception appears in Library analyzer: " + libraryException +
                                " Check if: \n - all libraries are correctly added to the project  \n - library is added \"as library\"", "Analyze failed!", MessageBoxButton.OK, MessageBoxImage.Error);
                return(null);
            }
            try
            {
                TopicsAnalyzer.GetAllTopics(allElements, pa.AllMamlFiles, topicsNames);
            }
            catch (Exception topicsException)
            {
                MessageBox.Show("Exception appears in Topics analyzer: " + topicsException +
                                " Check if: \n - all topics are correctly added to the project \n - topic is added \"as topic\"", "Analyze failed!", MessageBoxButton.OK, MessageBoxImage.Error);
                return(null);
            }
            return(allElements);
        }