public AllModsMissingErrorVm( IProfileDataFolderVm dataFolderVm, OpenProfileSettings openProfileSettings, IImplicitListingModKeyProvider implicitListingsProvider, IProfileLoadOrder profileLoadOrder) { var nonImplicit = profileLoadOrder.LoadOrder.Connect() .Filter(x => !implicitListingsProvider.Listings.Contains(x.ModKey)) .ObserveOn(RxApp.MainThreadScheduler) .AsObservableList(); _InError = nonImplicit.CountChanged .Select(x => x > 0) .CombineLatest( nonImplicit.Connect() .FilterOnObservable(i => i.WhenAnyValue(x => x.Exists)) .QueryWhenChanged(q => q.Count > 0), (hasAny, anyExist) => hasAny && !anyExist) .ToGuiProperty(this, nameof(InError), deferSubscription: true); _ErrorString = nonImplicit.CountChanged .Select(count => { return($"Load order listed {count} mods, but none were found in the game's data folder"); }) .ToGuiProperty(this, nameof(ErrorString), default(string?), deferSubscription: true); _DataFolderPath = dataFolderVm.WhenAnyValue(x => x.Path) .Select(x => x.Path) .ToGuiProperty(this, nameof(DataFolderPath), string.Empty, deferSubscription: true); GoToProfileSettingsCommand = openProfileSettings.OpenCommand; }
public ImplicitListingsProvider( IFileSystem fileSystem, IDataDirectoryProvider dataFolder, IImplicitListingModKeyProvider listingModKeys) { _fileSystem = fileSystem; DataFolder = dataFolder; ListingModKeys = listingModKeys; }
public LoadOrderWriter( IFileSystem fileSystem, IHasEnabledMarkersProvider hasEnabledMarkersProvider, IImplicitListingModKeyProvider implicitListingsProvider) { _fileSystem = fileSystem; _hasEnabledMarkersProvider = hasEnabledMarkersProvider; _implicitListingsProvider = implicitListingsProvider; }
public void LiveLoadOrder_PluginsCCListingReorders( [Frozen] IScheduler scheduler, [Frozen] MockFileSystemWatcher watcher, [Frozen] MockFileSystem fs, [Frozen] IImplicitListingModKeyProvider implicitListingsProvider, [Frozen] ILiveLoadOrderTimings timings, [Frozen] IPluginListingsPathProvider pluginPath, [Frozen] IDataDirectoryProvider dataDir, [Frozen] ICreationClubListingsPathProvider cccPath) { var implicitKeys = implicitListingsProvider.Listings.ToArray(); foreach (var implicitListing in implicitKeys) { fs.File.WriteAllText(Path.Combine(dataDir.Path, implicitListing.FileName), string.Empty); } fs.File.WriteAllText(Path.Combine(dataDir.Path, TestConstants.LightMasterModKey.FileName), string.Empty); fs.File.WriteAllText(Path.Combine(dataDir.Path, TestConstants.LightMasterModKey2.FileName), string.Empty); fs.File.WriteAllLines(pluginPath.Path, new string[] { $"*{TestConstants.MasterModKey}", $"*{TestConstants.PluginModKey}", }); fs.File.WriteAllLines(cccPath.Path, new string[] { TestConstants.LightMasterModKey.ToString(), TestConstants.LightMasterModKey2.ToString(), }); var live = LoadOrder.GetLiveLoadOrder( GameRelease.SkyrimSE, pluginPath.Path, dataDir.Path, out var state, scheduler: scheduler, cccLoadOrderFilePath: cccPath.Path, fileSystem: fs, timings: timings); var list = live.AsObservableList(); list.Items.Select(x => x.ModKey).Should().Equal( implicitKeys.Concat( new ModKey[] { TestConstants.LightMasterModKey, TestConstants.LightMasterModKey2, TestConstants.MasterModKey, TestConstants.PluginModKey, })); fs.File.WriteAllLines(pluginPath.Path, new string[] { $"*{TestConstants.MasterModKey}", $"*{TestConstants.PluginModKey}", $"{TestConstants.LightMasterModKey}", }); watcher.MarkChanged(pluginPath.Path); list.Items.Select(x => x.ModKey).Should().Equal( implicitKeys.Concat( new ModKey[] { TestConstants.LightMasterModKey2, TestConstants.LightMasterModKey, TestConstants.MasterModKey, TestConstants.PluginModKey, })); fs.File.WriteAllLines(pluginPath.Path, new string[] { $"*{TestConstants.MasterModKey}", $"*{TestConstants.PluginModKey}", $"{TestConstants.LightMasterModKey}", $"{TestConstants.LightMasterModKey2}", }); watcher.MarkChanged(pluginPath.Path); list.Items.Select(x => x.ModKey).Should().Equal( implicitKeys.Concat( new ModKey[] { TestConstants.LightMasterModKey, TestConstants.LightMasterModKey2, TestConstants.MasterModKey, TestConstants.PluginModKey, })); }