public void RefreshAssets() { // Copies the Dirty hash set with ToHashSet so that if another thread changes Dirty, it doesn't mess up this loop foreach (string assetName in Dirty) { // If this asset hasn't failed to refresh and it's been loaded and it successfully merges (will attempt to load only if the other two are true) if (!Failed.Contains(assetName) && Assets.ContainsKey(assetName) && !this.Merge(assetName, Originals.GetDefault(assetName, null))) { ModEntry.INSTANCE.Monitor.Log($"Failed to merge {assetName}. Will not try to merge it again.", LogLevel.Warn); Failed.Add(assetName); } } Dirty.Clear(); }