Speed up DirLoader.DirLoader on Windows.

New FileHelper.TryOpenFileRead that doesn't throw if the file doesn't exist.

Also used it in a couple other spots.
This commit is contained in:
Pieter-Jan Briers
2023-07-15 19:08:37 +02:00
parent 177ca6b627
commit d967bc9fdc
4 changed files with 77 additions and 14 deletions

View File

@@ -895,12 +895,10 @@ namespace Robust.Shared.ContentPack
{
var path = Path.Combine(diskLoadPath, dllName);
if (!File.Exists(path))
{
if (!FileHelper.TryOpenFileRead(path, out var fileStream))
continue;
}
return ModLoader.MakePEReader(File.OpenRead(path));
return ModLoader.MakePEReader(fileStream);
}
foreach (var resLoadPath in _resLoadPaths)