private static void ReportReflectionLoad( AssemblyName assmName, Assembly assembly, Assembly requesting) { if (PluginsFactory <T> .log.get_IsWarnEnabled() && !StringComparer.Ordinal.Equals(assmName.FullName, assembly.FullName)) { PluginsFactory <T> .log.WarnFormat("inspecting [{0}] as [{1}]{2}{3}", new object[4] { (object)assmName, (object)assembly, (object)PluginsFactory <T> .FormatCodeBase(assembly), (object)PluginsFactory <T> .FormatRequest(requesting) }); } else { if (!PluginsFactory <T> .log.get_IsDebugEnabled()) { return; } PluginsFactory <T> .log.DebugFormat("inspecting [{0}] as [{1}]{2}{3}", new object[4] { (object)assmName, (object)assembly, (object)PluginsFactory <T> .FormatCodeBase(assembly), (object)PluginsFactory <T> .FormatRequest(requesting) }); } }
private static Assembly CurrentDomain_ReflectionOnlyAssemblyResolve( object sender, ResolveEventArgs args) { AssemblyName assemblyName1 = new AssemblyName(args.Name); Assembly requestingAssembly = args.RequestingAssembly; List <Exception> exceptionList = new List <Exception>(); try { Assembly assembly = Assembly.ReflectionOnlyLoad(args.Name); PluginsFactory <T> .ReportReflectionLoad(assemblyName1, assembly, requestingAssembly); return(assembly); } catch (Exception ex) { exceptionList.Add(ex); } foreach (Assembly assembly in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies()) { if (AssemblyName.ReferenceMatchesDefinition(assembly.GetName(), assemblyName1)) { PluginsFactory <T> .ReportReflectionLoad(assemblyName1, assembly, requestingAssembly); return(assembly); } } if (requestingAssembly != (Assembly)null) { try { Uri uri = new Uri(requestingAssembly.CodeBase); if (uri.IsAbsoluteUri) { string str = Path.Combine(Path.GetDirectoryName(uri.LocalPath) ?? string.Empty, assemblyName1.Name + ".dll"); if (File.Exists(str)) { AssemblyName assemblyName2 = AssemblyName.GetAssemblyName(str); if (AssemblyName.ReferenceMatchesDefinition(assemblyName1, assemblyName2)) { Assembly assembly = Assembly.ReflectionOnlyLoadFrom(str); PluginsFactory <T> .ReportReflectionLoad(assemblyName1, assembly, requestingAssembly); return(assembly); } } } } catch (Exception ex) { exceptionList.Add(ex); } } try { foreach (Assembly assembly1 in AppDomain.CurrentDomain.GetAssemblies()) { AssemblyName name = assembly1.GetName(); if (AssemblyName.ReferenceMatchesDefinition(name, assemblyName1)) { Uri uri = new Uri(name.CodeBase); if (uri.IsAbsoluteUri) { Assembly assembly2 = Assembly.ReflectionOnlyLoadFrom(uri.LocalPath); PluginsFactory <T> .ReportReflectionLoad(assemblyName1, assembly2, requestingAssembly); return(assembly2); } } } } catch (Exception ex) { exceptionList.Add(ex); } if (!PluginsFactory <T> .log.get_IsErrorEnabled()) { return((Assembly)null); } AggregateException aggregateException = new AggregateException(new StringBuilder("inspecting [").Append(args.Name).Append(']').Append(PluginsFactory <T> .FormatRequest(requestingAssembly)).Append('.').ToString(), (IEnumerable <Exception>)exceptionList); PluginsFactory <T> .log.WarnFormat("{0}", (object)aggregateException); return((Assembly)null); }
// Token: 0x060008FB RID: 2299 RVA: 0x00040AF8 File Offset: 0x0003ECF8 private static Assembly CurrentDomain_ReflectionOnlyAssemblyResolve(object sender, ResolveEventArgs args) { AssemblyName assemblyName = new AssemblyName(args.Name); Assembly requestingAssembly = args.RequestingAssembly; List <Exception> list = new List <Exception>(); try { Assembly assembly = Assembly.ReflectionOnlyLoad(args.Name); PluginsFactory <T> .ReportReflectionLoad(assemblyName, assembly, requestingAssembly); return(assembly); } catch (Exception item) { list.Add(item); } foreach (Assembly assembly2 in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies()) { if (AssemblyName.ReferenceMatchesDefinition(assembly2.GetName(), assemblyName)) { PluginsFactory <T> .ReportReflectionLoad(assemblyName, assembly2, requestingAssembly); return(assembly2); } } if (requestingAssembly != null) { try { Uri uri = new Uri(requestingAssembly.CodeBase); if (uri.IsAbsoluteUri) { string text = Path.Combine(Path.GetDirectoryName(uri.LocalPath) ?? string.Empty, assemblyName.Name + ".dll"); if (File.Exists(text)) { AssemblyName assemblyName2 = AssemblyName.GetAssemblyName(text); if (AssemblyName.ReferenceMatchesDefinition(assemblyName, assemblyName2)) { Assembly assembly3 = Assembly.ReflectionOnlyLoadFrom(text); PluginsFactory <T> .ReportReflectionLoad(assemblyName, assembly3, requestingAssembly); return(assembly3); } } } } catch (Exception item2) { list.Add(item2); } } try { Assembly[] array = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < array.Length; i++) { AssemblyName name = array[i].GetName(); if (AssemblyName.ReferenceMatchesDefinition(name, assemblyName)) { Uri uri2 = new Uri(name.CodeBase); if (uri2.IsAbsoluteUri) { Assembly assembly4 = Assembly.ReflectionOnlyLoadFrom(uri2.LocalPath); PluginsFactory <T> .ReportReflectionLoad(assemblyName, assembly4, requestingAssembly); return(assembly4); } } } } catch (Exception item3) { list.Add(item3); } if (!PluginsFactory <T> .log.IsErrorEnabled) { return(null); } AggregateException ex = new AggregateException(new StringBuilder("inspecting [").Append(args.Name).Append(']').Append(PluginsFactory <T> .FormatRequest(requestingAssembly)).Append('.').ToString(), list); PluginsFactory <T> .log.WarnFormat("{0}", ex); return(null); }