fix: case insensitive search

This commit is contained in:
2026-06-18 17:53:07 -03:00
parent 6dad0eecee
commit 396152e67b
+23 -2
View File
@@ -268,15 +268,32 @@ class Dumper
string relativeOutPath = outPath.TrimStart('/', '\\'); string relativeOutPath = outPath.TrimStart('/', '\\');
string fullPath = Path.Combine(_outDir, relativeOutPath, fileName); string fullPath = Path.Combine(_outDir, relativeOutPath, fileName);
// consider umg path for icons (should i also do this with perks and offerings n stuff?)
if (cleanPath.StartsWith("UI/Icons/")) if (cleanPath.StartsWith("UI/Icons/"))
cleanPath = "/Game/UI/UMGAssets/" + cleanPath["UI/".Length..]; cleanPath = "/Game/UI/UMGAssets/" + cleanPath["UI/".Length..];
if (File.Exists(fullPath)) return; if (File.Exists(fullPath)) return;
if (_provider == null) return; if (_provider == null) return;
// special thanks to whichever dev kept fucking up the casing
if (!_provider.TryLoadPackage(cleanPath, out IPackage? package))
{
_log.Verbose("Failed exact path match for {0}. Attempting case-insensitive search", cleanPath);
if (_provider.TryLoadPackage(cleanPath, out IPackage? package)) string searchSuffix = cleanPath;
if (searchSuffix.StartsWith("/Game/"))
searchSuffix = searchSuffix["/Game/".Length..];
if (!searchSuffix.EndsWith(".uasset"))
searchSuffix += ".uasset";
var actualFile = _provider.Files.FirstOrDefault(kvp => kvp.Key.EndsWith(searchSuffix, StringComparison.OrdinalIgnoreCase));
if (actualFile.Value != null)
_provider.TryLoadPackage(actualFile.Value, out package);
}
if (package != null)
{ {
UTexture2D? texture = package.GetExports().OfType<UTexture2D>().FirstOrDefault(); UTexture2D? texture = package.GetExports().OfType<UTexture2D>().FirstOrDefault();
@@ -295,9 +312,13 @@ class Dumper
File.WriteAllBytes(fullPath, bytes); File.WriteAllBytes(fullPath, bytes);
_log.Verbose("Exported icon: {0}", fileName); _log.Verbose("Exported icon: {0}", fileName);
} }
else
throw new InvalidDataException("Bitmap was invalid");
} }
else else
throw new FileNotFoundException("Failed to find texture"); throw new FileNotFoundException("Failed to find texture");
} }
else
throw new FileNotFoundException("Failed to find texture package");
} }
} }