示例#1
0
 public void Index()
 {
     Indexer indexer = new Indexer(new string[] { Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) });
     Catalog catalog = new Catalog();
     List<string> items = indexer.Index();
     foreach (string item in items)
     {
         string name = new FileInfo(item).Name;
         catalog.Add(new CatalogItem() { Path = item, Name = name.Substring(0, name.Length - 4) });
     }
     _catalog = catalog;
     _catalog.Meta = new CatalogMeta { LastGenerated = DateTime.Now };
 }
示例#2
0
文件: Program.cs 项目: itsbth/DoIt
        static void Main(string[] args)
        {
            Console.WindowWidth = 100;

            Indexer indexer = new Indexer(new string[]{ Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), @"C:\ProgramData\Microsoft\Windows\Start Menu" });
            Catalog catalog = (Catalog)(new XmlSerializer(typeof(Catalog)).Deserialize(new FileStream("Catalog.xml", FileMode.Open)));
            string search;
            do
            {
                search = Console.ReadLine();
                IOrderedEnumerable<CatalogItem> list = new CatalogSearcher(catalog).Search(search);
                foreach (CatalogItem item in list.Take(5))
                {
                    Console.WriteLine(item.Name);
                }
                //list.First().IncreaseCount(search);
            } while (search != "quit");
            {

            }
        }