public ViewModel([CanBeNull] GenericModsEnabler enabler, IFilter <string> filter) { _enabler = enabler; _filter = filter; if (enabler != null) { Disabled = new BetterListCollectionView(enabler.Mods) { Filter = CreateFilter(false) }; Enabled = new BetterListCollectionView(enabler.Mods) { Filter = CreateFilter(true) }; Prepare(Enabled, "enabled"); Prepare(Disabled, "disabled"); enabler.Mods.ItemPropertyChanged += OnItemPropertyChanged; enabler.Mods.CollectionChanged += OnCollectionChanged; PresetableCategory = new PresetsCategory(enabler.ModsDirectory, ".mep"); } else { PresetableCategory = new PresetsCategory(SettingsHolder.GenericMods.GetModsDirectory(), ".mep"); } }
private static async Task <GenericModsEnabler> GetEnabler() { return(await GenericModsEnabler.GetInstanceAsync( AcRootDirectory.Instance.RequireValue, SettingsHolder.GenericMods.GetModsDirectory(), SettingsHolder.GenericMods.UseHardLinks)); }
public void Load() { var mods = SettingsHolder.GenericMods.GetModsDirectory(); if (Directory.Exists(mods)) { _enabler = GenericModsEnabler.GetInstanceAsync(AcRootDirectory.Instance.RequireValue, mods, SettingsHolder.GenericMods.UseHardLinks).Result; } }
public async Task LoadAsync(CancellationToken cancellationToken) { var mods = SettingsHolder.GenericMods.GetModsDirectory(); if (Directory.Exists(mods)) { _enabler = await GenericModsEnabler.GetInstanceAsync(AcRootDirectory.Instance.RequireValue, mods, SettingsHolder.GenericMods.UseHardLinks); } }
protected override async Task EnableAfterInstallation(CancellationToken token) { var enabler = await GenericModsEnabler.GetInstanceAsync( AcRootDirectory.Instance.RequireValue, SettingsHolder.GenericMods.GetModsDirectory(), SettingsHolder.GenericMods.UseHardLinks); enabler.ReloadList(); var mod = enabler.GetByName(Name); if (mod?.IsEnabled == false) { await enabler.EnableAsync(mod).ConfigureAwait(false); } }