Replace F extension with string interpolation

This commit is contained in:
teinarss
2021-04-24 17:46:24 +02:00
committed by reaperrr
parent 1385aca783
commit 10676be377
300 changed files with 752 additions and 799 deletions

View File

@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits
var weaponToLower = DemolishWeapon.ToLowerInvariant();
if (!rules.Weapons.TryGetValue(weaponToLower, out var weapon))
throw new YamlException("Weapons Ruleset does not contain an entry '{0}'".F(weaponToLower));
throw new YamlException($"Weapons Ruleset does not contain an entry '{weaponToLower}'");
DemolishWeaponInfo = weapon;
}

View File

@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Traits
{
var fp = footprintYaml.Value.Value;
var dims = dim.X + "x" + dim.Y;
throw new YamlException("Invalid footprint: {0} does not match dimensions {1}".F(fp, dims));
throw new YamlException($"Invalid footprint: {fp} does not match dimensions {dims}");
}
var index = 0;
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits
{
var c = footprintChars[index++];
if (!Enum.IsDefined(typeof(FootprintCellType), (FootprintCellType)c))
throw new YamlException("Invalid footprint cell type '{0}'".F(c));
throw new YamlException($"Invalid footprint cell type '{c}'");
ret[new CVec(x, y)] = (FootprintCellType)c;
}

View File

@@ -65,9 +65,9 @@ namespace OpenRA.Mods.Common.Traits
topLeftScreenOffset = -wr.ScreenPxOffset(centerOffset);
var tileset = world.Map.Tileset.ToLowerInvariant();
if (world.Map.Rules.Sequences.HasSequence("overlay", "build-valid-{0}".F(tileset)))
if (world.Map.Rules.Sequences.HasSequence("overlay", $"build-valid-{tileset}"))
{
var validSequence = world.Map.Rules.Sequences.GetSequence("overlay", "build-valid-{0}".F(tileset));
var validSequence = world.Map.Rules.Sequences.GetSequence("overlay", $"build-valid-{tileset}");
validTile = validSequence.GetSprite(0);
validAlpha = validSequence.GetAlpha(0);
}

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
{
var weaponToLower = (DemolishWeapon ?? string.Empty).ToLowerInvariant();
if (!rules.Weapons.TryGetValue(weaponToLower, out var weapon))
throw new YamlException("Weapons Ruleset does not contain an entry '{0}'".F(weaponToLower));
throw new YamlException($"Weapons Ruleset does not contain an entry '{weaponToLower}'");
DemolishWeaponInfo = weapon;
}

View File

@@ -61,8 +61,7 @@ namespace OpenRA.Mods.Common.Traits
{
if (Game.IsCurrentWorld(self.World))
throw new InvalidOperationException(
"Attempted to finalize an undisposed DisposableAction. {0} ({1}) reserved {2} ({3})".F(
forActor.Info.Name, forActor.ActorID, self.Info.Name, self.ActorID));
$"Attempted to finalize an undisposed DisposableAction. {forActor.Info.Name} ({forActor.ActorID}) reserved {self.Info.Name} ({self.ActorID})");
}));
}

View File

@@ -56,9 +56,9 @@ namespace OpenRA.Mods.Common.Traits
var locomotorInfos = rules.Actors[SystemActors.World].TraitInfos<LocomotorInfo>();
LocomotorInfo = locomotorInfos.FirstOrDefault(li => li.Name == Locomotor);
if (LocomotorInfo == null)
throw new YamlException("A locomotor named '{0}' doesn't exist.".F(Locomotor));
throw new YamlException($"A locomotor named '{Locomotor}' doesn't exist.");
else if (locomotorInfos.Count(li => li.Name == Locomotor) > 1)
throw new YamlException("There is more than one locomotor named '{0}'.".F(Locomotor));
throw new YamlException($"There is more than one locomotor named '{Locomotor}'.");
base.RulesetLoaded(rules, ai);
}