@@ -7,7 +7,6 @@ using System.Threading.Tasks;
|
||||
using dnlib.DotNet;
|
||||
using HybridCLR.Editor.Meta;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using IAssemblyResolver = HybridCLR.Editor.Meta.IAssemblyResolver;
|
||||
|
||||
namespace HybridCLR.Editor.Link
|
||||
@@ -23,27 +22,26 @@ namespace HybridCLR.Editor.Link
|
||||
|
||||
public HashSet<TypeRef> CollectRefs(List<string> rootAssemblies)
|
||||
{
|
||||
var assCollector = new AssemblyCache(_resolver);
|
||||
var rootAssemblyNames = new HashSet<string>(rootAssemblies);
|
||||
|
||||
var typeRefs = new HashSet<TypeRef>(TypeEqualityComparer.Instance);
|
||||
foreach (var rootAss in rootAssemblies)
|
||||
using (var assCollector = new AssemblyCache(_resolver))
|
||||
{
|
||||
var dnAss = assCollector.LoadModule(rootAss, false);
|
||||
foreach (var type in dnAss.GetTypeRefs())
|
||||
var rootAssemblyNames = new HashSet<string>(rootAssemblies);
|
||||
|
||||
var typeRefs = new HashSet<TypeRef>(TypeEqualityComparer.Instance);
|
||||
foreach (var rootAss in rootAssemblies)
|
||||
{
|
||||
if (type.DefinitionAssembly == null)
|
||||
var dnAss = assCollector.LoadModule(rootAss, false);
|
||||
foreach (var type in dnAss.GetTypeRefs())
|
||||
{
|
||||
Debug.LogWarning($"assembly:{dnAss.Name} TypeRef {type.FullName} has no DefinitionAssembly");
|
||||
continue;
|
||||
}
|
||||
if (!rootAssemblyNames.Contains(type.DefinitionAssembly.Name.ToString()))
|
||||
{
|
||||
typeRefs.Add(type);
|
||||
if (!rootAssemblyNames.Contains(type.DefinitionAssembly.Name.ToString()))
|
||||
{
|
||||
typeRefs.Add(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assCollector.Dispose();
|
||||
return typeRefs;
|
||||
}
|
||||
return typeRefs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd3dd4871efd10e46947cb61c13797fd
|
||||
guid: 966868d081b9f044380d7ce9308231d8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace HybridCLR.Editor.Link
|
||||
{
|
||||
public class LinkXmlWriter
|
||||
internal class LinkXmlWriter
|
||||
{
|
||||
public void Write(string outputLinkXmlFile, HashSet<TypeRef> refTypes)
|
||||
{
|
||||
@@ -32,12 +32,6 @@ namespace HybridCLR.Editor.Link
|
||||
assTypeNames.Sort(string.CompareOrdinal);
|
||||
foreach(var typeName in assTypeNames)
|
||||
{
|
||||
#if UNITY_2023_1_OR_NEWER
|
||||
if (typeName == "UnityEngine.Debug")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
writer.WriteStartElement("type");
|
||||
writer.WriteAttributeString("fullname", typeName);
|
||||
writer.WriteAttributeString("preserve", "all");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5cc4ae4adc319b4bb1e115567d7613e
|
||||
guid: 06c46ecd48495b146b7863a70fd99208
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
Reference in New Issue
Block a user