Пример #1
0
 private bool ValidLink(Link link)
 {
     foreach(string term in IgnoreTerms)
     {
         if (Regex.IsMatch(link.FileName, term, RegexOptions.IgnoreCase))
         {
             return false;
         }
     }
     return true;
 }
Пример #2
0
        public void Index()
        {
            Links = new List<Link>();
            foreach (string folder in Folders)
            {
                try
                {
                    var lnkFiles = Directory.EnumerateFiles(folder, "*.lnk", SearchOption.AllDirectories);
                    foreach (string filePath in lnkFiles)
                    {
                        // TODO load history score
                        Link link = new Link(filePath, 0);

                        if (ValidLink(link))
                            Links.Add(link);
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine("AddLinks exception: " + e);
                }
            }
        }