Skip to content

Commit

Permalink
Added: No Universal Mods Tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Nov 27, 2022
1 parent d553e02 commit dd78503
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public class ConfigureModsViewModel : ObservableObject, IDisposable
/// </summary>
public const string NoCodeInjectionTag = "No Code Injection";

/// <summary>
/// Special tag that excludes universal mods.
/// </summary>
public const string NoUniversalModsTag = "No Universal Mods";

/// <summary>
/// All mods available for the game.
/// </summary>
Expand Down Expand Up @@ -160,13 +165,17 @@ private HashSet<string> GetTags(PathTuple<ModConfig>[] modsForThisApp)

foreach (var mod in modsForThisApp)
{
foreach (var tag in mod.Config.Tags)
tags.Add(tag);

// Auto-tags
if (mod.Config.HasDllPath())
tags.Add(CodeInjectionTag);
else
tags.Add(NoCodeInjectionTag);

foreach (var tag in mod.Config.Tags)
tags.Add(tag);
if (mod.Config.IsUniversalMod)
tags.Add(NoUniversalModsTag);
}
return tags;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,19 @@ private void ModsViewSourceOnFilter(object sender, FilterEventArgs e)
// Try auto tags
bool hasCodeInjection = config.HasDllPath();
if (hasCodeInjection && ViewModel.SelectedTag == ConfigureModsViewModel.CodeInjectionTag)
{
e.Accepted = true;
return;
}
else if (!hasCodeInjection && ViewModel.SelectedTag == ConfigureModsViewModel.NoCodeInjectionTag)
{
e.Accepted = true;
return;
}

// Auto tag: Universal mod
if (ViewModel.SelectedTag == ConfigureModsViewModel.NoUniversalModsTag)
e.Accepted = !config.IsUniversalMod;
}
}

Expand Down

0 comments on commit dd78503

Please sign in to comment.