Fix IDE0028, IDE0300, IDE0301, IDE0302, IDE0303, IDE0304.

Silence IDE0305.
This commit is contained in:
RoosterDragon
2025-03-03 17:29:45 +00:00
committed by Pavel Penev
parent 0740991c12
commit 79454d8fd2
559 changed files with 1661 additions and 1751 deletions

View File

@@ -19,8 +19,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
{
public static bool Enabled = true;
static readonly char[] GlobChars = new char[] { '*', '?' };
static readonly char[] DirectorySeparators = new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar };
static readonly char[] GlobChars = ['*', '?'];
static readonly char[] DirectorySeparators = [Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar];
static bool NeedsExpansion(string filePath)
{

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
public ModData ModData;
public Map Map;
public List<string> Players = new();
public List<string> Players = [];
public MapPlayers MapPlayers;
bool singlePlayer;
int spawnCount;
@@ -137,7 +137,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
var worldNode = Map.RuleDefinitions.NodeWithKeyOrDefault("World");
var worldNodeBuilder = worldNode != null
? new MiniYamlNodeBuilder(worldNode)
: new MiniYamlNodeBuilder("World", new MiniYamlBuilder("", new List<MiniYamlNode>()));
: new MiniYamlNodeBuilder("World", new MiniYamlBuilder("", []));
return worldNodeBuilder;
}
@@ -173,7 +173,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
var missionData = worldNodeBuilder.Value.NodeWithKeyOrDefault("MissionData");
if (missionData == null)
{
missionData = new MiniYamlNodeBuilder("MissionData", new MiniYamlBuilder("", new List<MiniYamlNode>()));
missionData = new MiniYamlNodeBuilder("MissionData", new MiniYamlBuilder("", []));
worldNodeBuilder.Value.Nodes.Add(missionData);
}
@@ -244,7 +244,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
var missionData = worldNodeBuilder.Value.NodeWithKeyOrDefault("MissionData");
if (missionData == null)
{
missionData = new MiniYamlNodeBuilder("MissionData", new MiniYamlBuilder("", new List<MiniYamlNode>()));
missionData = new MiniYamlNodeBuilder("MissionData", new MiniYamlBuilder("", []));
worldNodeBuilder.Value.Nodes.Add(missionData);
}
@@ -347,14 +347,14 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
if (scorches.Count > 0)
{
var initialScorches = new MiniYamlNode("InitialSmudges", new MiniYaml("", scorches));
var smudgeLayer = new MiniYamlNodeBuilder("SmudgeLayer@SCORCH", new MiniYamlBuilder("", new List<MiniYamlNode>() { initialScorches }));
var smudgeLayer = new MiniYamlNodeBuilder("SmudgeLayer@SCORCH", new MiniYamlBuilder("", [initialScorches]));
worldNodeBuilder.Value.Nodes.Add(smudgeLayer);
}
if (craters.Count > 0)
{
var initialCraters = new MiniYamlNode("InitialSmudges", new MiniYaml("", craters));
var smudgeLayer = new MiniYamlNodeBuilder("SmudgeLayer@CRATER", new MiniYamlBuilder("", new List<MiniYamlNode>() { initialCraters }));
var smudgeLayer = new MiniYamlNodeBuilder("SmudgeLayer@CRATER", new MiniYamlBuilder("", [initialCraters]));
worldNodeBuilder.Value.Nodes.Add(smudgeLayer);
}

View File

@@ -356,13 +356,13 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
if (lightingNodes.Count > 0)
{
map.RuleDefinitions = map.RuleDefinitions.WithNodesAppended(new[]
{
new MiniYamlNode("^BaseWorld", new MiniYaml("", new[]
{
map.RuleDefinitions = map.RuleDefinitions.WithNodesAppended(
[
new MiniYamlNode("^BaseWorld", new MiniYaml("",
[
new MiniYamlNode("TerrainLighting", new MiniYaml("", lightingNodes))
}))
});
]))
]);
}
}
@@ -400,10 +400,10 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
if (lightingNodes.Count > 0)
{
nodes.Add(new MiniYamlNode(lamp, new MiniYaml("", new[]
{
nodes.Add(new MiniYamlNode(lamp, new MiniYaml("",
[
new MiniYamlNode("TerrainLightSource", new MiniYaml("", lightingNodes))
})));
])));
}
}

View File

@@ -39,13 +39,13 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
// Mapping from RA95 overlay index to type string
static readonly string[] RedAlertOverlayNames =
{
[
"sbag", "cycl", "brik", "barb", "wood",
"gold01", "gold02", "gold03", "gold04",
"gem01", "gem02", "gem03", "gem04",
"v12", "v13", "v14", "v15", "v16", "v17", "v18",
"fpls", "wcrate", "scrate", "fenc", "sbag",
};
];
static readonly Dictionary<string, (byte Type, byte Index)> OverlayResourceMapping = new()
{
@@ -77,8 +77,9 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
Map.Tiles[new CPos(i, j)] = new TerrainTile(types[i, j], ms.ReadUInt8());
}
static readonly string[] OverlayActors = new string[]
{
static readonly string[] OverlayActors =
[
// Fences
"sbag", "cycl", "brik", "barb", "wood", "fenc",
@@ -87,7 +88,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
// Crates
"wcrate", "scrate"
};
];
void UnpackOverlayData(MemoryStream ms)
{

View File

@@ -65,8 +65,9 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
}
}
static readonly string[] OverlayActors = new string[]
{
static readonly string[] OverlayActors =
[
// Fences
"sbag", "cycl", "brik", "barb", "wood",
@@ -75,7 +76,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
// Crates
"wcrate", "scrate"
};
];
void ReadOverlay(IniFile file)
{

View File

@@ -260,12 +260,12 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
};
protected override string[] LampActors { get; } =
{
[
"GALITE", "INGALITE", "NEGLAMP", "REDLAMP", "NEGRED", "GRENLAMP", "BLUELAMP", "YELWLAMP",
"INYELWLAMP", "PURPLAMP", "INPURPLAMP", "INORANLAMP", "INGRNLMP", "INREDLMP", "INBLULMP"
};
];
protected override string[] CreepActors { get; } = { "DOGGIE", "VISC_SML", "VISC_LRG", "JFISH" };
protected override string[] CreepActors { get; } = ["DOGGIE", "VISC_SML", "VISC_LRG", "JFISH"];
#endregion

View File

@@ -57,8 +57,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
remap[srcRemapIndex[i]] = destRemapIndex[i];
// map everything else to the best match based on channel-wise distance
var srcPalette = new ImmutablePalette(args[1].Split(':')[1], new[] { 0 }, shadowIndex);
var destPalette = new ImmutablePalette(args[2].Split(':')[1], new[] { 0 }, shadowIndex);
var srcPalette = new ImmutablePalette(args[1].Split(':')[1], [0], shadowIndex);
var destPalette = new ImmutablePalette(args[2].Split(':')[1], [0], shadowIndex);
for (var i = 0; i < Palette.Size; i++)
if (!remap.ContainsKey(i))