mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
|
|
namespace HybridCLR.Editor.Meta
|
|
{
|
|
public class PathAssemblyResolver : AssemblyResolverBase
|
|
{
|
|
private readonly string[] _searchPaths;
|
|
public PathAssemblyResolver(params string[] searchPaths)
|
|
{
|
|
_searchPaths = searchPaths;
|
|
}
|
|
|
|
protected override bool TryResolveAssembly(string assemblyName, out string assemblyPath)
|
|
{
|
|
foreach(var path in _searchPaths)
|
|
{
|
|
assemblyPath = Path.Combine(path, $"{assemblyName}.dll");
|
|
if (File.Exists(assemblyPath))
|
|
{
|
|
Debug.Log($"resolve {assemblyName} at {assemblyPath}");
|
|
return true;
|
|
}
|
|
assemblyPath = Path.Combine(path, $"{assemblyName}.dll.bytes");
|
|
if (File.Exists(assemblyPath))
|
|
{
|
|
Debug.Log($"resolve {assemblyName} at {assemblyPath}");
|
|
return true;
|
|
}
|
|
}
|
|
assemblyPath = null;
|
|
return false;
|
|
}
|
|
}
|
|
}
|