mirror of
https://github.com/ZuneDev/ZuneModdingHelper.git
synced 2026-07-27 13:12:21 -07:00
Create GetAvailableMods overload
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ZuneModCore.Mods;
|
||||
|
||||
namespace ZuneModCore;
|
||||
|
||||
public class ModManager
|
||||
{
|
||||
private static List<Mod>? _mods;
|
||||
|
||||
/// <summary>
|
||||
/// Factories for all available mods.
|
||||
/// </summary>
|
||||
@@ -17,13 +20,20 @@ public class ModManager
|
||||
new MbidLocatorModFactory(),
|
||||
}.AsReadOnly();
|
||||
|
||||
private static List<Mod>? _mods;
|
||||
public static IReadOnlyList<Mod> GetAvailableMods()
|
||||
/// <summary>
|
||||
/// Creates instances of each mod using the available factories
|
||||
/// using the default MVVM IoC instance.
|
||||
/// </summary>
|
||||
public static IReadOnlyList<Mod> GetAvailableMods() => GetAvailableMods(CommunityToolkit.Mvvm.DependencyInjection.Ioc.Default);
|
||||
|
||||
/// <summary>
|
||||
/// Creates instances of each mod using the available factories.
|
||||
/// </summary>
|
||||
public static IReadOnlyList<Mod> GetAvailableMods(IServiceProvider services)
|
||||
{
|
||||
if (_mods is null)
|
||||
{
|
||||
_mods = new(ModFactories.Count);
|
||||
var services = CommunityToolkit.Mvvm.DependencyInjection.Ioc.Default;
|
||||
|
||||
foreach (var modType in ModFactories)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user