2025-05-30 13:32:29 +08:00
|
|
|
|
using System.IO;
|
2025-05-21 09:23:29 +08:00
|
|
|
|
|
|
|
|
|
namespace Obfuz.Utils
|
|
|
|
|
{
|
|
|
|
|
public class PathAssemblyResolver : AssemblyResolverBase
|
|
|
|
|
{
|
|
|
|
|
private readonly string[] _searchPaths;
|
|
|
|
|
|
|
|
|
|
public PathAssemblyResolver(params string[] searchPaths)
|
|
|
|
|
{
|
|
|
|
|
_searchPaths = searchPaths;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string ResolveAssembly(string assemblyName)
|
|
|
|
|
{
|
2025-05-30 13:32:29 +08:00
|
|
|
|
foreach (var path in _searchPaths)
|
2025-05-21 09:23:29 +08:00
|
|
|
|
{
|
|
|
|
|
string assPath = Path.Combine(path, assemblyName + ".dll");
|
|
|
|
|
if (File.Exists(assPath))
|
|
|
|
|
{
|
|
|
|
|
//Debug.Log($"resolve {assemblyName} at {assPath}");
|
|
|
|
|
return assPath;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|