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

@@ -68,16 +68,14 @@ namespace OpenRA.Mods.Common.Lint
if (!dict.ContainsKey(v))
{
emitError("{0}.{1}.{2}: Missing actor `{3}`."
.F(actorInfo.Name, traitInfo.GetType().Name, fieldInfo.Name, value));
emitError($"{actorInfo.Name}.{traitInfo.GetType().Name}.{fieldInfo.Name}: Missing actor `{value}`.");
continue;
}
foreach (var requiredTrait in attribute.RequiredTraits)
if (!dict[v].TraitsInConstructOrder().Any(t => t.GetType() == requiredTrait || t.GetType().IsSubclassOf(requiredTrait)))
emitError("Actor type {0} does not have trait {1} which is required by {2}.{3}."
.F(value, requiredTrait.Name, traitInfo.GetType().Name, fieldInfo.Name));
emitError($"Actor type {value} does not have trait {requiredTrait.Name} which is required by {traitInfo.GetType().Name}.{fieldInfo.Name}.");
}
}
@@ -91,8 +89,7 @@ namespace OpenRA.Mods.Common.Lint
continue;
if (!dict.ContainsKey(value.ToLowerInvariant()))
emitError("{0}.{1}.{2}: Missing weapon `{3}`."
.F(actorInfo.Name, traitInfo.GetType().Name, fieldInfo.Name, value));
emitError($"{actorInfo.Name}.{traitInfo.GetType().Name}.{fieldInfo.Name}: Missing weapon `{value}`.");
}
}
@@ -106,8 +103,7 @@ namespace OpenRA.Mods.Common.Lint
continue;
if (!dict.ContainsKey(value.ToLowerInvariant()))
emitError("{0}.{1}.{2}: Missing voice `{3}`."
.F(actorInfo.Name, traitInfo.GetType().Name, fieldInfo.Name, value));
emitError($"{actorInfo.Name}.{traitInfo.GetType().Name}.{fieldInfo.Name}: Missing voice `{value}`.");
}
}
}

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Lint
var actorTypes = map.ActorDefinitions.Select(a => a.Value.Value);
foreach (var actor in actorTypes)
if (!map.Rules.Actors.Keys.Contains(actor.ToLowerInvariant()))
emitError("Actor {0} is not defined by any rule.".F(actor));
emitError($"Actor {actor} is not defined by any rule.");
}
}
}

View File

@@ -61,16 +61,16 @@ namespace OpenRA.Mods.Common.Lint
static void CheckLaunchAngles(string weaponInfo, int minAngle, bool testMaxAngle, int maxAngle, Action<string> emitError)
{
if (InvalidAngle(minAngle))
emitError("Weapon `{0}`: Projectile minimum LaunchAngle must not exceed (-)255!".F(weaponInfo));
emitError($"Weapon `{weaponInfo}`: Projectile minimum LaunchAngle must not exceed (-)255!");
if (testMaxAngle && InvalidAngle(maxAngle))
emitError("Weapon `{0}`: Projectile maximum LaunchAngle must not exceed (-)255!".F(weaponInfo));
emitError($"Weapon `{weaponInfo}`: Projectile maximum LaunchAngle must not exceed (-)255!");
if ((minAngle < 256) && (maxAngle < 256) && (minAngle > maxAngle))
emitError("Weapon `{0}`: Projectile minimum LaunchAngle must not exceed maximum LaunchAngle!".F(weaponInfo));
emitError($"Weapon `{weaponInfo}`: Projectile minimum LaunchAngle must not exceed maximum LaunchAngle!");
if ((minAngle > 768) && (maxAngle > 768) && (minAngle > maxAngle))
emitError("Weapon `{0}`: Projectile minimum LaunchAngle must not exceed maximum LaunchAngle!".F(weaponInfo));
emitError($"Weapon `{weaponInfo}`: Projectile minimum LaunchAngle must not exceed maximum LaunchAngle!");
if ((minAngle < 256) && (maxAngle > 768))
emitError("Weapon `{0}`: Projectile minimum LaunchAngle must not exceed maximum LaunchAngle!".F(weaponInfo));
emitError($"Weapon `{weaponInfo}`: Projectile minimum LaunchAngle must not exceed maximum LaunchAngle!");
}
}
}

