static private int ScanAssemblyForFilters(Assembly assembly, FilterCache filter_cache) { int count = 0; foreach (Type t in ReflectionFu.GetTypesFromAssemblyAttribute(assembly, typeof(FilterTypesAttribute))) { Filter filter = null; try { filter = (Filter)Activator.CreateInstance(t); } catch (Exception ex) { Logger.Log.Error(ex, "Caught exception while instantiating {0}", t); } if (filter == null) { continue; } filter_versions_by_name [t.ToString()] = filter.Version; foreach (FilterFlavor flavor in filter.SupportedFlavors) { FilterFlavor.FilterTable [flavor] = t; } ++count; } if (count > 0) { DateTime last_mtime = File.GetLastWriteTimeUtc(assembly.Location); filter_cache.RegisterFilter(assembly.Location, last_mtime); } return(count); }
static private int ScanAssemblyForFilters (Assembly assembly, FilterCache filter_cache) { int count = 0; foreach (Type t in ReflectionFu.GetTypesFromAssemblyAttribute (assembly, typeof (FilterTypesAttribute))) { Filter filter = null; try { filter = (Filter) Activator.CreateInstance (t); } catch (Exception ex) { Logger.Log.Error (ex, "Caught exception while instantiating {0}", t); } if (filter == null) continue; filter_versions_by_name [t.ToString ()] = filter.Version; foreach (FilterFlavor flavor in filter.SupportedFlavors) FilterFlavor.FilterTable [flavor] = t; ++count; } if (count > 0) { DateTime last_mtime = File.GetLastWriteTimeUtc (assembly.Location); filter_cache.RegisterFilter (assembly.Location, last_mtime); } return count; }