Files
plugin-library/Assets/01.HybridCLR/Editor/Meta/PathAssemblyResolver.cs

41 lines
1.2 KiB
C#
Raw Normal View History

2025-03-31 14:55:24 +08:00
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)
{
2025-06-12 18:00:06 +08:00
assemblyPath = Path.Combine(path, $"{assemblyName}.dll");
if (File.Exists(assemblyPath))
2025-03-31 14:55:24 +08:00
{
2025-06-12 18:00:06 +08:00
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}");
2025-03-31 14:55:24 +08:00
return true;
}
}
assemblyPath = null;
return false;
}
}
}