diff --git a/POEApi.Infrastructure/Extensions.cs b/POEApi.Infrastructure/Extensions.cs index b44c2da2..090e01c6 100644 --- a/POEApi.Infrastructure/Extensions.cs +++ b/POEApi.Infrastructure/Extensions.cs @@ -15,7 +15,7 @@ public static string GetHash(this string input) StringBuilder sb = new StringBuilder(); foreach (var item in MD5.Create().ComputeHash(Encoding.ASCII.GetBytes(input))) - sb.Append(item.ToString("x2").ToLower()); + sb.Append(item.ToString("x2").ToLowerInvariant()); return sb.ToString(); } diff --git a/POEApi.Model/ItemFactory.cs b/POEApi.Model/ItemFactory.cs index 5caf7a24..3b575790 100644 --- a/POEApi.Model/ItemFactory.cs +++ b/POEApi.Model/ItemFactory.cs @@ -22,7 +22,7 @@ public static Item Get(JSONProxy.Item item) if (item.FrameType == 4) return new Gem(item); - if (item.DescrText != null && item.DescrText.ToLower() == "right click this item then left click a location on the ground to create the object.") + if (item.DescrText != null && item.DescrText.ToLowerInvariant() == "right click this item then left click a location on the ground to create the object.") return new Decoration(item); if (item.DescrText != null && string.Equals(item.DescrText, @@ -86,7 +86,7 @@ public static Item Get(JSONProxy.Item item) private static Item GetCurrency(JSONProxy.Item item) { - var typeline = item.TypeLine.ToLower(); + var typeline = item.TypeLine.ToLowerInvariant(); if (typeline.Contains("essence") || typeline.Contains("remnant of")) return new Essence(item); diff --git a/POEApi.Transport/HttpTransport.cs b/POEApi.Transport/HttpTransport.cs index e3be693f..b535926f 100644 --- a/POEApi.Transport/HttpTransport.cs +++ b/POEApi.Transport/HttpTransport.cs @@ -338,7 +338,7 @@ private string ValidateAndGetHash(string url, string threadTitle, string hashReg var title = Regex.Match(html, TitleRegex).Groups["Title"].Value; - if (!title.ToLower().Contains(threadTitle.ToLower())) + if (!title.ToLowerInvariant().Contains(threadTitle.ToLowerInvariant())) throw new ForumThreadException(); return Regex.Match(html, hashRegex).Groups["hash"].Value; diff --git a/Procurement/Controls/Inventory.xaml.cs b/Procurement/Controls/Inventory.xaml.cs index ebe9fea8..acdd7d2a 100644 --- a/Procurement/Controls/Inventory.xaml.cs +++ b/Procurement/Controls/Inventory.xaml.cs @@ -139,7 +139,7 @@ private bool search(Item item) if (string.IsNullOrEmpty(Filter)) return false; - return item.TypeLine.ToLower().Contains(Filter.ToLower()) || item.Name.ToLower().Contains(Filter.ToLower()); + return item.TypeLine.ToLowerInvariant().Contains(Filter.ToLowerInvariant()) || item.Name.ToLowerInvariant().Contains(Filter.ToLowerInvariant()); } } } diff --git a/Procurement/View/StashView.xaml.cs b/Procurement/View/StashView.xaml.cs index c7417442..d54830fe 100644 --- a/Procurement/View/StashView.xaml.cs +++ b/Procurement/View/StashView.xaml.cs @@ -47,7 +47,7 @@ private void AdvancedSearchFilter_KeyUp(object sender, System.Windows.Input.KeyE foreach (AdvancedSearchCategory category in AdvancedSearchItemControl.ItemsSource) { - if (category.Key.ToLower().Contains(cb.Text.ToLower())) + if (category.Key.ToLowerInvariant().Contains(cb.Text.ToLowerInvariant())) { category.IsVisible = true; } diff --git a/Procurement/ViewModel/Filters/ForumExport/BuyoutFilter.cs b/Procurement/ViewModel/Filters/ForumExport/BuyoutFilter.cs index 7d6a6849..a55e50fe 100644 --- a/Procurement/ViewModel/Filters/ForumExport/BuyoutFilter.cs +++ b/Procurement/ViewModel/Filters/ForumExport/BuyoutFilter.cs @@ -43,8 +43,8 @@ public bool Applicable(Item item) { var itemInfo = Settings.Buyouts[item.Id]; - isItemBuyout = itemInfo.Buyout.ToLower() == buyoutValue.ToLower(); - isItemPriced = itemInfo.Price.ToLower() == buyoutValue.ToLower(); + isItemBuyout = itemInfo.Buyout.ToLowerInvariant() == buyoutValue.ToLowerInvariant(); + isItemPriced = itemInfo.Price.ToLowerInvariant() == buyoutValue.ToLowerInvariant(); } isTabBuyout = Settings.TabsBuyouts.ContainsKey(ApplicationState.Stash[ApplicationState.CurrentLeague].GetTabNameByInventoryId(item.InventoryId)); diff --git a/Procurement/ViewModel/Filters/ForumExport/EssenceFilter.cs b/Procurement/ViewModel/Filters/ForumExport/EssenceFilter.cs index 83e033cd..eca0e353 100644 --- a/Procurement/ViewModel/Filters/ForumExport/EssenceFilter.cs +++ b/Procurement/ViewModel/Filters/ForumExport/EssenceFilter.cs @@ -38,7 +38,7 @@ public FilterGroup Group public bool Applicable(Item item) { - var loweredTypeLine = item.TypeLine.ToLower(); + var loweredTypeLine = item.TypeLine.ToLowerInvariant(); return loweredTypeLine.Contains("essence") || loweredTypeLine.Contains("remnant of"); } } diff --git a/Procurement/ViewModel/Filters/ForumExport/GemCategoryFilter.cs b/Procurement/ViewModel/Filters/ForumExport/GemCategoryFilter.cs index 7f702738..611b437a 100644 --- a/Procurement/ViewModel/Filters/ForumExport/GemCategoryFilter.cs +++ b/Procurement/ViewModel/Filters/ForumExport/GemCategoryFilter.cs @@ -44,7 +44,7 @@ public bool Applicable(POEApi.Model.Item item) try { - return gem.Properties[0].Name.ToLower().Contains(filter.ToLower()); + return gem.Properties[0].Name.ToLowerInvariant().Contains(filter.ToLowerInvariant()); } catch (Exception) { diff --git a/Procurement/ViewModel/Filters/ForumExport/LeagestoneFilter.cs b/Procurement/ViewModel/Filters/ForumExport/LeagestoneFilter.cs index 2f8d5377..cce03461 100644 --- a/Procurement/ViewModel/Filters/ForumExport/LeagestoneFilter.cs +++ b/Procurement/ViewModel/Filters/ForumExport/LeagestoneFilter.cs @@ -14,7 +14,7 @@ public class LeagestoneFilter : IFilter public bool Applicable(Item item) { - return item.TypeLine.ToLower().Contains("leaguestone"); + return item.TypeLine.ToLowerInvariant().Contains("leaguestone"); } } } \ No newline at end of file diff --git a/Procurement/ViewModel/Filters/UserSearchFilter.cs b/Procurement/ViewModel/Filters/UserSearchFilter.cs index e4af0fc0..c8da1e31 100644 --- a/Procurement/ViewModel/Filters/UserSearchFilter.cs +++ b/Procurement/ViewModel/Filters/UserSearchFilter.cs @@ -35,7 +35,7 @@ public bool Applicable(Item item) if (string.IsNullOrEmpty(filter)) return false; - if (item.TypeLine.ToLower().Contains(filter.ToLower()) || item.Name.ToLower().Contains(filter.ToLower()) || containsMatchedCosmeticMod(item) || isMatchedGear(item)) + if (item.TypeLine.ToLowerInvariant().Contains(filter.ToLowerInvariant()) || item.Name.ToLowerInvariant().Contains(filter.ToLowerInvariant()) || containsMatchedCosmeticMod(item) || isMatchedGear(item)) return true; var gear = item as Gear; @@ -48,7 +48,7 @@ public bool Applicable(Item item) private bool containsMatchedCosmeticMod(Item item) { - return item.Microtransactions.Any(x => x.ToLower().Contains(filter.ToLower())); + return item.Microtransactions.Any(x => x.ToLowerInvariant().Contains(filter.ToLowerInvariant())); } private bool isMatchedGear(Item item) @@ -58,7 +58,7 @@ private bool isMatchedGear(Item item) if (gear == null) return false; - return gear.GearType.ToString().ToLower().Contains(filter.ToLower()); + return gear.GearType.ToString().ToLowerInvariant().Contains(filter.ToLowerInvariant()); } } } diff --git a/Procurement/ViewModel/ForumExportVisitors/SingleBuyoutVisitor.cs b/Procurement/ViewModel/ForumExportVisitors/SingleBuyoutVisitor.cs index 78ba9b45..a388c742 100644 --- a/Procurement/ViewModel/ForumExportVisitors/SingleBuyoutVisitor.cs +++ b/Procurement/ViewModel/ForumExportVisitors/SingleBuyoutVisitor.cs @@ -13,7 +13,7 @@ internal class SingleBuyoutVisitor : VisitorBase public SingleBuyoutVisitor() { tokens = Settings.Buyouts.Keys.GroupBy(k => Settings.Buyouts[k].Buyout) - .ToDictionary(g => string.Concat("{", g.Key.ToLower(), "}"), g => (IFilter)new BuyoutFilter(g.Key.ToLower())); + .ToDictionary(g => string.Concat("{", g.Key.ToLowerInvariant(), "}"), g => (IFilter)new BuyoutFilter(g.Key.ToLowerInvariant())); } public override string Visit(IEnumerable items, string current) { diff --git a/Procurement/ViewModel/ForumExportVisitors/VisitorBase.cs b/Procurement/ViewModel/ForumExportVisitors/VisitorBase.cs index 6a4b9912..b5045f42 100644 --- a/Procurement/ViewModel/ForumExportVisitors/VisitorBase.cs +++ b/Procurement/ViewModel/ForumExportVisitors/VisitorBase.cs @@ -11,17 +11,17 @@ internal abstract class VisitorBase : IVisitor { protected virtual bool buyoutItemsOnlyVisibleInBuyoutsTag { - get { return Settings.UserSettings.GetEntry("BuyoutItemsOnlyVisibleInBuyoutsTag").ToLower() == "true"; } + get { return Settings.UserSettings.GetEntry("BuyoutItemsOnlyVisibleInBuyoutsTag").ToLowerInvariant() == "true"; } } protected virtual bool embedBuyouts { - get { return Settings.UserSettings.GetEntry("EmbedBuyouts").ToLower() == "true"; } + get { return Settings.UserSettings.GetEntry("EmbedBuyouts").ToLowerInvariant() == "true"; } } protected virtual bool onlyDisplayBuyouts { - get { return Settings.UserSettings.GetEntry("OnlyDisplayBuyouts").ToLower() == "true"; } + get { return Settings.UserSettings.GetEntry("OnlyDisplayBuyouts").ToLowerInvariant() == "true"; } } public abstract string Visit(IEnumerable items, string current); diff --git a/Procurement/ViewModel/TabViewModel/StashViewModel.cs b/Procurement/ViewModel/TabViewModel/StashViewModel.cs index d93e60db..788315f8 100644 --- a/Procurement/ViewModel/TabViewModel/StashViewModel.cs +++ b/Procurement/ViewModel/TabViewModel/StashViewModel.cs @@ -174,7 +174,7 @@ public StashViewModel(StashView stashView) configuredOrbType = OrbType.Chaos; string currencyDistributionMetric = Settings.UserSettings["CurrencyDistributionMetric"]; - if (currencyDistributionMetric.ToLower() == "count") + if (currencyDistributionMetric.ToLowerInvariant() == "count") currencyDistributionUsesCount = true; else configuredOrbType = (OrbType)Enum.Parse(typeof(OrbType), currencyDistributionMetric);