Fix IDE0057

This commit is contained in:
RoosterDragon
2023-04-05 19:12:33 +01:00
committed by Pavel Penev
parent 5254348819
commit 023d80b94d
42 changed files with 104 additions and 104 deletions

View File

@@ -359,7 +359,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
// Replace removals with masking
foreach (var node in sequenceNode.Value.Nodes)
if (node.Key?.StartsWith("-") ?? false)
node.Key = node.Key.Substring(1);
node.Key = node.Key[1..];
var combineNode = sequenceNode.LastChildMatching("Combine");
if (combineNode != null)
@@ -389,8 +389,8 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
var overrideFilename = filename;
if (useTilesetCode)
overrideFilename = filename.Substring(0, 1) + tilesetCodes[sequenceTileset] +
filename.Substring(2, filename.Length - 2);
overrideFilename = filename[..1] + tilesetCodes[sequenceTileset] +
filename[2..];
if (addExtension)
overrideFilename += useTilesetExtension ? tilesetExtensions[sequenceTileset] : defaultSpriteExtension;

View File

@@ -327,7 +327,7 @@ namespace OpenRA.Mods.Common.UpdateRules
var prefix = includeRemovals && node.IsRemoval() ? "-" : "";
var split = node.Key.IndexOf("@", StringComparison.Ordinal);
if (preserveSuffix && split > -1)
node.Key = prefix + newKey + node.Key.Substring(split);
node.Key = prefix + newKey + node.Key[split..];
else
node.Key = prefix + newKey;
}
@@ -391,7 +391,7 @@ namespace OpenRA.Mods.Common.UpdateRules
return false;
var atPosition = node.Key.IndexOf('@');
return atPosition > 0 && node.Key.Substring(0, atPosition) == prefix + match;
return atPosition > 0 && node.Key[..atPosition] == prefix + match;
}
/// <summary>Returns true if the node is of the form [match], [match]@[arbitrary suffix] or [arbitrary suffix]@[match].</summary>
@@ -401,7 +401,7 @@ namespace OpenRA.Mods.Common.UpdateRules
return false;
var atPosition = node.Key.IndexOf('@');
var relevantPart = ignoreSuffix && atPosition > 0 ? node.Key.Substring(0, atPosition) : node.Key;
var relevantPart = ignoreSuffix && atPosition > 0 ? node.Key[..atPosition] : node.Key;
if (relevantPart.Contains(match) && (includeRemovals || !node.IsRemoval()))
return true;