diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs
index 306a17ad..ed2b6141 100644
--- a/src/SMAPI.Installer/InteractiveInstaller.cs
+++ b/src/SMAPI.Installer/InteractiveInstaller.cs
@@ -377,8 +377,11 @@ internal class InteractiveInstaller
{
// copy SMAPI files to game dir
this.PrintDebug("Adding SMAPI files...");
- foreach (FileSystemInfo sourceEntry in paths.BundleDir.EnumerateFileSystemInfos().Where(this.ShouldCopy))
+ foreach (FileSystemInfo sourceEntry in paths.BundleDir.EnumerateFileSystemInfos())
{
+ if (!this.ShouldCopy(sourceEntry))
+ continue;
+
this.InteractivelyDelete(Path.Combine(paths.GameDir.FullName, sourceEntry.Name), allowUserInput);
this.RecursiveCopy(sourceEntry, paths.GameDir);
}
diff --git a/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs b/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs
index 03bd482e..42f4cf34 100644
--- a/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs
+++ b/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs
@@ -329,8 +329,11 @@ public class ModScanner
{
bool hasXnbFile = false;
- foreach (FileInfo file in files.Where(this.IsRelevant))
+ foreach (FileInfo file in files)
{
+ if (!this.IsRelevant(file))
+ continue;
+
if (this.StrictXnbModExtensions.Contains(file.Extension))
{
hasXnbFile = true;
diff --git a/src/SMAPI.Web/Framework/Caching/Mods/ModCacheMemoryRepository.cs b/src/SMAPI.Web/Framework/Caching/Mods/ModCacheMemoryRepository.cs
index dab71473..b6029c14 100644
--- a/src/SMAPI.Web/Framework/Caching/Mods/ModCacheMemoryRepository.cs
+++ b/src/SMAPI.Web/Framework/Caching/Mods/ModCacheMemoryRepository.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
-using System.Linq;
using StardewModdingAPI.Toolkit.Framework.UpdateData;
namespace StardewModdingAPI.Web.Framework.Caching.Mods;
@@ -13,7 +12,7 @@ internal class ModCacheMemoryRepository : BaseCacheRepository, IModCacheReposito
** Fields
*********/
/// The cached mod data indexed by {site key}:{ID}.
- private readonly IDictionary> Mods = new Dictionary>(StringComparer.OrdinalIgnoreCase);
+ private readonly Dictionary> Mods = new(StringComparer.OrdinalIgnoreCase);
/*********
@@ -57,13 +56,11 @@ internal class ModCacheMemoryRepository : BaseCacheRepository, IModCacheReposito
{
DateTimeOffset minDate = DateTimeOffset.UtcNow.Subtract(age);
- string[] staleKeys = this.Mods
- .Where(p => p.Value.LastRequested < minDate)
- .Select(p => p.Key)
- .ToArray();
-
- foreach (string key in staleKeys)
- this.Mods.Remove(key);
+ foreach ((string key, var modPage) in this.Mods)
+ {
+ if (modPage.LastRequested < minDate)
+ this.Mods.Remove(key);
+ }
}
diff --git a/src/SMAPI/Framework/ContentCoordinator.cs b/src/SMAPI/Framework/ContentCoordinator.cs
index de7150dc..48d980d3 100644
--- a/src/SMAPI/Framework/ContentCoordinator.cs
+++ b/src/SMAPI/Framework/ContentCoordinator.cs
@@ -499,8 +499,11 @@ internal class ContentCoordinator : IDisposable
return this.ContentManagerLock.InReadLock(() =>
{
List