mirror of
https://github.com/StarBeat/UnityDependencyAnalyzer.git
synced 2026-03-08 05:35:27 +08:00
修复使用错的 api
This commit is contained in:
parent
04e032164b
commit
6bc0bcd083
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
namespace UnityFileApi
|
namespace UnityFileApi
|
||||||
{
|
{
|
||||||
public static class DependencyTool
|
public static class DependencyTool
|
||||||
@ -12,38 +11,17 @@ namespace UnityFileApi
|
|||||||
public static List<string> GetDependencies(string path)
|
public static List<string> GetDependencies(string path)
|
||||||
{
|
{
|
||||||
List<string> dependencies = new List<string>();
|
List<string> dependencies = new List<string>();
|
||||||
try
|
|
||||||
{
|
|
||||||
using var archive = UnityFileSystem.MountArchive(path, "/");
|
|
||||||
foreach (var node in archive.Nodes)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Processing {node.Path} {node.Size} {node.Flags}");
|
|
||||||
|
|
||||||
if (node.Flags.HasFlag(ArchiveNodeFlags.SerializedFile))
|
// Try as SerializedFile
|
||||||
{
|
using (var serializedFile = UnityFileSystem.OpenSerializedFile(path))
|
||||||
using (var serializedFile = UnityFileSystem.OpenSerializedFile(path))
|
|
||||||
{
|
|
||||||
foreach (var extRef in serializedFile.ExternalReferences)
|
|
||||||
{
|
|
||||||
dependencies.Add(extRef.Guid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return dependencies;
|
|
||||||
}
|
|
||||||
catch (NotSupportedException)
|
|
||||||
{
|
{
|
||||||
// Try as SerializedFile
|
foreach (var extRef in serializedFile.ExternalReferences)
|
||||||
using (var serializedFile = UnityFileSystem.OpenSerializedFile(path))
|
|
||||||
{
|
{
|
||||||
foreach (var extRef in serializedFile.ExternalReferences)
|
dependencies.Add(extRef.Guid);
|
||||||
{
|
|
||||||
dependencies.Add(extRef.Guid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return dependencies;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return dependencies;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user