View File

@@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Lint
{
// Keys are valid if they refer to a named key or can be parsed as a regular Hotkey.
if (!namedKeys.Contains(node.Value.Value) && !Hotkey.TryParse(node.Value.Value, out var unused))
emitError("{0} refers to a Key named `{1}` that does not exist".F(node.Location, node.Value.Value));
emitError($"{node.Location} refers to a Key named `{node.Value.Value}` that does not exist");
}
}
@@ -91,7 +91,7 @@ namespace OpenRA.Mods.Common.Lint
foreach (var name in keyNames)
if (!namedKeys.Contains(name) && !Hotkey.TryParse(name, out var unused))
emitError("{0} refers to a Key named `{1}` that does not exist".F(node.Location, name));
emitError($"{node.Location} refers to a Key named `{name}` that does not exist");
}
// Logic classes can declare the data key names that specify hotkeys
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Lint
foreach (var n in node.Value.Nodes)
if (checkArgKeys.Contains(n.Key))
if (!namedKeys.Contains(n.Value.Value) && !Hotkey.TryParse(n.Value.Value, out var unused))
emitError("{0} {1}:{2} refers to a Key named `{3}` that does not exist".F(filename, node.Value.Value, n.Key, n.Value.Value));
emitError($"{filename} {node.Value.Value}:{n.Key} refers to a Key named `{n.Value.Value}` that does not exist");
}
if (node.Value.Nodes != null)

View File

@@ -37,9 +37,9 @@ namespace OpenRA.Mods.Common.Lint
{
var type = Game.ModData.ObjectCreator.FindType(typeName);
if (type == null)
emitError("{0} refers to a logic object `{1}` that does not exist".F(filename, typeName));
emitError($"{filename} refers to a logic object `{typeName}` that does not exist");
else if (!typeof(ChromeLogic).IsAssignableFrom(type))
emitError("{0} refers to a logic object `{1}` that does not inherit from ChromeLogic".F(filename, typeName));
emitError($"{filename} refers to a logic object `{typeName}` that does not inherit from ChromeLogic");
}
}

View File

@@ -65,11 +65,11 @@ namespace OpenRA.Mods.Common.Lint
var unconsumed = granted.Except(consumed);
if (unconsumed.Any())
emitWarning("Actor type `{0}` grants conditions that are not consumed: {1}".F(actorInfo.Key, unconsumed.JoinWith(", ")));
emitWarning($"Actor type `{actorInfo.Key}` grants conditions that are not consumed: {unconsumed.JoinWith(", ")}");
var ungranted = consumed.Except(granted);
if (ungranted.Any())
emitError("Actor type `{0}` consumes conditions that are not granted: {1}".F(actorInfo.Key, ungranted.JoinWith(", ")));
emitError($"Actor type `{actorInfo.Key}` consumes conditions that are not granted: {ungranted.JoinWith(", ")}");
}
}
}

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Lint
var selectable = actorInfo.Value.TraitInfos<SelectableInfo>().Count();
var interactable = actorInfo.Value.TraitInfos<InteractableInfo>().Count();
if (selectable > 0 && selectable != interactable)
emitWarning("Actor {0} defines both Interactable and Selectable traits. This may cause unexpected results.".F(actorInfo.Value.Name));
emitWarning($"Actor {actorInfo.Value.Name} defines both Interactable and Selectable traits. This may cause unexpected results.");
}
}
}

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Lint
continue;
if (!cursors.Contains(cursor))
emitError("Undefined cursor {0} for actor {1} with trait {2}.".F(cursor, actorInfo.Value.Name, traitInfo));
emitError($"Undefined cursor {cursor} for actor {actorInfo.Value.Name} with trait {traitInfo}.");
}
}
}

View File

