enable some string BannedApis

This commit is contained in:
goat 2024-07-11 00:20:00 +02:00
parent 577f17eb1b
commit 2cbb8b9e22
9 changed files with 20 additions and 20 deletions

View file

@ -73,9 +73,9 @@ public static class FontAwesomeHelpers
{ {
foreach (var icon in icons) foreach (var icon in icons)
{ {
var name = Enum.GetName(icon)?.ToLower(); var name = Enum.GetName(icon)?.ToLowerInvariant();
var searchTerms = icon.GetSearchTerms(); var searchTerms = icon.GetSearchTerms();
if (name!.Contains(search.ToLower()) || searchTerms.Contains(search.ToLower())) if (name!.Contains(search.ToLowerInvariant()) || searchTerms.Contains(search.ToLowerInvariant()))
{ {
result.Add(icon); result.Add(icon);
} }
@ -102,10 +102,10 @@ public static class FontAwesomeHelpers
// search by both terms and category // search by both terms and category
foreach (var icon in icons) foreach (var icon in icons)
{ {
var name = Enum.GetName(icon)?.ToLower(); var name = Enum.GetName(icon)?.ToLowerInvariant();
var searchTerms = icon.GetSearchTerms(); var searchTerms = icon.GetSearchTerms();
var categories = icon.GetCategories(); var categories = icon.GetCategories();
if ((name!.Contains(search.ToLower()) || searchTerms.Contains(search.ToLower())) && categories.Contains(category)) if ((name!.Contains(search.ToLowerInvariant()) || searchTerms.Contains(search.ToLowerInvariant())) && categories.Contains(category))
{ {
result.Add(icon); result.Add(icon);
} }

View file

@ -89,7 +89,7 @@ public partial class FileDialog
foreach (var file in this.files) foreach (var file in this.files)
{ {
var show = true; var show = true;
if (!string.IsNullOrEmpty(this.searchBuffer) && !file.FileName.ToLower().Contains(this.searchBuffer.ToLower())) if (!string.IsNullOrEmpty(this.searchBuffer) && !file.FileName.ToLowerInvariant().Contains(this.searchBuffer.ToLowerInvariant()))
{ {
show = false; show = false;
} }

View file

@ -132,7 +132,7 @@ public partial class FileDialog
AddToIconMap(new[] { "csv" }, FontAwesomeIcon.FileCsv, miscTextColor); AddToIconMap(new[] { "csv" }, FontAwesomeIcon.FileCsv, miscTextColor);
} }
return iconMap.TryGetValue(ext.ToLower(), out var icon) ? icon : new IconColorItem return iconMap.TryGetValue(ext.ToLowerInvariant(), out var icon) ? icon : new IconColorItem
{ {
Icon = FontAwesomeIcon.File, Icon = FontAwesomeIcon.File,
Color = standardTextColor, Color = standardTextColor,

View file

@ -350,10 +350,10 @@ internal class DalamudCommands : IServiceType
var configuration = Service<DalamudConfiguration>.Get(); var configuration = Service<DalamudConfiguration>.Get();
var localization = Service<Localization>.Get(); var localization = Service<Localization>.Get();
if (Localization.ApplicableLangCodes.Contains(arguments.ToLower()) || arguments.ToLower() == "en") if (Localization.ApplicableLangCodes.Contains(arguments.ToLowerInvariant()) || arguments.ToLowerInvariant() == "en")
{ {
localization.SetupWithLangCode(arguments.ToLower()); localization.SetupWithLangCode(arguments.ToLowerInvariant());
configuration.LanguageOverride = arguments.ToLower(); configuration.LanguageOverride = arguments.ToLowerInvariant();
chatGui.Print(string.Format(Loc.Localize("DalamudLanguageSetTo", "Language set to {0}"), arguments)); chatGui.Print(string.Format(Loc.Localize("DalamudLanguageSetTo", "Language set to {0}"), arguments));
} }

View file

@ -475,7 +475,7 @@ internal unsafe class UiDebug
var name = unitBase->NameString; var name = unitBase->NameString;
if (searching) if (searching)
{ {
if (name == null || !name.ToLower().Contains(searchStr.ToLower())) continue; if (name == null || !name.ToLowerInvariant().Contains(searchStr.ToLowerInvariant())) continue;
} }
noResults = false; noResults = false;

View file

@ -179,7 +179,7 @@ internal class SettingsWindow : Window
foreach (var settingsTab in this.tabs.Where(x => x.IsVisible)) foreach (var settingsTab in this.tabs.Where(x => x.IsVisible))
{ {
var eligible = settingsTab.Entries.Where(x => !x.Name.IsNullOrEmpty() && x.Name.ToLower().Contains(this.searchInput.ToLower())).ToArray(); var eligible = settingsTab.Entries.Where(x => !x.Name.IsNullOrEmpty() && x.Name.ToLowerInvariant().Contains(this.searchInput.ToLowerInvariant())).ToArray();
if (!eligible.Any()) if (!eligible.Any())
continue; continue;

View file

@ -138,7 +138,7 @@ public class Localization : IServiceType
/// <param name="langCode">The language code to set up the UI language with.</param> /// <param name="langCode">The language code to set up the UI language with.</param>
public void SetupWithLangCode(string langCode) public void SetupWithLangCode(string langCode)
{ {
if (langCode.ToLower() == FallbackLangCode) if (langCode.Equals(FallbackLangCode, StringComparison.InvariantCultureIgnoreCase))
{ {
this.SetupWithFallbacks(); this.SetupWithFallbacks();
return; return;

View file

@ -1,10 +1,10 @@
<!-- Code analysis settings for all Dalamud projects. --> <!-- Code analysis settings for all Dalamud projects. -->
<Project> <Project>
<!--
<ItemGroup Label="Code Analysis"> <ItemGroup Label="Code Analysis">
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4" PrivateAssets="All" /> <PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4" PrivateAssets="All" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)tools\BannedSymbols.txt" /> <AdditionalFiles Include="$(MSBuildThisFileDirectory)tools\BannedSymbols.txt" />
</ItemGroup> </ItemGroup>
<!--
<PropertyGroup Label="Code Analysis"> <PropertyGroup Label="Code Analysis">
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)tools\dalamud.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)tools\dalamud.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>

View file

@ -1,11 +1,11 @@
M:System.Object.Equals(System.Object,System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead. #M:System.Object.Equals(System.Object,System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
M:System.Object.Equals(System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead. #M:System.Object.Equals(System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
M:System.ValueType.Equals(System.Object)~System.Boolean;Don't use object.Equals(Fallbacks to ValueType). Use IEquatable<T> or EqualityComparer<T>.Default instead. #M:System.ValueType.Equals(System.Object)~System.Boolean;Don't use object.Equals(Fallbacks to ValueType). Use IEquatable<T> or EqualityComparer<T>.Default instead.
M:System.Nullable`1.Equals(System.Object)~System.Boolean;Use == instead. #M:System.Nullable`1.Equals(System.Object)~System.Boolean;Use == instead.
T:System.IComparable;Don't use non-generic IComparable. Use generic version instead. #T:System.IComparable;Don't use non-generic IComparable. Use generic version instead.
M:System.Guid.#ctor;Probably meaning to use Guid.NewGuid() instead. If actually wanting empty, use Guid.Empty. M:System.Guid.#ctor;Probably meaning to use Guid.NewGuid() instead. If actually wanting empty, use Guid.Empty.
M:System.Threading.Tasks.Task.Wait();Don't use Task.Wait. Use Task.WaitSafely() to ensure we avoid deadlocks. #M:System.Threading.Tasks.Task.Wait();Don't use Task.Wait. Use Task.WaitSafely() to ensure we avoid deadlocks.
P:System.Threading.Tasks.Task`1.Result;Don't use Task.Result. Use Task.GetResultSafely() to ensure we avoid deadlocks. #P:System.Threading.Tasks.Task`1.Result;Don't use Task.Result. Use Task.GetResultSafely() to ensure we avoid deadlocks.
M:System.Threading.ManualResetEventSlim.Wait();Specify a timeout to avoid waiting forever. M:System.Threading.ManualResetEventSlim.Wait();Specify a timeout to avoid waiting forever.
M:System.Char.ToLower(System.Char);char.ToLower() changes behaviour depending on CultureInfo.CurrentCulture. Use char.ToLowerInvariant() instead. If wanting culture-sensitive behaviour, explicitly provide CultureInfo.CurrentCulture. M:System.Char.ToLower(System.Char);char.ToLower() changes behaviour depending on CultureInfo.CurrentCulture. Use char.ToLowerInvariant() instead. If wanting culture-sensitive behaviour, explicitly provide CultureInfo.CurrentCulture.
M:System.Char.ToUpper(System.Char);char.ToUpper() changes behaviour depending on CultureInfo.CurrentCulture. Use char.ToUpperInvariant() instead. If wanting culture-sensitive behaviour, explicitly provide CultureInfo.CurrentCulture. M:System.Char.ToUpper(System.Char);char.ToUpper() changes behaviour depending on CultureInfo.CurrentCulture. Use char.ToUpperInvariant() instead. If wanting culture-sensitive behaviour, explicitly provide CultureInfo.CurrentCulture.