private void ProcessAssembly(string fileName) { PluginsFactory <T> .log.DebugFormat("Loading plugins from {0}", (object)fileName); AssemblyName assemblyName = AssemblyName.GetAssemblyName(fileName); Assembly assembly1 = (Assembly)null; foreach (Assembly assembly2 in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies()) { if (AssemblyName.ReferenceMatchesDefinition(assembly2.GetName(), assemblyName)) { assembly1 = assembly2; try { string fullPath = Path.GetFullPath(new Uri(assembly1.CodeBase).LocalPath); if (!StringComparer.OrdinalIgnoreCase.Equals(fileName, fullPath)) { PluginsFactory <T> .log.WarnFormat("inspecting [{0}] at '{1}' as [{2}] at '{3}'", new object[4] { (object)assemblyName, (object)fileName, (object)assembly1, (object)fullPath }); break; } break; } catch (Exception ex) { PluginsFactory <T> .log.WarnFormat("inspecting [{0}] at '{1}' as [{2}]. {3}", new object[4] { (object)assemblyName, (object)fileName, (object)assembly1, (object)ex }); break; } } } if (assembly1 == (Assembly)null) { assembly1 = Assembly.ReflectionOnlyLoadFrom(fileName); } List <Type> derivedTypes = PluginsFactory <T> .FindDerivedTypes <T>(assembly1); if (derivedTypes.Count != 0) { derivedTypes = PluginsFactory <T> .FindDerivedTypes <T>(Assembly.LoadFrom(fileName)); } foreach (Type type in derivedTypes) { PluginsFactory <T> .log.DebugFormat("Creating plugin for {0}", (object)type); T instance = (T)Activator.CreateInstance(type); this.Plugins.Add(instance); string empty = string.Empty; PropertyInfo property = instance.GetType().GetProperty("FlagName"); if (property != (PropertyInfo)null) { empty = (string)property.GetValue((object)instance, (object[])null); } if (PluginsFactory <T> .log.get_IsInfoEnabled()) { PluginsFactory <T> .log.InfoFormat("Loaded plugin {0} for {1} from {2}", (object)type, (object)empty, (object)fileName); } } }
// Token: 0x060008FC RID: 2300 RVA: 0x00040D1C File Offset: 0x0003EF1C private void ProcessAssembly(string fileName) { PluginsFactory <T> .log.DebugFormat("Loading plugins from {0}", fileName); AssemblyName assemblyName = AssemblyName.GetAssemblyName(fileName); Assembly assembly = null; foreach (Assembly assembly2 in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies()) { if (AssemblyName.ReferenceMatchesDefinition(assembly2.GetName(), assemblyName)) { assembly = assembly2; try { string fullPath = Path.GetFullPath(new Uri(assembly.CodeBase).LocalPath); if (!StringComparer.OrdinalIgnoreCase.Equals(fileName, fullPath)) { PluginsFactory <T> .log.WarnFormat("inspecting [{0}] at '{1}' as [{2}] at '{3}'", new object[] { assemblyName, fileName, assembly, fullPath }); } break; } catch (Exception ex) { PluginsFactory <T> .log.WarnFormat("inspecting [{0}] at '{1}' as [{2}]. {3}", new object[] { assemblyName, fileName, assembly, ex }); break; } } } if (assembly == null) { assembly = Assembly.ReflectionOnlyLoadFrom(fileName); } List <Type> list = PluginsFactory <T> .FindDerivedTypes <T>(assembly); if (list.Count != 0) { list = PluginsFactory <T> .FindDerivedTypes <T>(Assembly.LoadFrom(fileName)); } foreach (Type type in list) { PluginsFactory <T> .log.DebugFormat("Creating plugin for {0}", type); T t = (T)((object)Activator.CreateInstance(type)); this.Plugins.Add(t); string text = string.Empty; PropertyInfo property = t.GetType().GetProperty("FlagName"); if (property != null) { text = (string)property.GetValue(t, null); } if (PluginsFactory <T> .log.IsInfoEnabled) { PluginsFactory <T> .log.InfoFormat("Loaded plugin {0} for {1} from {2}", type, text, fileName); } } }