Example #1
0
        public CssDocument Parse(string fileName, string textToParse, bool reparse)
        {
            CssDocument cssDocument;

            if (fileName == "")
            {
                cssDocument = new CssDocument(fileName);
                cssDocument.ParseDocument(textToParse);
            }
            else
            {
                cssDocument = (CssDocument)DocumentList.GetDocument(fileName);
                if (cssDocument == null)
                {
                    cssDocument = new CssDocument(fileName);
                    cssDocument.ParseDocument(textToParse);
                    DocumentList.AddDocument(cssDocument);
                }
                else
                {
                    if (reparse)
                    {
                        codeBrowser.Clear();
                        cssDocument.ParseDocument(textToParse);
                    }
                }
            }

            return(cssDocument);
        }
Example #2
0
        public void Parse(string fileName, string textToParse, bool reparse, CodeBrowserControl codeBrowser)
        {
            this.codeBrowser = codeBrowser;

            HtmlDocument htmlDocument = (HtmlDocument)DocumentList.GetDocument(fileName);

            if (htmlDocument == null)
            {
                htmlDocument = new HtmlDocument(fileName, textToParse);
                DocumentList.AddDocument(htmlDocument);
            }
            else
            {
                if (reparse)
                {
                    codeBrowser.Clear();
                    htmlDocument.ClearStyleChilds();
                    htmlDocument.ParseDocument(textToParse);
                }
            }

            codeBrowser._tree.BeginUpdate();

            BuildTree(htmlDocument);
            codeBrowser._tree.ExpandAll();
            codeBrowser._tree.EndUpdate();
        }
        /** -------------------------------------------------------------------- **/

        public void Analyze(
            MacroscopeDocument msDoc,
            string Text,
            Dictionary <string, int> Terms,
            int Words
            )
        {
            Dictionary <string, int> TermsList = null;

            if (Words == 1)
            {
                TermsList = this.AnalyzeTerm(
                    Text: Text.ToLower(),
                    Terms: Terms
                    );
            }
            else
            if (Words > 1)
            {
                TermsList = this.AnalyzePhrase(
                    Text: Text.ToLower(),
                    Terms: Terms,
                    Words: Words
                    );
            }

            if ((this.DocList != null) && (TermsList != null))
            {
                lock (this.DocList)
                {
                    foreach (string KeywordTerm in TermsList.Keys)
                    {
                        MacroscopeDocumentList DocumentList;

                        if (this.DocList.ContainsKey(KeywordTerm))
                        {
                            DocumentList = this.DocList[KeywordTerm];
                        }
                        else
                        {
                            DocumentList = new MacroscopeDocumentList();
                            this.DocList.Add(KeywordTerm, DocumentList);
                        }

                        DocumentList.AddDocument(msDoc);
                    }
                }
            }
        }
Example #4
0
        private static void Main(string[] args)
        {
            Document w = new Book(Title, Press, SiteCounter, Author, null);

            w.Title       = "The title of the document";
            w.Press       = "The press of the document";
            w.SiteCounter = 10;

            DocumentList docList = new DocumentList();

            try
            {
                docList.AddDocument(w);
            }
            catch (TitleExistException e)
            {
                Console.WriteLine(e);
            }

            DisplayListOfDocuments(docList);
        }