@@ -36,9 +36,9 @@ namespace OpenRA.Mods.Common.Lint
var count = actorInfo.Value.TraitInfos<IDefaultVisibilityInfo>().Count();
if (count == 0)
emitError("Actor type `{0}` does not define a default visibility type!".F(actorInfo.Key));
emitError($"Actor type `{actorInfo.Key}` does not define a default visibility type!");
else if (count > 1)
emitError("Actor type `{0}` defines multiple default visibility types!".F(actorInfo.Key));
emitError($"Actor type `{actorInfo.Key}` defines multiple default visibility types!");
else
{
var vis = actorInfo.Value.TraitInfoOrDefault<HiddenUnderShroudInfo>();
@@ -46,9 +46,9 @@ namespace OpenRA.Mods.Common.Lint
{
var ios = actorInfo.Value.TraitInfoOrDefault<IOccupySpaceInfo>();
if (ios == null)
emitError("Actor type `{0}` defines VisibilityType.Footprint in `{1}` but has no IOccupySpace traits!".F(actorInfo.Key, vis.GetType()));
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType()}` but has no IOccupySpace traits!");
else if (!ios.OccupiedCells(actorInfo.Value, CPos.Zero).Any())
emitError("Actor type `{0}` defines VisibilityType.Footprint in `{1}` but does not have any footprint cells!".F(actorInfo.Key, vis.GetType()));
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType()}` but does not have any footprint cells!");
}
}
}

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Lint
var hitShapes = actorInfo.Value.TraitInfos<HitShapeInfo>();
if (!hitShapes.Any())
emitError("Actor type `{0}` has a Health trait but no HitShape trait!".F(actorInfo.Key));
emitError($"Actor type `{actorInfo.Key}` has a Health trait but no HitShape trait!");
}
}
}

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Lint
foreach (var li in locomotorInfos)
foreach (var otherLocomotor in locomotorInfos)
if (li != otherLocomotor && li.Name == otherLocomotor.Name)
emitError("There is more than one Locomotor with name {0}!".F(li.Name));
emitError($"There is more than one Locomotor with name {li.Name}!");
foreach (var actorInfo in rules.Actors)
{
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Lint
void CheckLocomotors(ActorInfo actorInfo, Action<string> emitError, Ruleset rules, LocomotorInfo[] locomotorInfos, string locomotor)
{
if (!locomotorInfos.Any(l => l.Name == locomotor))
emitError("Actor {0} defines Locomotor {1} not found on World actor.".F(actorInfo.Name, locomotor));
emitError($"Actor {actorInfo.Name} defines Locomotor {locomotor} not found on World actor.");
}
}
}

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Lint
void Run(Action<string> emitError, int mapFormat, string author, string title, string[] categories)
{
if (mapFormat != Map.SupportedMapFormat)
emitError("Map format {0} does not match the supported version {1}.".F(mapFormat, Map.SupportedMapFormat));
emitError($"Map format {mapFormat} does not match the supported version {Map.SupportedMapFormat}.");
if (author == null)
emitError("Map does not define a valid author.");

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Lint
public void Run(Action<string> emitError, Action<string> emitWarning, ModData modData, Map map)
{
foreach (var kv in map.ReplacedInvalidTerrainTiles)
emitError("Cell {0} references invalid terrain tile {1}.".F(kv.Key, kv.Value));
emitError($"Cell {kv.Key} references invalid terrain tile {kv.Value}.");
}
}
}

View File

@@ -56,8 +56,7 @@ namespace OpenRA.Mods.Common.Lint
if (string.IsNullOrEmpty(type) || !rules.Notifications.TryGetValue(type.ToLowerInvariant(), out var soundInfo) ||
!soundInfo.Notifications.ContainsKey(notification))
emitError("Undefined notification reference {0}.{1} detected at {2} for {3}".F(
type ?? "(null)", notification, traitInfo.GetType().Name, actorInfo.Key));
emitError($"Undefined notification reference {type ?? "(null)"}.{notification} detected at {traitInfo.GetType().Name} for {actorInfo.Key}");
}
}
}

View File

