Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
HerpDerpinstine committed Dec 8, 2024
1 parent e5a3b9f commit f43cdbd
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions MelonLoader/Melons/MelonFolderHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,9 @@ internal static void Scan(eScanType type, string path)

if (type != eScanType.UserLibs)
{
// Load Melon Assemblies
// Load Plugins
List<MelonAssembly> pluginAssemblies = new();
MelonPreprocessor.LoadFolders(pluginDirs, true, ref hasWroteLine, ref pluginAssemblies);
PreloadMelonAssemblies(pluginAssemblies);

// Load Plugins
List<MelonPlugin> pluginsLoaded =
LoadMelons<MelonPlugin>(pluginAssemblies);

Expand All @@ -52,7 +49,6 @@ internal static void Scan(eScanType type, string path)
{
List<MelonAssembly> modAssemblies = new();
MelonPreprocessor.LoadFolders(modDirs, true, ref hasWroteLine, ref modAssemblies);
PreloadMelonAssemblies(modAssemblies);
modsLoaded = LoadMelons<MelonMod>(modAssemblies);
}

Expand Down Expand Up @@ -92,16 +88,13 @@ private static void LogStart(string path, eScanType type)
MelonLogger.Msg(loadingMsg);
}

private static void PreloadMelonAssemblies(List<MelonAssembly> melonAssemblies)
private static List<T> LoadMelons<T>(List<MelonAssembly> melonAssemblies)
where T : MelonTypeBase<T>
{
// Load Melons from Assembly
foreach (var asm in melonAssemblies)
asm.LoadMelons();
}

private static List<T> LoadMelons<T>(List<MelonAssembly> melonAssemblies)
where T : MelonTypeBase<T>
{
List<T> loadedMelons = new();
foreach (var asm in melonAssemblies)
foreach (var m in asm.LoadedMelons)
Expand Down

0 comments on commit f43cdbd

Please sign in to comment.