private void OnConfigurationChanged (Config config) { if (config == null || config.Name != Conf.Names.FilesQueryableConfig) return; bool clear_fs_state = false; List<string[]> values = config.GetListOptionValues (Conf.Names.ExcludeSubdirectory); if (values != null) { ArrayList subdirs = new ArrayList (values.Count); foreach (string[] value in values) { string dir = GetExcludeDirectory (value [0]); if (! String.IsNullOrEmpty (dir)) subdirs.Add (dir); } IList excludes_wanted = subdirs; IList excludes_to_add, excludes_to_remove; ArrayFu.IntersectListChanges (excludes_wanted, exclude_paths, out excludes_to_add, out excludes_to_remove); // Process any excludes we think we should remove foreach (string path in excludes_to_remove) RemoveExcludeDir (path); // Process any excludes we found to be new foreach (string path in excludes_to_add) AddExcludeDir (path); } values = config.GetListOptionValues (Conf.Names.ExcludePattern); if (values != null) { ArrayList patterns = new ArrayList (values.Count); foreach (string[] value in values) patterns.Add (value [0]); IList excludes_wanted = patterns; IList excludes_to_add, excludes_to_remove; ArrayFu.IntersectListChanges (excludes_wanted, exclude_patterns, out excludes_to_add, out excludes_to_remove); // Process any excludes we think we should remove foreach (string pattern in excludes_to_remove) { clear_fs_state = true; RemoveExcludePattern (pattern); } // Process any excludes we found to be new foreach (string pattern in excludes_to_add) AddExcludePattern (pattern); exclude_regex = StringFu.GetPatternRegex (exclude_patterns); } // If an exclude pattern is removed, we need to recrawl everything // so that we can index those files which were previously ignored. if (clear_fs_state) queryable.RecrawlEverything (); }
private static void ShowOption (Config config, Option option) { if (option.Type == OptionType.Bool) { Console.WriteLine (" - {0}={2} ({1})", option.Name, option.Description, config.GetOption (option.Name, true)); } else if (option.Type == OptionType.String) { Console.WriteLine (" - {0}={2} ({1})", option.Name, option.Description, config.GetOption (option.Name, String.Empty)); } else if (option.Type == OptionType.List) { Console.WriteLine (" - {0} : ({1})", option.Name, option.Description); Console.Write (" Parameters:"); string[] param_names = config.GetListOptionParams (option.Name); for (int j = 0; j < param_names.Length; ++j) Console.Write (" [{0}] ", param_names [j]); Console.WriteLine (); List<string[]> items = config.GetListOptionValues (option.Name); if (items == null) return; Console.WriteLine (" Values:"); foreach (string[] item in items) { DisplayListItem (param_names, item); } } }
private void OnConfigurationChanged (Config config) { if (config == null || config.Name != Conf.Names.FilesQueryableConfig) return; List<string[]> values = config.GetListOptionValues (Conf.Names.Roots); if (values == null) values = new List<string[]> (0); ArrayList roots_wanted = new ArrayList (values.Count); foreach (string[] root in values) roots_wanted.Add (root [0]); if (config.GetOption (Conf.Names.IndexHomeDir, true)) roots_wanted.Add (PathFinder.HomeDir); IList roots_to_add, roots_to_remove; ArrayFu.IntersectListChanges (roots_wanted, Roots, out roots_to_add, out roots_to_remove); foreach (string root in roots_to_remove) RemoveRoot (root); foreach (string root in roots_to_add) AddRoot (root); }