private void init(BasePath path, Scanner scanner) { this.scanner = scanner; Path = path; if (Manager.Threads > 0) slots = Manager.Threads; Files = new ArrayList(); Directories = new List<Directory>(); Directory d; if ((d = Manager.GetDirectory(Path.Name)) == null) { d = new Directory(); d.Name = ""; d.ShortName = ""; d.FullName = Path.Name; d.BasePathId = Path.Id; if (d.Save()) Manager.Directories.Add(d); else { Log.Warning("Unable to save root dir {0} to directories!\n", Path.Name); } } Directories.Add(d); crawl(Path.Name); }
public Indexer(BasePath path, Scanner scanner, bool recurse) { Log.Debug("Indexer with recursion: {0}\n", recurse); this.recurse = recurse; init(path, scanner); }
/// <summary> /// Contructor /// </summary> /// <param name="path"> /// A <see cref="System.String"/> /// </param> /// <param name="scanner"></param> public Indexer(BasePath path, Scanner scanner) { init(path, scanner); }
/// <summary> /// Starts a scanning/indexing session in <paramref name="paths"/> /// </summary> /// <param name="paths"> /// </param> /// <param name="recurse"> /// </param> public static void Scan(List<BasePath> paths, bool recurse) { DateTime now = DateTime.Now; Console.Write("\n::: Starting scanner pass: {0}\n", now); Scanner scanner = new Scanner(paths, recurse); Console.Write("::: Collected {0} files,", scanner.TotalFiles); Console.Write(" starting indexer...\n\n"); scanner.Run(); while (scanner.FilesDone < scanner.TotalFiles) Thread.Sleep(50); Console.Write("\n::: Scanning took: {0}\n", DateTime.Now - now); scanner.Dispose(); }