Use a Dictionary instead of List for Mounting file entries, using their path as key (#3496)

Games with multiple archives can have multiple files with same names through their archives, either for HDD/CD seek optimization with sequential access redundancy or patch versioning

We don't even support duplicate file names in archive loading but they'd be added regardless to our list & UI
This commit is contained in:
Sam Pavlovic
2025-11-30 13:30:41 -03:00
committed by GitHub
parent 705f7ab7f5
commit 041dfab0c2

View File

@@ -63,7 +63,7 @@ public abstract class BaseGameMount
await Mount( new MountContext( this ) );
foreach ( var entry in _entries )
foreach ( var entry in _entries.Values )
{
RootFolder.AddResource( entry );
}
@@ -81,7 +81,7 @@ public abstract class BaseGameMount
Shutdown();
foreach ( var entry in _entries )
foreach ( var entry in _entries.Values )
{
entry?.ShutdownInternal();
}
@@ -98,19 +98,18 @@ public abstract class BaseGameMount
}
readonly List<ResourceLoader> _entries = [];
readonly Dictionary<string, ResourceLoader> _entries = [];
/// <summary>
/// All of the resources in this game
/// </summary>
public IReadOnlyCollection<ResourceLoader> Resources => _entries.AsReadOnly();
public IReadOnlyCollection<ResourceLoader> Resources => _entries.Values;
public ResourceFolder RootFolder { get; internal set; }
internal void RegisterFileInternal( ResourceLoader entry )
{
_entries.Add( entry );
_entries[entry.Path] = entry;
}
/// <summary>