From 99591ef2db6d37f92d95908b8287cfe1acbabb79 Mon Sep 17 00:00:00 2001 From: Luca Di Leo Date: Mon, 30 Oct 2023 16:48:40 +0100 Subject: [PATCH] Improved memory utilization --- Obj2Tiles/Utils.cs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Obj2Tiles/Utils.cs b/Obj2Tiles/Utils.cs index 1df8bf3..3e8f410 100644 --- a/Obj2Tiles/Utils.cs +++ b/Obj2Tiles/Utils.cs @@ -34,74 +34,76 @@ private static IEnumerable GetMtlDependencies(string mtlPath) var mtlFile = File.ReadAllLines(mtlPath); var dependencies = new List(); - foreach (var line in mtlFile) { - if (line.Trim().StartsWith("map_Kd")) + + var trimmedLine = line.Trim(); + + if (trimmedLine.StartsWith("map_Kd")) { dependencies.Add(line[7..].Trim()); continue; } - if (line.Trim().StartsWith("map_Ka")) + if (trimmedLine.StartsWith("map_Ka")) { dependencies.Add(line[7..].Trim()); continue; } - if (line.Trim().StartsWith("norm")) + if (trimmedLine.StartsWith("norm")) { dependencies.Add(line[5..].Trim()); continue; } - if (line.Trim().StartsWith("map_Ks")) + if (trimmedLine.StartsWith("map_Ks")) { dependencies.Add(line[7..].Trim()); continue; } - if (line.Trim().StartsWith("map_Bump")) + if (trimmedLine.StartsWith("map_Bump")) { dependencies.Add(line[8..].Trim()); continue; } - if (line.Trim().StartsWith("map_d")) + if (trimmedLine.StartsWith("map_d")) { dependencies.Add(line[6..].Trim()); continue; } - if (line.Trim().StartsWith("map_Ns")) + if (trimmedLine.StartsWith("map_Ns")) { dependencies.Add(line[7..].Trim()); continue; } - if (line.Trim().StartsWith("bump")) + if (trimmedLine.StartsWith("bump")) { dependencies.Add(line[5..].Trim()); continue; } - if (line.Trim().StartsWith("disp")) + if (trimmedLine.StartsWith("disp")) { dependencies.Add(line[5..].Trim()); continue; } - if (line.Trim().StartsWith("decal")) + if (trimmedLine.StartsWith("decal")) { dependencies.Add(line[6..].Trim());