2022-09-22 08:56:07 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace HybridCLR.Editor.Meta
|
|
|
|
|
{
|
2022-12-14 14:11:32 +08:00
|
|
|
|
public class CombinedAssemblyResolver : AssemblyResolverBase
|
2022-09-22 08:56:07 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly IAssemblyResolver[] _resolvers;
|
|
|
|
|
|
|
|
|
|
public CombinedAssemblyResolver(params IAssemblyResolver[] resolvers)
|
|
|
|
|
{
|
|
|
|
|
_resolvers = resolvers;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-14 14:11:32 +08:00
|
|
|
|
protected override bool TryResolveAssembly(string assemblyName, out string assemblyPath)
|
2022-09-22 08:56:07 +08:00
|
|
|
|
{
|
|
|
|
|
foreach(var resolver in _resolvers)
|
|
|
|
|
{
|
|
|
|
|
var assembly = resolver.ResolveAssembly(assemblyName, false);
|
|
|
|
|
if (assembly != null)
|
|
|
|
|
{
|
2022-12-14 14:11:32 +08:00
|
|
|
|
assemblyPath = assembly;
|
|
|
|
|
return true;
|
2022-09-22 08:56:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-14 14:11:32 +08:00
|
|
|
|
assemblyPath = null;
|
|
|
|
|
return false;
|
2022-09-22 08:56:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|