/// <summary> /// Loads the filters. /// </summary> /// <param name="path">The path.</param> /// <param name="allFilters">Collection with all loaded filter instances.</param> public void LoadFilters(string path, ICollection allFilters) { m_loading = true; try { // Deactivate all filters foreach (ILogFilter filter in allFilters) { RemoveFilter(filter); } // Load filters List<ILogFilter> loadedFilters = null; using (FilterReader reader = new FilterReader(path)) { try { // Read file reader.ProcessHeader(); loadedFilters = reader.ReadFilters(allFilters); reader.ProcessEpilogue(); // Copy data CombineFilters = reader.CombineFilters; InvertCheck = reader.InvertCheck; } catch (Exception e) { Log.Error("Loading filters", e); } } // Activate loaded filters if (null != loadedFilters) { foreach (ILogFilter filter in loadedFilters) { AddFilter(filter); } } } finally { m_loading = false; } }