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

@@ -53,7 +53,7 @@ namespace OpenRA.Platforms.Default
public sealed class FreeTypeFont : IFont
{
static readonly FontGlyph EmptyGlyph = new FontGlyph
static readonly FontGlyph EmptyGlyph = new()
{
Offset = int2.Zero,
Size = new Size(0, 0),

View File

@@ -17,9 +17,9 @@ namespace OpenRA.Platforms.Default
static class MultiTapDetection
{
static readonly Cache<(Keycode Key, Modifiers Mods), TapHistory> KeyHistoryCache =
new Cache<(Keycode, Modifiers), TapHistory>(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1)));
new(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1)));
static readonly Cache<byte, TapHistory> ClickHistoryCache =
new Cache<byte, TapHistory>(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1)));
new(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1)));
public static int DetectFromMouse(byte button, int2 xy)
{

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Platforms.Default
const int GroupDistanceSqr = GroupDistance * GroupDistance;
const int PoolSize = 32;
readonly Dictionary<uint, PoolSlot> sourcePool = new Dictionary<uint, PoolSlot>(PoolSize);
readonly Dictionary<uint, PoolSlot> sourcePool = new(PoolSize);
float volume = 1f;
IntPtr device;
IntPtr context;
@@ -541,7 +541,7 @@ namespace OpenRA.Platforms.Default
class OpenAlAsyncLoadSound : OpenAlSound
{
static readonly byte[] SilentData = new byte[2];
readonly CancellationTokenSource cts = new CancellationTokenSource();
readonly CancellationTokenSource cts = new();
readonly Task playTask;
public OpenAlAsyncLoadSound(uint source, bool looping, bool relative, WPos pos, float volume, int channels, int sampleBits, int sampleRate, Stream stream)

View File

@@ -63,7 +63,7 @@ namespace OpenRA.Platforms.Default
public const int GL_CONTEXT_LOST = 0x0507;
public const int GL_TABLE_TOO_LARGE = 0x8031;
static readonly Dictionary<int, string> ErrorToText = new Dictionary<int, string>
static readonly Dictionary<int, string> ErrorToText = new()
{
{ GL_NO_ERROR, "No Error" },
{ GL_INVALID_ENUM, "Invalid Enum" },
@@ -157,7 +157,7 @@ namespace OpenRA.Platforms.Default
public const int GL_DEBUG_SOURCE_APPLICATION = 0x824A;
public const int GL_DEBUG_SOURCE_OTHER = 0x824B;
static readonly Dictionary<int, string> DebugSourceToText = new Dictionary<int, string>
static readonly Dictionary<int, string> DebugSourceToText = new()
{
{ GL_DEBUG_SOURCE_API, "API" },
{ GL_DEBUG_SOURCE_WINDOW_SYSTEM, "Window System" },
@@ -177,7 +177,7 @@ namespace OpenRA.Platforms.Default
public const int GL_DEBUG_TYPE_POP_GROUP = 0x826A;
public const int GL_DEBUG_TYPE_OTHER = 0x8251;
static readonly Dictionary<int, string> DebugTypeToText = new Dictionary<int, string>
static readonly Dictionary<int, string> DebugTypeToText = new()
{
{ GL_DEBUG_TYPE_ERROR, "Error" },
{ GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR, "Deprecated Behaviour" },
@@ -195,7 +195,7 @@ namespace OpenRA.Platforms.Default
public const int GL_DEBUG_SEVERITY_LOW = 0x9148;
public const int GL_DEBUG_SEVERITY_NOTIFICATION = 0x826B;
static readonly Dictionary<int, string> DebugSeverityToText = new Dictionary<int, string>
static readonly Dictionary<int, string> DebugSeverityToText = new()
{
{ GL_DEBUG_SEVERITY_HIGH, "High" },
{ GL_DEBUG_SEVERITY_MEDIUM, "Medium" },

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Platforms.Default
readonly IntPtr window;
bool disposed;
readonly object syncObject = new object();
readonly object syncObject = new();
readonly Size windowSize;
Size surfaceSize;
float windowScale = 1f;

View File

@@ -23,10 +23,10 @@ namespace OpenRA.Platforms.Default
public const int TexMetadataAttributeIndex = 2;
public const int TintAttributeIndex = 3;
readonly Dictionary<string, int> samplers = new Dictionary<string, int>();
readonly Dictionary<int, int> legacySizeUniforms = new Dictionary<int, int>();
readonly Dictionary<int, ITexture> textures = new Dictionary<int, ITexture>();
readonly Queue<int> unbindTextures = new Queue<int>();
readonly Dictionary<string, int> samplers = new();
readonly Dictionary<int, int> legacySizeUniforms = new();
readonly Dictionary<int, ITexture> textures = new();
readonly Queue<int> unbindTextures = new();
readonly uint program;
protected uint CompileShaderObject(int type, string name)

View File

@@ -25,12 +25,12 @@ namespace OpenRA.Platforms.Default
sealed class ThreadedGraphicsContext : IGraphicsContext
{
// PERF: Maintain several object pools to reduce allocations.
readonly Stack<Vertex[]> verticesPool = new Stack<Vertex[]>();
readonly Stack<Message> messagePool = new Stack<Message>();
readonly Queue<Message> messages = new Queue<Message>();
readonly Stack<Vertex[]> verticesPool = new();
readonly Stack<Message> messagePool = new();
readonly Queue<Message> messages = new();
public readonly int BatchSize;
readonly object syncObject = new object();
readonly object syncObject = new();
readonly Thread renderThread;
volatile ExceptionDispatchInfo messageException;
@@ -162,7 +162,7 @@ namespace OpenRA.Platforms.Default
this.device = device;
}
readonly AutoResetEvent completed = new AutoResetEvent(false);
readonly AutoResetEvent completed = new(false);
readonly ThreadedGraphicsContext device;
volatile Action action;
volatile Action<object> actionWithParam;