public void HasMod_Enabled() { var listings = new LoadOrderListing[] { new LoadOrderListing(Utility.LightMasterModKey, true), new LoadOrderListing(Utility.LightMasterModKey2, false), new LoadOrderListing(Utility.LightMasterModKey3, true), }; listings .HasMod(Utility.LightMasterModKey, enabled: true) .Should().BeTrue(); listings .HasMod(Utility.LightMasterModKey, enabled: false) .Should().BeFalse(); listings .HasMod(Utility.LightMasterModKey2, enabled: false) .Should().BeTrue(); listings .HasMod(Utility.LightMasterModKey2, enabled: true) .Should().BeFalse(); listings .HasMod(Utility.LightMasterModKey3, enabled: true) .Should().BeTrue(); listings .HasMod(Utility.LightMasterModKey3, enabled: false) .Should().BeFalse(); }
public void HasMods_Enabled_Typical() { var listings = new LoadOrderListing[] { new LoadOrderListing(Utility.LightMasterModKey, true), new LoadOrderListing(Utility.LightMasterModKey2, false), new LoadOrderListing(Utility.LightMasterModKey3, true), }; listings .HasMods( true, Utility.LightMasterModKey, Utility.LightMasterModKey3) .Should().BeTrue(); listings .HasMods(false, Utility.LightMasterModKey2) .Should().BeTrue(); listings .HasMods( true, Utility.LightMasterModKey, Utility.LightMasterModKey2, Utility.LightMasterModKey3) .Should().BeFalse(); listings .HasMods( true, Utility.LightMasterModKey, Utility.LightMasterModKey2, Utility.LightMasterModKey4) .Should().BeFalse(); }
public void LoadOrderListingTests() { var listing1 = new LoadOrderListing(Utility.PluginModKey, enabled: true); var listing1Eq = new LoadOrderListing { ModKey = Utility.PluginModKey, Enabled = true, }; var listing1Disabled = new LoadOrderListing { ModKey = Utility.PluginModKey, Enabled = false, }; var listing2 = new LoadOrderListing(Utility.PluginModKey2, enabled: true); var listing2Eq = new LoadOrderListing() { ModKey = Utility.PluginModKey2, Enabled = true }; var listing2Disabled = new LoadOrderListing() { ModKey = Utility.PluginModKey2, Enabled = false }; listing1.Should().BeEquivalentTo(listing1Eq); listing1.Should().NotBeEquivalentTo(listing1Disabled); listing1.Should().NotBeEquivalentTo(listing2); listing2.Should().BeEquivalentTo(listing2Eq); listing2.Should().NotBeEquivalentTo(listing2Disabled); listing2.Should().NotBeEquivalentTo(listing1); }
public void EnabledMarkerProcessing() { var item = LoadOrderListing.FromString(Utility.PluginModKey.FileName, enabledMarkerProcessing: true); Assert.False(item.Enabled); Assert.Equal(Utility.PluginModKey, item.ModKey); item = LoadOrderListing.FromString($"*{Utility.PluginModKey.FileName}", enabledMarkerProcessing: true); Assert.True(item.Enabled); Assert.Equal(Utility.PluginModKey, item.ModKey); }
public LoadOrderEntryVM(LoadOrderListing listing, string dataFolder) { Listing = listing; var path = Path.Combine(dataFolder, listing.ModKey.FileName); var exists = File.Exists(path); _Exists = Observable.Defer(() => Noggog.ObservableExt.WatchFile(path) .Select(_ => { var ret = File.Exists(path); return(ret); })) .ToGuiProperty(this, nameof(Exists), initialValue: exists); }
public LoadOrderEntryVM(LoadOrderListing listing, string dataFolder) { Listing = listing; var path = Path.Combine(dataFolder, listing.ModKey.FileName); var exists = File.Exists(path); Log.Logger.Information($"Watching {path}, current exist check: {exists}"); _Exists = Observable.Defer(() => Noggog.ObservableExt.WatchFile(path) .Select(_ => { var ret = File.Exists(path); Log.Logger.Information($"{ret} file exists check for {path}"); return(ret); })) .ToGuiProperty(this, nameof(Exists), initialValue: exists); }
public static void AddImplicitMasters(RunSynthesisMutagenPatcher settings, ExtendedList <LoadOrderListing> loadOrderListing) { HashSet <ModKey> referencedMasters = new HashSet <ModKey>(); foreach (var item in loadOrderListing.OnlyEnabled()) { MasterReferenceReader reader = MasterReferenceReader.FromPath(Path.Combine(settings.DataFolderPath, item.ModKey.FileName), settings.GameRelease); referencedMasters.Add(reader.Masters.Select(m => m.Master)); } for (int i = 0; i < loadOrderListing.Count; i++) { var listing = loadOrderListing[i]; if (!listing.Enabled && referencedMasters.Contains(listing.ModKey)) { loadOrderListing[i] = new LoadOrderListing(listing.ModKey, enabled: true); } } }
public void HasMods_Single() { var listings = new LoadOrderListing[] { new LoadOrderListing(Utility.LightMasterModKey, true), new LoadOrderListing(Utility.LightMasterModKey2, false), new LoadOrderListing(Utility.LightMasterModKey3, true), }; listings .HasMods(Utility.LightMasterModKey) .Should().BeTrue(); listings .HasMods(Utility.LightMasterModKey2) .Should().BeTrue(); listings .HasMods(Utility.LightMasterModKey3) .Should().BeTrue(); listings .HasMods(Utility.LightMasterModKey4) .Should().BeFalse(); }