27 lines
745 B
C#
27 lines
745 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace HybridCLR.Editor.Meta
|
|
{
|
|
public class UnityEditorAssemblyResolver : IAssemblyResolver
|
|
{
|
|
public string ResolveAssembly(string assemblyName, bool throwExIfNotFind)
|
|
{
|
|
var refAss = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.GetName().Name == assemblyName);
|
|
if (refAss != null)
|
|
{
|
|
return refAss.Location;
|
|
}
|
|
if (throwExIfNotFind)
|
|
{
|
|
throw new Exception($"resolve assembly:{assemblyName} fail");
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
}
|