Skip to content

Commit

Permalink
Use ToLowerInvariant instead of ToLower (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
Meivyn authored May 18, 2021
1 parent 95d74b9 commit f0210e3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions ModAssistant/Pages/Mods.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public void GetBSIPAVersion()
string InjectorHash = Utils.CalculateMD5(InjectorPath);
foreach (Mod mod in AllModsList)
{
if (mod.name.ToLower() == "bsipa")
if (mod.name.ToLowerInvariant() == "bsipa")
{
foreach (Mod.DownloadLink download in mod.downloads)
{
Expand Down Expand Up @@ -243,7 +243,7 @@ private Mod GetModFromHash(string hash)
{
foreach (Mod mod in AllModsList)
{
if (mod.name.ToLower() != "bsipa" && mod.status != "declined")
if (mod.name.ToLowerInvariant() != "bsipa" && mod.status != "declined")
{
foreach (Mod.DownloadLink download in mod.downloads)
{
Expand Down Expand Up @@ -351,7 +351,7 @@ public async void InstallMods()
// Ignore mods that are on current version if we aren't reinstalling mods
if (mod.ListItem.GetVersionComparison == 0 && !App.ReinstallInstalledMods) continue;

if (mod.name.ToLower() == "bsipa")
if (mod.name.ToLowerInvariant() == "bsipa")
{
MainWindow.Instance.MainText = $"{string.Format((string)FindResource("Mods:InstallingMod"), mod.name)}...";
await Task.Run(async () => await InstallMod(mod, installDirectory));
Expand Down Expand Up @@ -397,7 +397,7 @@ private async Task InstallMod(Mod mod, string directory)
downloadLink = link.url;
break;
}
else if (link.type.ToLower() == App.BeatSaberInstallType.ToLower())
else if (link.type.ToLowerInvariant() == App.BeatSaberInstallType.ToLowerInvariant())
{
downloadLink = link.url;
break;
Expand Down Expand Up @@ -746,13 +746,13 @@ public void UninstallMod(Mod mod)
Mod.DownloadLink links = null;
foreach (Mod.DownloadLink link in mod.downloads)
{
if (link.type.ToLower() == "universal" || link.type.ToLower() == App.BeatSaberInstallType.ToLower())
if (link.type.ToLowerInvariant() == "universal" || link.type.ToLowerInvariant() == App.BeatSaberInstallType.ToLowerInvariant())
{
links = link;
break;
}
}
if (mod.name.ToLower() == "bsipa")
if (mod.name.ToLowerInvariant() == "bsipa")
{
var hasIPAExe = File.Exists(Path.Combine(App.BeatSaberInstallDirectory, "IPA.exe"));
var hasIPADir = Directory.Exists(Path.Combine(App.BeatSaberInstallDirectory, "IPA"));
Expand Down Expand Up @@ -833,10 +833,10 @@ private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
private bool SearchFilter(object mod)
{
ModListItem item = mod as ModListItem;
if (item.ModName.ToLower().Contains(SearchBar.Text.ToLower())) return true;
if (item.ModDescription.ToLower().Contains(SearchBar.Text.ToLower())) return true;
if (item.ModName.ToLower().Replace(" ", string.Empty).Contains(SearchBar.Text.ToLower().Replace(" ", string.Empty))) return true;
if (item.ModDescription.ToLower().Replace(" ", string.Empty).Contains(SearchBar.Text.ToLower().Replace(" ", string.Empty))) return true;
if (item.ModName.ToLowerInvariant().Contains(SearchBar.Text.ToLowerInvariant())) return true;
if (item.ModDescription.ToLowerInvariant().Contains(SearchBar.Text.ToLowerInvariant())) return true;
if (item.ModName.ToLowerInvariant().Replace(" ", string.Empty).Contains(SearchBar.Text.ToLowerInvariant().Replace(" ", string.Empty))) return true;
if (item.ModDescription.ToLowerInvariant().Replace(" ", string.Empty).Contains(SearchBar.Text.ToLowerInvariant().Replace(" ", string.Empty))) return true;
return false;
}

Expand Down

0 comments on commit f0210e3

Please sign in to comment.