ResourceTree: Rework Internal flag, improve null checks, simplify

This commit is contained in:
Exter-N 2023-11-02 01:08:02 +01:00
parent db9bfb00a3
commit 3da20f2d89
2 changed files with 48 additions and 51 deletions

View file

@ -15,7 +15,6 @@ public class ResourceNode : ICloneable
public Utf8GamePath[] PossibleGamePaths;
public FullPath FullPath;
public readonly ulong Length;
public readonly bool Internal;
public readonly List<ResourceNode> Children;
internal ResolveContext? ResolveContext;
@ -31,14 +30,16 @@ public class ResourceNode : ICloneable
}
}
internal ResourceNode(ResourceType type, nint objectAddress, nint resourceHandle, ulong length, bool @internal, ResolveContext? resolveContext)
public bool Internal
=> Type is ResourceType.Imc;
internal ResourceNode(ResourceType type, nint objectAddress, nint resourceHandle, ulong length, ResolveContext? resolveContext)
{
Type = type;
ObjectAddress = objectAddress;
ResourceHandle = resourceHandle;
PossibleGamePaths = Array.Empty<Utf8GamePath>();
Length = length;
Internal = @internal;
Children = new List<ResourceNode>();
ResolveContext = resolveContext;
}
@ -54,7 +55,6 @@ public class ResourceNode : ICloneable
PossibleGamePaths = other.PossibleGamePaths;
FullPath = other.FullPath;
Length = other.Length;
Internal = other.Internal;
Children = other.Children;
ResolveContext = other.ResolveContext;
}