Esempio n. 1
0
        private void RefreshHyperlinks()
        {
            if (repository == null)
            {
                repository          = new HyperlinksRepository((this.file));
                hyperlinkCollection = new List <HyperlinkItem>(repository.LoadAllHyperlinks());
            }
            else
            {
                hyperlinkCollection = new List <HyperlinkItem>(repository.LoadAllHyperlinks());
            }

            this.keyPhraseLibrary = new Keyphrases(repository.LoadKeyPhrases());
        }
Esempio n. 2
0
        public bool OpenFile(string file)
        {
            if (File.Exists(file))
            {
                this.file                = file;
                this.keyPhraseFilter     = null;
                this.keyPhraseLibrary    = null;
                this.repository          = null;
                this.hyperlinkCollection = null;

                return(true);
            }
            return(false);
        }
Esempio n. 3
0
 private void EnsureState()
 {
     if (repository == null)
     {
         repository          = new HyperlinksRepository((this.file));
         hyperlinkCollection = new List <HyperlinkItem>(repository.LoadAllHyperlinks());
     }
     if (this.keyPhraseFilter == null)
     {
         this.keyPhraseFilter = new Keyphrases(string.Empty);
     }
     if (this.keyPhraseLibrary == null)
     {
         this.keyPhraseLibrary = new Keyphrases(repository.LoadKeyPhrases());
     }
 }
Esempio n. 4
0
        private bool ContainsPhrase(string[] keywordCollection)
        {
            Keyphrases hyperlinkKeywords = new Keyphrases(keywordCollection.ToList());

            if (hyperlinkKeywords.Exist)
            {
                foreach (string keyword in keyPhraseFilter.KeyPhrases)
                {
                    bool result = (from k in hyperlinkKeywords.KeyPhrases
                                   where k.ToUpper().Contains(keyword.ToUpper()) // && keyword != string.Empty
                                   select keyword.Distinct()).Count() > 0;

                    if (!result) // if at any point result is false, return false...
                    {
                        return(false);
                    }
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }