hybridclr_unity/Editor/Meta/CombinedAssemblyResolver.cs

34 lines
908 B
C#
Raw Permalink Normal View History

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
{
public class CombinedAssemblyResolver : AssemblyResolverBase
2022-09-22 08:56:07 +08:00
{
private readonly IAssemblyResolver[] _resolvers;
public CombinedAssemblyResolver(params IAssemblyResolver[] resolvers)
{
_resolvers = resolvers;
}
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)
{
assemblyPath = assembly;
return true;
2022-09-22 08:56:07 +08:00
}
}
assemblyPath = null;
return false;
2022-09-22 08:56:07 +08:00
}
}
}