Fix IDE0090

This commit is contained in:
RoosterDragon
2023-04-05 19:34:12 +01:00
committed by Pavel Penev
parent 164abfdae1
commit 8a285f9b19
385 changed files with 790 additions and 794 deletions

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Cnc.FileFormats
public uint Len;
}
readonly PublicKey pubkey = new PublicKey();
readonly PublicKey pubkey = new();
readonly uint[] globOne = new uint[64];
uint globOneBitLen, globOneLenXTwo;

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Cnc.FileSystem
public string Name { get; }
public IEnumerable<string> Contents => index.Keys;
readonly Dictionary<string, Entry> index = new Dictionary<string, Entry>();
readonly Dictionary<string, Entry> index = new();
readonly Stream s;
public BigFile(Stream s, string filename)

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Cnc.FileSystem
{
readonly Stream s;
readonly Dictionary<string, (uint Offset, int Length)> contents = new Dictionary<string, (uint Offset, int Length)>();
readonly Dictionary<string, (uint Offset, int Length)> contents = new();
public MegFile(Stream s, string filename)
{

View File

@@ -105,7 +105,7 @@ namespace OpenRA.Mods.Cnc.FileSystem
}
}
static readonly Dictionary<uint, string> Names = new Dictionary<uint, string>();
static readonly Dictionary<uint, string> Names = new();
public static void AddStandardName(string s)
{

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.FileSystem
public string Name { get; }
public IEnumerable<string> Contents => index.Keys;
readonly Dictionary<string, Entry> index = new Dictionary<string, Entry>();
readonly Dictionary<string, Entry> index = new();
readonly Stream stream;
public PakFile(Stream stream, string filename)

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.Graphics
public class ClassicSpriteSequence : DefaultSpriteSequence
{
[Desc("Incorporate a compensation factor for the rotational distortion present in the first-generation Westwood games.")]
static readonly SpriteSequenceField<bool> UseClassicFacings = new SpriteSequenceField<bool>(nameof(UseClassicFacings), false);
static readonly SpriteSequenceField<bool> UseClassicFacings = new(nameof(UseClassicFacings), false);
readonly bool useClassicFacings;
public ClassicSpriteSequence(SpriteCache cache, ISpriteSequenceLoader loader, string image, string sequence, MiniYaml data, MiniYaml defaults)

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Graphics
public class ClassicTilesetSpecificSpriteSequence : ClassicSpriteSequence
{
[Desc("Dictionary of <tileset name>: filename to override the Filename key.")]
static readonly SpriteSequenceField<Dictionary<string, string>> TilesetFilenames = new SpriteSequenceField<Dictionary<string, string>>(nameof(TilesetFilenames), null);
static readonly SpriteSequenceField<Dictionary<string, string>> TilesetFilenames = new(nameof(TilesetFilenames), null);
public ClassicTilesetSpecificSpriteSequence(SpriteCache cache, ISpriteSequenceLoader loader, string image, string sequence, MiniYaml data, MiniYaml defaults)
: base(cache, loader, image, sequence, data, defaults) { }

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.Graphics
{
static readonly float[] ChannelSelect = { 0.75f, 0.25f, -0.25f, -0.75f };
readonly List<Vertex[]> vertices = new List<Vertex[]>();
readonly List<Vertex[]> vertices = new();
readonly Cache<(string, string), Voxel> voxels;
readonly IReadOnlyFileSystem fileSystem;
IVertexBuffer<Vertex> vertexBuffer;

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Cnc.Graphics
public class VoxelModelCache : IModelCache
{
readonly VoxelLoader loader;
readonly Dictionary<string, Dictionary<string, IModel>> models = new Dictionary<string, Dictionary<string, IModel>>();
readonly Dictionary<string, Dictionary<string, IModel>> models = new();
public VoxelModelCache(IReadOnlyFileSystem fileSystem)
{

View File

@@ -48,8 +48,8 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders
public class ShpRemasteredSprite
{
static readonly Regex FilenameRegex = new Regex(@"^(?<prefix>.+?[\-_])(?<frame>\d{4})\.tga$");
static readonly Regex MetaRegex = new Regex(@"^\{""size"":\[(?<width>\d+),(?<height>\d+)\],""crop"":\[(?<left>\d+),(?<top>\d+),(?<right>\d+),(?<bottom>\d+)\]\}$");
static readonly Regex FilenameRegex = new(@"^(?<prefix>.+?[\-_])(?<frame>\d{4})\.tga$");
static readonly Regex MetaRegex = new(@"^\{""size"":\[(?<width>\d+),(?<height>\d+)\],""crop"":\[(?<left>\d+),(?<top>\d+),(?<right>\d+),(?<bottom>\d+)\]\}$");
int ParseGroup(Match match, string group)
{

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Cnc.Traits
public class AttackLeapInfo : AttackFrontalInfo, Requires<MobileInfo>
{
[Desc("Leap speed (in WDist units/tick).")]
public readonly WDist Speed = new WDist(426);
public readonly WDist Speed = new(426);
[Desc("Conditions that last from start of the leap until the attack.")]
[GrantedConditionReference]

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Cnc.Traits
public readonly string OriginalActor = "mcv";
[Desc("Facing of the returned actor.")]
public readonly WAngle Facing = new WAngle(384);
public readonly WAngle Facing = new(384);
public readonly string ChronoshiftSound = "chrono2.aud";

View File

@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Cnc.Traits
public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Ally | PlayerRelationship.Neutral | PlayerRelationship.Enemy;
[Desc("Target types of actors that this actor disguise as.")]
public readonly BitSet<TargetableType> TargetTypes = new BitSet<TargetableType>("Disguise");
public readonly BitSet<TargetableType> TargetTypes = new("Disguise");
[Desc("Triggers which cause the actor to drop it's disguise. Possible values: None, Attack, Damaged,",
"Unload, Infiltrate, Demolish, Move.")]
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Cnc.Traits
[ActorReference(dictionaryReference: LintDictionaryReference.Keys)]
[Desc("Conditions to grant when disguised as specified actor.",
"A dictionary of [actor id]: [condition].")]
public readonly Dictionary<string, string> DisguisedAsConditions = new Dictionary<string, string>();
public readonly Dictionary<string, string> DisguisedAsConditions = new();
[CursorReference]
[Desc("Cursor to display when hovering over a valid actor to disguise as.")]

View File

@@ -42,8 +42,8 @@ namespace OpenRA.Mods.Cnc.Traits
readonly Player owner;
readonly List<Actor> actors = new List<Actor>();
readonly HashSet<TraitPair<IOnGpsRefreshed>> notifyOnRefresh = new HashSet<TraitPair<IOnGpsRefreshed>>();
readonly List<Actor> actors = new();
readonly HashSet<TraitPair<IOnGpsRefreshed>> notifyOnRefresh = new();
public GpsWatcher(Player owner)
{

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits
class InfiltrateForDecoration : WithDecoration, INotifyInfiltrated
{
readonly HashSet<Player> infiltrators = new HashSet<Player>();
readonly HashSet<Player> infiltrators = new();
readonly InfiltrateForDecorationInfo info;
public InfiltrateForDecoration(Actor self, InfiltrateForDecorationInfo info)

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Cnc.Traits
public readonly string AmmoPoolName = "primary";
public readonly WDist MinefieldDepth = new WDist(1536);
public readonly WDist MinefieldDepth = new(1536);
[VoiceReference]
[Desc("Voice to use when ordered to lay a minefield.")]
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Cnc.Traits
public readonly string TileUnknownName = "build-unknown";
[Desc("Only allow laying mines on listed terrain types. Leave empty to allow all terrain types.")]
public readonly HashSet<string> TerrainTypes = new HashSet<string>();
public readonly HashSet<string> TerrainTypes = new();
[CursorReference]
[Desc("Cursor to display when able to lay a mine.")]

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Cnc.Traits
class LightPaletteRotatorInfo : TraitInfo
{
[Desc("Palettes this effect should not apply to.")]
public readonly HashSet<string> ExcludePalettes = new HashSet<string>();
public readonly HashSet<string> ExcludePalettes = new();
[Desc("'Speed' at which the effect cycles through palette indices.")]
public readonly float TimeStep = .5f;

View File

@@ -84,7 +84,7 @@ namespace OpenRA.Mods.Cnc.Traits
readonly WithBuildingBibInfo info;
readonly RenderSprites rs;
readonly BuildingInfo bi;
readonly List<AnimationWithOffset> anims = new List<AnimationWithOffset>();
readonly List<AnimationWithOffset> anims = new();
public WithBuildingBib(Actor self, WithBuildingBibInfo info)
{

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
public readonly WVec[] LocalOffset = { WVec.Zero };
[Desc("Passenger CargoType to display.")]
public readonly HashSet<string> DisplayTypes = new HashSet<string>();
public readonly HashSet<string> DisplayTypes = new();
public override object Create(ActorInitializer init) { return new WithCargo(init.Self, this); }
}
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
readonly IFacing facing;
WAngle cachedFacing;
readonly Dictionary<Actor, IActorPreview[]> previews = new Dictionary<Actor, IActorPreview[]>();
readonly Dictionary<Actor, IActorPreview[]> previews = new();
public WithCargo(Actor self, WithCargoInfo info)
{

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
{
public class WithLandingCraftAnimationInfo : TraitInfo, Requires<IMoveInfo>, Requires<WithSpriteBodyInfo>, Requires<CargoInfo>
{
public readonly HashSet<string> OpenTerrainTypes = new HashSet<string> { "Clear" };
public readonly HashSet<string> OpenTerrainTypes = new() { "Clear" };
[SequenceReference]
public readonly string OpenSequence = "open";

View File

@@ -28,10 +28,10 @@ namespace OpenRA.Mods.Cnc.Traits
public readonly string[] UnitTypes = null;
[Desc("Number of drop pods spawned.")]
public readonly int2 Drops = new int2(5, 8);
public readonly int2 Drops = new(5, 8);
[Desc("Sets the approach direction.")]
public readonly WAngle PodFacing = new WAngle(128);
public readonly WAngle PodFacing = new(128);
[Desc("Maximum offset from targetLocation")]
public readonly int PodScatter = 3;

View File

@@ -24,10 +24,10 @@ namespace OpenRA.Mods.Cnc.Traits
public readonly int Speed = 28;
[Desc("Facing to use when actor spawns. Only 256 and 768 supported.")]
public readonly WAngle InitialFacing = new WAngle(256);
public readonly WAngle InitialFacing = new(256);
[Desc("Facing to use for actor previews (map editor, color picker, etc). Only 256 and 768 supported.")]
public readonly WAngle PreviewFacing = new WAngle(256);
public readonly WAngle PreviewFacing = new(256);
public override object Create(ActorInitializer init) { return new TDGunboat(init, this); }
@@ -58,8 +58,8 @@ namespace OpenRA.Mods.Cnc.Traits
{
public readonly TDGunboatInfo Info;
readonly Actor self;
static readonly WAngle Left = new WAngle(256);
static readonly WAngle Right = new WAngle(768);
static readonly WAngle Left = new(256);
static readonly WAngle Right = new(768);
IEnumerable<int> speedModifiers;
INotifyCenterPositionChanged[] notifyCenterPositionChanged;

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Cnc.Traits
public readonly string TerrainType = "Jumpjet";
[Desc("Height offset relative to the smoothed terrain for movement.")]
public readonly WDist HeightOffset = new WDist(3992);
public readonly WDist HeightOffset = new(3992);
[Desc("Cell radius for smoothing adjacent cell heights.")]
public readonly int SmoothingRadius = 2;

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.Traits
public readonly short JumpjetTransitionCost = 0;
[Desc("The terrain types that this actor can transition on. Leave empty to allow any.")]
public readonly HashSet<string> JumpjetTransitionTerrainTypes = new HashSet<string>();
public readonly HashSet<string> JumpjetTransitionTerrainTypes = new();
[Desc("Can this actor transition on slopes?")]
public readonly bool JumpjetTransitionOnRamps = true;

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.Traits
[ActorReference]
[Desc("Actor types that should be treated as veins for adjacency.")]
public readonly HashSet<string> VeinholeActors = new HashSet<string> { };
public readonly HashSet<string> VeinholeActors = new() { };
public override object Create(ActorInitializer init) { return new TSEditorResourceLayer(init.Self, this); }
}

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Cnc.Traits
[ActorReference]
[Desc("Actor types that should be treated as veins for adjacency.")]
public readonly HashSet<string> VeinholeActors = new HashSet<string> { };
public readonly HashSet<string> VeinholeActors = new() { };
public override object Create(ActorInitializer init) { return new TSResourceLayer(init.Self, this); }
}
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Cnc.Traits
class TSResourceLayer : ResourceLayer, INotifyActorDisposing
{
readonly TSResourceLayerInfo info;
readonly HashSet<CPos> veinholeCells = new HashSet<CPos>();
readonly HashSet<CPos> veinholeCells = new();
public TSResourceLayer(Actor self, TSResourceLayerInfo info)
: base(self, info)

View File

@@ -22,16 +22,16 @@ namespace OpenRA.Mods.Cnc.Traits
public class TSTiberiumRendererInfo : ResourceRendererInfo
{
[Desc("Sequences to use for ramp type 1.", "Dictionary of [resource type]: [list of sequences].")]
public readonly Dictionary<string, string[]> Ramp1Sequences = new Dictionary<string, string[]>();
public readonly Dictionary<string, string[]> Ramp1Sequences = new();
[Desc("Sequences to use for ramp type 2.", "Dictionary of [resource type]: [list of sequences].")]
public readonly Dictionary<string, string[]> Ramp2Sequences = new Dictionary<string, string[]>();
public readonly Dictionary<string, string[]> Ramp2Sequences = new();
[Desc("Sequences to use for ramp type 3.", "Dictionary of [resource type]: [list of sequences].")]
public readonly Dictionary<string, string[]> Ramp3Sequences = new Dictionary<string, string[]>();
public readonly Dictionary<string, string[]> Ramp3Sequences = new();
[Desc("Sequences to use for ramp type 4.", "Dictionary of [resource type]: [list of sequences].")]
public readonly Dictionary<string, string[]> Ramp4Sequences = new Dictionary<string, string[]>();
public readonly Dictionary<string, string[]> Ramp4Sequences = new();
public override object Create(ActorInitializer init) { return new TSTiberiumRenderer(init.Self, this); }
}
@@ -40,10 +40,10 @@ namespace OpenRA.Mods.Cnc.Traits
{
readonly TSTiberiumRendererInfo info;
readonly World world;
readonly Dictionary<string, Dictionary<string, ISpriteSequence>> ramp1Variants = new Dictionary<string, Dictionary<string, ISpriteSequence>>();
readonly Dictionary<string, Dictionary<string, ISpriteSequence>> ramp2Variants = new Dictionary<string, Dictionary<string, ISpriteSequence>>();
readonly Dictionary<string, Dictionary<string, ISpriteSequence>> ramp3Variants = new Dictionary<string, Dictionary<string, ISpriteSequence>>();
readonly Dictionary<string, Dictionary<string, ISpriteSequence>> ramp4Variants = new Dictionary<string, Dictionary<string, ISpriteSequence>>();
readonly Dictionary<string, Dictionary<string, ISpriteSequence>> ramp1Variants = new();
readonly Dictionary<string, Dictionary<string, ISpriteSequence>> ramp2Variants = new();
readonly Dictionary<string, Dictionary<string, ISpriteSequence>> ramp3Variants = new();
readonly Dictionary<string, Dictionary<string, ISpriteSequence>> ramp4Variants = new();
public TSTiberiumRenderer(Actor self, TSTiberiumRendererInfo info)
: base(self, info)

View File

@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Cnc.Traits
[ActorReference]
[Desc("Actor types that should be treated as veins for adjacency.")]
public readonly HashSet<string> VeinholeActors = new HashSet<string> { };
public readonly HashSet<string> VeinholeActors = new() { };
void IMapPreviewSignatureInfo.PopulateMapPreviewSignatureCells(Map map, ActorInfo ai, ActorReference s, List<(MPos, Color)> destinationBuffer)
{
@@ -120,7 +120,7 @@ namespace OpenRA.Mods.Cnc.Traits
PlusY = 0x8,
}
static readonly Dictionary<Adjacency, int[]> BorderIndices = new Dictionary<Adjacency, int[]>()
static readonly Dictionary<Adjacency, int[]> BorderIndices = new()
{
{ Adjacency.MinusY, new[] { 3, 4, 5 } },
{ Adjacency.PlusX, new[] { 6, 7, 8 } },
@@ -151,9 +151,9 @@ namespace OpenRA.Mods.Cnc.Traits
readonly IResourceLayer resourceLayer;
readonly CellLayer<int[]> renderIndices;
readonly CellLayer<Adjacency> borders;
readonly HashSet<CPos> dirty = new HashSet<CPos>();
readonly Queue<CPos> cleanDirty = new Queue<CPos>();
readonly HashSet<CPos> veinholeCells = new HashSet<CPos>();
readonly HashSet<CPos> dirty = new();
readonly Queue<CPos> cleanDirty = new();
readonly HashSet<CPos> veinholeCells = new();
readonly int maxDensity;
readonly Color veinRadarColor;

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
"fpls", "wcrate", "scrate", "barb", "sbag",
};
static readonly Dictionary<string, (byte Type, byte Index)> OverlayResourceMapping = new Dictionary<string, (byte, byte)>()
static readonly Dictionary<string, (byte Type, byte Index)> OverlayResourceMapping = new()
{
// RA ore & crystals
{ "gold01", (1, 0) },

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
string IUtilityCommand.Name => "--import-ts-map";
bool IUtilityCommand.ValidateArguments(string[] args) { return args.Length >= 2; }
static readonly Dictionary<byte, string> OverlayToActor = new Dictionary<byte, string>()
static readonly Dictionary<byte, string> OverlayToActor = new()
{
{ 0x00, "gasand" },
{ 0x01, "gasand" },
@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
{ 0xB3, "crate" }
};
static readonly Dictionary<byte, Size> OverlayShapes = new Dictionary<byte, Size>()
static readonly Dictionary<byte, Size> OverlayShapes = new()
{
{ 0x4A, new Size(1, 3) },
{ 0x4B, new Size(1, 3) },
@@ -163,7 +163,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
{ 0x7D, new Size(3, 1) },
};
static readonly Dictionary<byte, DamageState> OverlayToHealth = new Dictionary<byte, DamageState>()
static readonly Dictionary<byte, DamageState> OverlayToHealth = new()
{
// 1,3 bridge tiles
{ 0x4A, DamageState.Undamaged },
@@ -208,7 +208,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
{ 0x65, DamageState.Undamaged },
};
static readonly Dictionary<byte, byte[]> ResourceFromOverlay = new Dictionary<byte, byte[]>()
static readonly Dictionary<byte, byte[]> ResourceFromOverlay = new()
{
// "tib" - Regular Tiberium
{
@@ -239,7 +239,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
{ 0x03, new byte[] { 0x7E } }
};
static readonly Dictionary<string, string> DeployableActors = new Dictionary<string, string>()
static readonly Dictionary<string, string> DeployableActors = new()
{
{ "gadpsa", "lpst" },
{ "gatick", "ttnk" }

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
}
}
static readonly Dictionary<string, (byte Type, byte Index)> OverlayResourceMapping = new Dictionary<string, (byte, byte)>()
static readonly Dictionary<string, (byte Type, byte Index)> OverlayResourceMapping = new()
{
// Tiberium
{ "ti1", (1, 0) },