@@ -35,16 +35,16 @@ namespace OpenRA.Mods.Common.Lint
var actorReference = new ActorReference(kv.Value.Value, kv.Value.ToDictionary());
var ownerInit = actorReference.GetOrDefault<OwnerInit>();
if (ownerInit == null)
emitError("Actor {0} is not owned by any player.".F(kv.Key));
emitError($"Actor {kv.Key} is not owned by any player.");
else
{
var ownerName = ownerInit.InternalName;
if (!playerNames.Contains(ownerName))
emitError("Actor {0} is owned by unknown player {1}.".F(kv.Key, ownerName));
emitError($"Actor {kv.Key} is owned by unknown player {ownerName}.");
if (actorsWithRequiredOwner.TryGetValue(kv.Value.Value, out var info))
if (!info.ValidOwnerNames.Contains(ownerName))
emitError("Actor {0} owner {1} is not one of ValidOwnerNames: {2}".F(kv.Key, ownerName, info.ValidOwnerNames.JoinWith(", ")));
emitError($"Actor {kv.Key} owner {ownerName} is not one of ValidOwnerNames: {info.ValidOwnerNames.JoinWith(", ")}");
}
}
}

View File

@@ -65,12 +65,12 @@ namespace OpenRA.Mods.Common.Lint
if (isPlayerPalette)
{
if (!playerPalettes.Contains(reference))
emitError("Undefined player palette reference {0} detected at {1} for {2}".F(reference, traitInfo, actorInfo.Key));
emitError($"Undefined player palette reference {reference} detected at {traitInfo} for {actorInfo.Key}");
}
else
{
if (!palettes.Contains(reference))
emitError("Undefined palette reference {0} detected at {1} for {2}".F(reference, traitInfo, actorInfo.Key));
emitError($"Undefined palette reference {reference} detected at {traitInfo} for {actorInfo.Key}");
}
}
}
@@ -109,12 +109,12 @@ namespace OpenRA.Mods.Common.Lint
if (isPlayerPalette)
{
if (!playerPalettes.Contains(reference))
emitError("Undefined player palette reference {0} detected at weapon {1}.".F(reference, weaponInfo.Key));
emitError($"Undefined player palette reference {reference} detected at weapon {weaponInfo.Key}.");
}
else
{
if (!palettes.Contains(reference))
emitError("Undefined palette reference {0} detected at weapon {1}.".F(reference, weaponInfo.Key));
emitError($"Undefined palette reference {reference} detected at weapon {weaponInfo.Key}.");
}
}
}

View File

@@ -49,25 +49,25 @@ namespace OpenRA.Mods.Common.Lint
{
foreach (var ally in player.Allies)
if (!playerNames.Contains(ally))
emitError("Allies contains player {0} that is not in list.".F(ally));
emitError($"Allies contains player {ally} that is not in list.");
foreach (var enemy in player.Enemies)
if (!playerNames.Contains(enemy))
emitError("Enemies contains player {0} that is not in list.".F(enemy));
emitError($"Enemies contains player {enemy} that is not in list.");
if (player.OwnsWorld)
{
worldOwnerFound = true;
if (player.Enemies.Any() || player.Allies.Any())
emitWarning("The player {0} owning the world should not have any allies or enemies.".F(player.Name));
emitWarning($"The player {player.Name} owning the world should not have any allies or enemies.");
if (player.Playable)
emitError("The player {0} owning the world can't be playable.".F(player.Name));
emitError($"The player {player.Name} owning the world can't be playable.");
}
else if (visibility == MapVisibility.MissionSelector && player.Playable && !player.LockFaction)
{
// Missions must lock the faction of the player to force the server to override the default Random faction
emitError("The player {0} must specify LockFaction: True.".F(player.Name));
emitError($"The player {player.Name} must specify LockFaction: True.");
}
}
@@ -77,13 +77,13 @@ namespace OpenRA.Mods.Common.Lint
var factions = worldActorInfo.TraitInfos<FactionInfo>().Select(f => f.InternalName).ToHashSet();
foreach (var player in players.Players.Values)
if (!string.IsNullOrWhiteSpace(player.Faction) && !factions.Contains(player.Faction))
emitError("Invalid faction {0} chosen for player {1}.".F(player.Faction, player.Name));
emitError($"Invalid faction {player.Faction} chosen for player {player.Name}.");
if (worldActorInfo.HasTraitInfo<MapStartingLocationsInfo>())
{
var playerCount = players.Players.Count(p => p.Value.Playable);
if (playerCount > spawnPoints.Length)
emitError("The map allows {0} possible players, but defines only {1} spawn points".F(playerCount, spawnPoints.Length));
emitError($"The map allows {playerCount} possible players, but defines only {spawnPoints.Length} spawn points");
if (spawnPoints.Distinct().Count() != spawnPoints.Length)
emitError("Duplicate spawn point locations detected.");

View File

@@ -34,8 +34,7 @@ namespace OpenRA.Mods.Common.Lint
var range = weaponInfo.Value.Range;
if (weaponInfo.Value.Projectile is MissileInfo missile && missile.RangeLimit > WDist.Zero && missile.RangeLimit < range)
emitError("Weapon `{0}`: projectile RangeLimit lower than weapon range!"
.F(weaponInfo.Key));
emitError($"Weapon `{weaponInfo.Key}`: projectile RangeLimit lower than weapon range!");
}
}
}

