Exemple #1
0
        // Group: Functions
        // __________________________________________________________________________


        /* Function: BuildClassFile
         * Builds an output file based on a class.  The accessor should NOT hold a lock on the database.  This will also
         * build the metadata files.
         */
        protected void BuildClassFile(int classID, CodeDB.Accessor accessor, CancelDelegate cancelDelegate)
        {
                        #if DEBUG
            if (accessor.LockHeld != CodeDB.Accessor.LockType.None)
            {
                throw new Exception("Shouldn't call BuildClassFile() when the accessor already holds a database lock.");
            }
                        #endif

            Components.HTMLTopicPages.Class page = new Components.HTMLTopicPages.Class(this, classID);

            bool hasTopics = page.Build(accessor, cancelDelegate);

            if (cancelDelegate())
            {
                return;
            }


            if (hasTopics)
            {
                lock (accessLock)
                {
                    if (buildState.ClassFilesWithContent.Add(classID) == true)
                    {
                        buildState.NeedToBuildMenu = true;
                    }
                }
            }
            else
            {
                DeleteOutputFileIfExists(page.OutputFile);
                DeleteOutputFileIfExists(page.ToolTipsFile);
                DeleteOutputFileIfExists(page.SummaryFile);
                DeleteOutputFileIfExists(page.SummaryToolTipsFile);

                lock (accessLock)
                {
                    if (buildState.ClassFilesWithContent.Remove(classID) == true)
                    {
                        buildState.NeedToBuildMenu = true;
                    }
                }
            }
        }
Exemple #2
0
        /* Function: BuildTopicEntry
         */
        protected void BuildTopicEntry(SearchIndex.TopicEntry topicEntry, string keywordHTMLName, bool includeLanguage)
        {
            string topicHTMLPrefix, topicHTMLName, topicSearchText;

            if (topicEntry.EndOfDisplayNameQualifiers == 0)
            {
                topicHTMLPrefix = null;
                topicHTMLName   = topicEntry.DisplayName.ToHTML();
                topicSearchText = topicEntry.SearchText;
            }
            else
            {
                topicHTMLPrefix = topicEntry.DisplayName.Substring(0, topicEntry.EndOfDisplayNameQualifiers);

                if (topicHTMLPrefix[topicHTMLPrefix.Length - 1] == '.')
                {
                    topicHTMLPrefix = topicHTMLPrefix.Substring(0, topicHTMLPrefix.Length - 1);
                }
                else if (topicHTMLPrefix.EndsWith("::") || topicHTMLPrefix.EndsWith("->"))
                {
                    topicHTMLPrefix = topicHTMLPrefix.Substring(0, topicHTMLPrefix.Length - 2);
                }

                topicHTMLPrefix = topicHTMLPrefix.ToHTML();
                topicHTMLName   = topicEntry.DisplayName.Substring(topicEntry.EndOfDisplayNameQualifiers).ToHTML();
                topicSearchText = topicEntry.SearchText.Substring(topicEntry.EndOfSearchTextQualifiers);
            }

            output.Append('[');

            if (topicHTMLPrefix != null)
            {
                output.Append('"');
                output.StringEscapeAndAppend(topicHTMLPrefix);
                output.Append('"');
            }

            output.Append(',');

            if (topicHTMLName != keywordHTMLName)
            {
                output.Append('"');
                output.StringEscapeAndAppend(topicHTMLName);
                output.Append('"');
            }

            output.Append(',');

            if (includeLanguage)
            {
                output.Append('"');
                output.StringEscapeAndAppend(EngineInstance.Languages.FromID(topicEntry.Topic.LanguageID).Name);
                output.Append('"');
            }

            output.Append(',');

            if (topicSearchText != topicHTMLName.ToLower())
            {
                output.Append('"');
                output.StringEscapeAndAppend(topicSearchText);
                output.Append('"');
            }

            output.Append(',');

            output.Append(UsedCommentTypesIndex(topicEntry.Topic.CommentTypeID));

            output.Append(",\"");
            Components.HTMLTopicPages.File filePage = new Components.HTMLTopicPages.File(HTMLBuilder, topicEntry.Topic.FileID);
            output.StringEscapeAndAppend(filePage.OutputFileHashPath);

            string topicHashPath = HTMLBuilder.Source_TopicHashPath(topicEntry.Topic, true);

            if (topicHashPath != null)
            {
                output.Append(':');
                output.StringEscapeAndAppend(topicHashPath);
            }

            output.Append('"');

            if (topicEntry.Topic.ClassID != 0)
            {
                output.Append(",\"");

                Components.HTMLTopicPages.Class classPage =
                    new Components.HTMLTopicPages.Class(HTMLBuilder, topicEntry.Topic.ClassID, topicEntry.Topic.ClassString);
                output.StringEscapeAndAppend(classPage.OutputFileHashPath);

                string classTopicHashPath = HTMLBuilder.Source_TopicHashPath(topicEntry.Topic, false);

                if (classTopicHashPath != null)
                {
                    output.Append(':');
                    output.StringEscapeAndAppend(classTopicHashPath);
                }

                output.Append('"');
            }

            output.Append(']');
        }