Fix CA1304
This commit is contained in:
committed by
Matthias Mailänder
parent
949ba589c0
commit
486a07602b
@@ -664,6 +664,9 @@ dotnet_diagnostic.CA1200.severity = warning
|
|||||||
### Globalization Rules
|
### Globalization Rules
|
||||||
### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/globalization-warnings
|
### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/globalization-warnings
|
||||||
|
|
||||||
|
# Specify 'CultureInfo'.
|
||||||
|
dotnet_diagnostic.CA1304.severity = warning
|
||||||
|
|
||||||
### Portability and Interoperability Rules
|
### Portability and Interoperability Rules
|
||||||
### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/interoperability-warnings
|
### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/interoperability-warnings
|
||||||
|
|
||||||
|
|||||||
@@ -22,11 +22,6 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
public static class Exts
|
public static class Exts
|
||||||
{
|
{
|
||||||
public static bool IsUppercase(this string str)
|
|
||||||
{
|
|
||||||
return string.Compare(str.ToUpperInvariant(), str, false) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static T WithDefault<T>(T def, Func<T> f)
|
public static T WithDefault<T>(T def, Func<T> f)
|
||||||
{
|
{
|
||||||
try { return f(); }
|
try { return f(); }
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
|
|
||||||
if (isBuildable && isBuilding && canAttack)
|
if (isBuildable && isBuilding && canAttack)
|
||||||
{
|
{
|
||||||
var name = actor.Key.ToLower();
|
var name = actor.Key.ToLowerInvariant();
|
||||||
if (!defences.Contains(name))
|
if (!defences.Contains(name))
|
||||||
defences.Add(name);
|
defences.Add(name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,14 +93,14 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
|
|
||||||
if (isAircraft && isBuildable && canAttack && isKillable)
|
if (isAircraft && isBuildable && canAttack && isKillable)
|
||||||
{
|
{
|
||||||
var name = actor.Key.ToLower();
|
var name = actor.Key.ToLowerInvariant();
|
||||||
if (!aircraft.Contains(name))
|
if (!aircraft.Contains(name))
|
||||||
aircraft.Add(name);
|
aircraft.Add(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isBuildable && isKillable && (isVip || (isBuilding && !isExcluded)))
|
if (isBuildable && isKillable && (isVip || (isBuilding && !isExcluded)))
|
||||||
{
|
{
|
||||||
var name = actor.Key.ToLower();
|
var name = actor.Key.ToLowerInvariant();
|
||||||
if (!vips.Contains(name))
|
if (!vips.Contains(name))
|
||||||
vips.Add(name);
|
vips.Add(name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
var item = ScrollItemWidget.Setup(
|
var item = ScrollItemWidget.Setup(
|
||||||
tpl,
|
tpl,
|
||||||
() => string.Compare(filter.MapName, option, true) == 0,
|
() => string.Equals(filter.MapName, option, StringComparison.CurrentCultureIgnoreCase),
|
||||||
() => { filter.MapName = option; ApplyFilter(); });
|
() => { filter.MapName = option; ApplyFilter(); });
|
||||||
item.Get<LabelWidget>("LABEL").GetText = () => option ?? anyText;
|
item.Get<LabelWidget>("LABEL").GetText = () => option ?? anyText;
|
||||||
return item;
|
return item;
|
||||||
@@ -418,7 +418,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
var item = ScrollItemWidget.Setup(
|
var item = ScrollItemWidget.Setup(
|
||||||
tpl,
|
tpl,
|
||||||
() => string.Compare(filter.PlayerName, option, true) == 0,
|
() => string.Equals(filter.PlayerName, option, StringComparison.CurrentCultureIgnoreCase),
|
||||||
() => { filter.PlayerName = option; ApplyFilter(); });
|
() => { filter.PlayerName = option; ApplyFilter(); });
|
||||||
item.Get<LabelWidget>("LABEL").GetText = () => option ?? anyText;
|
item.Get<LabelWidget>("LABEL").GetText = () => option ?? anyText;
|
||||||
return item;
|
return item;
|
||||||
@@ -450,7 +450,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
var item = ScrollItemWidget.Setup(
|
var item = ScrollItemWidget.Setup(
|
||||||
tpl,
|
tpl,
|
||||||
() => string.Compare(filter.Faction, option, true) == 0,
|
() => string.Equals(filter.Faction, option, StringComparison.CurrentCultureIgnoreCase),
|
||||||
() => { filter.Faction = option; ApplyFilter(); });
|
() => { filter.Faction = option; ApplyFilter(); });
|
||||||
item.Get<LabelWidget>("LABEL").GetText = () => option ?? anyText;
|
item.Get<LabelWidget>("LABEL").GetText = () => option ?? anyText;
|
||||||
return item;
|
return item;
|
||||||
@@ -658,13 +658,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Map
|
// Map
|
||||||
if (!string.IsNullOrEmpty(filter.MapName) && string.Compare(filter.MapName, replay.GameInfo.MapTitle, true) != 0)
|
if (!string.IsNullOrEmpty(filter.MapName) &&
|
||||||
|
!string.Equals(filter.MapName, replay.GameInfo.MapTitle, StringComparison.CurrentCultureIgnoreCase))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Player
|
// Player
|
||||||
if (!string.IsNullOrEmpty(filter.PlayerName))
|
if (!string.IsNullOrEmpty(filter.PlayerName))
|
||||||
{
|
{
|
||||||
var player = replay.GameInfo.Players.FirstOrDefault(p => string.Compare(filter.PlayerName, p.Name, true) == 0);
|
var player = replay.GameInfo.Players.FirstOrDefault(
|
||||||
|
p => string.Equals(filter.PlayerName, p.Name, StringComparison.CurrentCultureIgnoreCase));
|
||||||
if (player == null)
|
if (player == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -673,7 +675,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Faction
|
// Faction
|
||||||
if (!string.IsNullOrEmpty(filter.Faction) && string.Compare(filter.Faction, player.FactionName, true) != 0)
|
if (!string.IsNullOrEmpty(filter.Faction) &&
|
||||||
|
!string.Equals(filter.Faction, player.FactionName, StringComparison.CurrentCultureIgnoreCase))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user