View File

@@ -40,9 +40,9 @@ namespace OpenRA.Mods.Common.Lint
continue;
if (ios == null)
emitError("Actor type `{0}` defines VisibilityType.Footprint in `{1}` but has no IOccupySpace traits!".F(actorInfo.Key, rsi.GetType()));
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{rsi.GetType()}` but has no IOccupySpace traits!");
else if (!ios.OccupiedCells(actorInfo.Value, CPos.Zero).Any())
emitError("Actor type `{0}` defines VisibilityType.Footprint in `{1}` but does not have any footprint cells!".F(actorInfo.Key, rsi.GetType()));
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{rsi.GetType()}` but does not have any footprint cells!");
}
}
}

View File

@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Lint
if (string.IsNullOrEmpty(imageOverride))
{
if (!sequenceReference.AllowNullImage)
emitError("Actor type `{0}` trait `{1}` must define a value for `{2}`".F(actorInfo.Value.Name, traitName, sequenceReference.ImageReference));
emitError($"Actor type `{actorInfo.Value.Name}` trait `{traitName}` must define a value for `{sequenceReference.ImageReference}`");
continue;
}
@@ -95,10 +95,10 @@ namespace OpenRA.Mods.Common.Lint
{
// TODO: Remove prefixed sequence references and instead use explicit lists of lintable references
if (!sequences.Sequences(i).Any(s => s.StartsWith(sequence)))
emitWarning("Actor type `{0}` trait `{1}` field `{2}` defines a prefix `{3}` that does not match any sequences on image `{4}`.".F(actorInfo.Value.Name, traitName, field.Name, sequence, i));
emitWarning($"Actor type `{actorInfo.Value.Name}` trait `{traitName}` field `{field.Name}` defines a prefix `{sequence}` that does not match any sequences on image `{i}`.");
}
else if (!sequences.HasSequence(i, sequence))
emitError("Actor type `{0}` trait `{1}` field `{2}` references an undefined sequence `{3}` on image `{4}`.".F(actorInfo.Value.Name, traitName, field.Name, sequence, i));
emitError($"Actor type `{actorInfo.Value.Name}` trait `{traitName}` field `{field.Name}` references an undefined sequence `{sequence}` on image `{i}`.");
}
}
}
@@ -123,7 +123,7 @@ namespace OpenRA.Mods.Common.Lint
if (string.IsNullOrEmpty(image))
{
if (!sequenceReference.AllowNullImage)
emitError("Weapon type `{0}` projectile field `{1}` must define a value".F(weaponInfo.Key, sequenceReference.ImageReference));
emitError($"Weapon type `{weaponInfo.Key}` projectile field `{sequenceReference.ImageReference}` must define a value");
continue;
}
@@ -138,10 +138,10 @@ namespace OpenRA.Mods.Common.Lint
{
// TODO: Remove prefixed sequence references and instead use explicit lists of lintable references
if (!sequences.Sequences(image).Any(s => s.StartsWith(sequence)))
emitWarning("Weapon type `{0}` projectile field `{1}` defines a prefix `{2}` that does not match any sequences on image `{3}`.".F(weaponInfo.Key, field.Name, sequence, image));
emitWarning($"Weapon type `{weaponInfo.Key}` projectile field `{field.Name}` defines a prefix `{sequence}` that does not match any sequences on image `{image}`.");
}
else if (!sequences.HasSequence(image, sequence))
emitError("Weapon type `{0}` projectile field `{1}` references an undefined sequence `{2}` on image `{3}`.".F(weaponInfo.Key, field.Name, sequence, image));
emitError($"Weapon type `{weaponInfo.Key}` projectile field `{field.Name}` references an undefined sequence `{sequence}` on image `{image}`.");
}
}
}

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Lint
var wsbs = actorInfo.Value.TraitInfos<WithSpriteBodyInfo>();
foreach (var wsb in wsbs)
if (wsbs.Any(w => w != wsb && w.Name == wsb.Name))
emitError("Actor type `{0}` has more than one *SpriteBody with Name: {1}!".F(actorInfo.Key, wsb.Name));
emitError($"Actor type `{actorInfo.Key}` has more than one *SpriteBody with Name: {wsb.Name}!");
}
}
}

