Remove unread private member (IDE0052)

This commit is contained in:
Matthias Mailänder
2022-09-10 19:45:39 +02:00
committed by Gustas
parent 43e0cca663
commit d3a8b07f05
14 changed files with 10 additions and 33 deletions

View File

@@ -144,6 +144,9 @@ dotnet_diagnostic.IDE0040.severity = warning
# Make field readonly.
dotnet_diagnostic.IDE0044.severity = warning
# Unused private member.
dotnet_diagnostic.IDE0052.severity = warning
# Unused parameter.
dotnet_diagnostic.IDE0060.severity = warning

View File

@@ -15,21 +15,18 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using OpenRA.FileSystem;
using OpenRA.Graphics;
namespace OpenRA
{
public class InstalledMods : IReadOnlyDictionary<string, Manifest>
{
readonly Dictionary<string, Manifest> mods;
readonly SheetBuilder sheetBuilder;
/// <summary>Initializes the collection of locally installed mods.</summary>
/// <param name="searchPaths">Filesystem paths to search for mod packages.</param>
/// <param name="explicitPaths">Filesystem paths to additional mod packages.</param>
public InstalledMods(IEnumerable<string> searchPaths, IEnumerable<string> explicitPaths)
{
sheetBuilder = new SheetBuilder(SheetType.BGRA, 256);
mods = GetInstalledMods(searchPaths, explicitPaths);
}

View File

@@ -1479,7 +1479,11 @@ namespace OpenRA.Server
{
readonly Connection connection;
readonly int[] pingHistory;
// TODO: future net code changes
#pragma warning disable IDE0052
readonly byte queueLength;
#pragma warning restore IDE0052
public ConnectionPingEvent(Connection connection, int[] pingHistory, byte queueLength)
{

View File

@@ -87,7 +87,6 @@ namespace OpenRA.Traits
[Flags]
public enum CellVisibility : byte { Hidden = 0x0, Explored = 0x1, Visible = 0x2 }
readonly Actor self;
readonly ShroudInfo info;
readonly Map map;
@@ -134,7 +133,6 @@ namespace OpenRA.Traits
public Shroud(Actor self, ShroudInfo info)
{
this.self = self;
this.info = info;
map = self.World.Map;

View File

@@ -26,7 +26,6 @@ namespace OpenRA.Mods.Cnc.Effects
readonly Animation anim;
readonly PlayerDictionary<DotState> dotStates;
readonly IDefaultVisibility visibility;
readonly IVisibilityModifier[] visibilityModifiers;
class DotState
@@ -52,7 +51,6 @@ namespace OpenRA.Mods.Cnc.Effects
anim = new Animation(actor.World, info.Image);
anim.PlayRepeating(info.String);
visibility = actor.Trait<IDefaultVisibility>();
visibilityModifiers = actor.TraitsImplementing<IVisibilityModifier>().ToArray();
dotStates = new PlayerDictionary<DotState>(actor.World,

View File

@@ -239,9 +239,6 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
{ 0x03, new byte[] { 0x7E } }
};
// Veins and vein holes
static readonly int[] ValidVeinNeighbours = { 0x7E, 0xA7, 0xB2 };
static readonly Dictionary<string, string> DeployableActors = new Dictionary<string, string>()
{
{ "gadpsa", "lpst" },

View File

@@ -20,7 +20,6 @@ namespace OpenRA.Mods.Common.Activities
public class DeliverUnit : Activity
{
readonly Carryall carryall;
readonly BodyOrientation body;
readonly bool assignTargetOnFirstRun;
readonly WDist deliverRange;
readonly Color? targetLineColor;
@@ -40,7 +39,6 @@ namespace OpenRA.Mods.Common.Activities
this.targetLineColor = targetLineColor;
carryall = self.Trait<Carryall>();
body = self.Trait<BodyOrientation>();
}
protected override void OnFirstRun(Actor self)

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Widgets
editorActionManager = world.WorldActor.Trait<EditorActionManager>();
editorCursor = world.WorldActor.Trait<EditorCursorLayer>();
resourceLayer = world.WorldActor.Trait<IResourceLayer>();
action = new AddResourcesEditorAction(world.Map, resourceType, resourceLayer);
action = new AddResourcesEditorAction(resourceType, resourceLayer);
cursorToken = editorCursor.SetResource(wr, resourceType);
}
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Widgets
else if (resourceAdded && mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Up)
{
editorActionManager.Add(action);
action = new AddResourcesEditorAction(world.Map, ResourceType, resourceLayer);
action = new AddResourcesEditorAction(ResourceType, resourceLayer);
resourceAdded = false;
}
@@ -107,14 +107,12 @@ namespace OpenRA.Mods.Common.Widgets
{
public string Text { get; private set; }
readonly Map map;
readonly IResourceLayer resourceLayer;
readonly string resourceType;
readonly List<CellResource> cellResources = new List<CellResource>();
public AddResourcesEditorAction(Map map, string resourceType, IResourceLayer resourceLayer)
public AddResourcesEditorAction(string resourceType, IResourceLayer resourceLayer)
{
this.map = map;
this.resourceType = resourceType;
this.resourceLayer = resourceLayer;
}

View File

@@ -1231,13 +1231,11 @@ namespace OpenRA.Mods.Common.Traits
class AssociateWithAirfieldActivity : Activity
{
readonly Actor self;
readonly Aircraft aircraft;
readonly int delay;
public AssociateWithAirfieldActivity(Actor self, int delay = 0)
{
this.self = self;
aircraft = self.Trait<Aircraft>();
IsInterruptible = false;
this.delay = delay;

View File

@@ -61,8 +61,6 @@ namespace OpenRA.Mods.Common.Traits
readonly World world;
readonly Player player;
readonly Predicate<Actor> unitCannotBeOrdered;
IBotPositionsUpdated[] notifyPositionsUpdated;
IBotRequestUnitProduction[] requestUnitProduction;
@@ -75,7 +73,6 @@ namespace OpenRA.Mods.Common.Traits
{
world = self.World;
player = self.Owner;
unitCannotBeOrdered = a => a.Owner != player || a.IsDead || !a.IsInWorld;
}
protected override void Created(Actor self)

View File

@@ -40,14 +40,11 @@ namespace OpenRA.Mods.Common.Traits.Render
public class WithSpriteControlGroupDecoration : IDecoration
{
public readonly WithSpriteControlGroupDecorationInfo Info;
readonly Actor self;
readonly Animation anim;
public WithSpriteControlGroupDecoration(Actor self, WithSpriteControlGroupDecorationInfo info)
{
Info = info;
this.self = self;
anim = new Animation(self.World, Info.Image);
}

View File

@@ -49,7 +49,6 @@ namespace OpenRA.Mods.Common.Traits.Render
{
readonly WithTextControlGroupDecorationInfo info;
readonly SpriteFont font;
readonly Actor self;
readonly CachedTransform<int, string> label;
Color color;
@@ -57,7 +56,6 @@ namespace OpenRA.Mods.Common.Traits.Render
public WithTextControlGroupDecoration(Actor self, WithTextControlGroupDecorationInfo info)
{
this.info = info;
this.self = self;
font = Game.Renderer.Fonts[info.Font];
color = info.UsePlayerColor ? self.Owner.Color : info.Color;

View File

@@ -49,15 +49,11 @@ namespace OpenRA.Mods.Common.Traits.Render
public class WithVoxelTurret : ConditionalTrait<WithVoxelTurretInfo>
{
readonly Actor self;
readonly Turreted turreted;
readonly BodyOrientation body;
public WithVoxelTurret(Actor self, WithVoxelTurretInfo info)
: base(info)
{
this.self = self;
body = self.Trait<BodyOrientation>();
turreted = self.TraitsImplementing<Turreted>()
.First(tt => tt.Name == Info.Turret);

View File

@@ -95,7 +95,6 @@ namespace OpenRA.Mods.Common.Traits
{
readonly TimeLimitManagerInfo info;
readonly int ticksPerSecond;
MapOptions mapOptions;
LabelWidget countdownLabel;
CachedTransform<int, string> countdown;
int ticksRemaining;
@@ -119,7 +118,6 @@ namespace OpenRA.Mods.Common.Traits
void IWorldLoaded.WorldLoaded(World w, OpenRA.Graphics.WorldRenderer wr)
{
mapOptions = w.WorldActor.Trait<MapOptions>();
if (string.IsNullOrWhiteSpace(info.CountdownLabel) || string.IsNullOrWhiteSpace(info.CountdownText))
return;