CombinedAssemblyResolver.cs 908 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace HybridCLR.Editor.Meta
  7. {
  8. public class CombinedAssemblyResolver : AssemblyResolverBase
  9. {
  10. private readonly IAssemblyResolver[] _resolvers;
  11. public CombinedAssemblyResolver(params IAssemblyResolver[] resolvers)
  12. {
  13. _resolvers = resolvers;
  14. }
  15. protected override bool TryResolveAssembly(string assemblyName, out string assemblyPath)
  16. {
  17. foreach(var resolver in _resolvers)
  18. {
  19. var assembly = resolver.ResolveAssembly(assemblyName, false);
  20. if (assembly != null)
  21. {
  22. assemblyPath = assembly;
  23. return true;
  24. }
  25. }
  26. assemblyPath = null;
  27. return false;
  28. }
  29. }
  30. }