View File

@@ -49,14 +49,14 @@ namespace OpenRA.Mods.Common.Lint
{
foreach (var type in types)
if (!TypeImplementsSync(type) && AnyTypeMemberIsSynced(type))
emitWarning("{0} has members with the Sync attribute but does not implement ISync".F(type.FullName));
emitWarning($"{type.FullName} has members with the Sync attribute but does not implement ISync");
}
static void CheckTypesImplementingSyncInterfaceHaveSyncableMembers(IEnumerable<Type> types, Action<string> emitWarning)
{
foreach (var type in types)
if (TypeImplementsSync(type) && !AnyTypeMemberIsSynced(type))
emitWarning("{0} implements ISync but does not use the Sync attribute on any members.".F(type.FullName));
emitWarning($"{type.FullName} implements ISync but does not use the Sync attribute on any members.");
}
}
}

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Lint
var traitName = traitInfo.GetType().Name;
traitName = traitName.Remove(traitName.Length - 4);
var locations = traitLocation.SystemActors.ToString().Replace(", ", " or ");
emitError("{0} does not belong on {1}. It is a system trait meant for {2}.".F(traitName, actorInfo.Key, locations));
emitError($"{traitName} does not belong on {actorInfo.Key}. It is a system trait meant for {locations}.");
}
}
}

View File

@@ -35,11 +35,11 @@ namespace OpenRA.Mods.Common.Lint
{
var hasTraits = actorInfo.Value.TraitsInConstructOrder().Any();
if (!hasTraits)
emitWarning("Actor {0} has no traits. Is this intended?".F(actorInfo.Key));
emitWarning($"Actor {actorInfo.Key} has no traits. Is this intended?");
}
catch (Exception e)
{
emitError("Actor {0} is not constructible; failure: {1}".F(actorInfo.Key, e.Message));
emitError($"Actor {actorInfo.Key} is not constructible; failure: {e.Message}");
}
}
}

View File

@@ -54,10 +54,10 @@ namespace OpenRA.Mods.Common.Lint
if (t.Key.StartsWith("-", StringComparison.Ordinal))
{
if (t.Value.Nodes.Any())
emitError("{0} {1} defines child nodes, which are not valid for removals.".F(t.Location, t.Key));
emitError($"{t.Location} {t.Key} defines child nodes, which are not valid for removals.");
if (!string.IsNullOrEmpty(t.Value.Value))
emitError("{0} {1} defines a value, which is not valid for removals.".F(t.Location, t.Key));
emitError($"{t.Location} {t.Key} defines a value, which is not valid for removals.");
continue;
}
@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Lint
// Inherits can never define children
if (traitName == "Inherits" && t.Value.Nodes.Any())
{
emitError("{0} defines child nodes, which are not valid for Inherits.".F(t.Location));
emitError($"{t.Location} defines child nodes, which are not valid for Inherits.");
continue;
}
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Lint
{
var fieldName = NormalizeName(field.Key);
if (traitInfo.GetField(fieldName) == null)
emitError("{0} refers to a trait field `{1}` that does not exist on `{2}`.".F(field.Location, fieldName, traitName));
emitError($"{field.Location} refers to a trait field `{fieldName}` that does not exist on `{traitName}`.");
}
}
}

View File

