Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ToLowerInvariant instead of ToLower #346

Merged
merged 1 commit into from
May 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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