@@ -56,10 +56,10 @@ namespace OpenRA.Mods.Common.Lint
if (field.Key.StartsWith("-", StringComparison.Ordinal))
{
if (field.Value.Nodes.Any())
emitError("{0} {1} defines child nodes, which is not valid for removals.".F(field.Location, field.Key));
emitError($"{field.Location} {field.Key} defines child nodes, which is not valid for removals.");
if (!string.IsNullOrEmpty(field.Value.Value))
emitError("{0} {1} defines a value, which is not valid for removals.".F(field.Location, field.Key));
emitError($"{field.Location} {field.Key} defines a value, which is not valid for removals.");
continue;
}
@@ -73,14 +73,14 @@ namespace OpenRA.Mods.Common.Lint
{
var projectileFieldName = NormalizeName(projectileField.Key);
if (projectileInfo.GetField(projectileFieldName) == null)
emitError("{0} refers to a projectile field `{1}` that does not exist on `{2}`.".F(projectileField.Location, projectileFieldName, projectileName));
emitError($"{projectileField.Location} refers to a projectile field `{projectileFieldName}` that does not exist on `{projectileName}`.");
}
}
else if (fieldName == "Warhead")
{
if (string.IsNullOrEmpty(field.Value.Value))
{
emitWarning("{0} does not define a warhead type. Skipping unknown field check.".F(field.Location));
emitWarning($"{field.Location} does not define a warhead type. Skipping unknown field check.");
continue;
}
@@ -90,11 +90,11 @@ namespace OpenRA.Mods.Common.Lint
{
var warheadFieldName = NormalizeName(warheadField.Key);
if (warheadInfo.GetField(warheadFieldName) == null)
emitError("{0} refers to a warhead field `{1}` that does not exist on `{2}`.".F(warheadField.Location, warheadFieldName, warheadName));
emitError($"{warheadField.Location} refers to a warhead field `{warheadFieldName}` that does not exist on `{warheadName}`.");
}
}
else if (fieldName != "Inherits" && weaponInfo.GetField(fieldName) == null)
emitError("{0} refers to a weapon field `{1}` that does not exist.".F(field.Location, fieldName));
emitError($"{field.Location} refers to a weapon field `{fieldName}` that does not exist.");
}
}
}

View File

@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Lint
continue;
if (!soundInfo.Voices.Keys.Contains(voice))
emitError("Actor {0} using voice set {1} does not define {2} voice required by {3}.".F(actorInfo.Name, voiceSet, voice, traitInfo));
emitError($"Actor {actorInfo.Name} using voice set {voiceSet} does not define {voice} voice required by {traitInfo}.");
}
}
}

View File

@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Lint
foreach (var inherit in inherits)
{
if (inherit[0] != '^')
emitError("{0} definition inherits from {1}, which is not an abstract template.".F(actor, inherit));
emitError($"{actor} definition inherits from {inherit}, which is not an abstract template.");
toResolve.Enqueue(inherit);
}

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Lint
foreach (var prereq in bi.Prerequisites)
if (!prereq.StartsWith("~disabled"))
if (!providedPrereqs.Contains(prereq.Replace("!", "").Replace("~", "")))
emitError("Buildable actor {0} has prereq {1} not provided by anything.".F(i.Key, prereq));
emitError($"Buildable actor {i.Key} has prereq {prereq} not provided by anything.");
}
}
}

View File

@@ -63,8 +63,7 @@ namespace OpenRA.Mods.Common.Lint
"BooleanExpression", "IntegerExpression"
};
throw new InvalidOperationException("Bad type for reference on {0}.{1}. Supported types: {2}"
.F(ruleInfo.GetType().Name, fieldInfo.Name, supportedTypes.JoinWith(", ")));
throw new InvalidOperationException($"Bad type for reference on {ruleInfo.GetType().Name}.{fieldInfo.Name}. Supported types: {supportedTypes.JoinWith(", ")}");
}
public static IEnumerable<string> GetPropertyValues(object ruleInfo, PropertyInfo propertyInfo, Action<string> emitError,
@@ -109,8 +108,7 @@ namespace OpenRA.Mods.Common.Lint
"BooleanExpression", "IntegerExpression"
};
throw new InvalidOperationException("Bad type for reference on {0}.{1}. Supported types: {2}"
.F(ruleInfo.GetType().Name, propertyInfo.Name, supportedTypes.JoinWith(", ")));
throw new InvalidOperationException($"Bad type for reference on {ruleInfo.GetType().Name}.{propertyInfo.Name}. Supported types: {supportedTypes.JoinWith(", ")}");
}
}
}